This project was inspired by Joshua Klein's Crow Box, a self-described "experimentation platform designed to autonomously train corvids." However, as various biologists/corvid researchers pointed out, this project's lack of results while working with wild birds was due in large part to the fact that crows, in all their intelligence, couldn't be bothered to expend energy solving puzzles in order to get small payouts of food when they could just as well hunt around elsewhere for their usual sources of calories that were both easily accessible and plentiful. To its credit, the Crow Box was proven to be successful with captive birds as food options were inherently restricted. Because I don't have pet corvids, which require specialized licenses to keep and in all honesty don't make great pets (Peter Caine succinctly explains why here and here [heads-up: strong language]), I decided to build a similar project for training my cat and learning more about cat intelligence.
After doing research on similar efforts as well as cat intelligence I learned several things that further motivated this specific project:
First of all, not a whole lot of research has been done about domestic cats in general. Relative to the amount of experiments/studies done on dogs there are a lot fewer papers that I could draw on when designing learning progressions for the domestic cat. As any cat owner reading this may have already guessed, this seems to be due, in part, to the fact that as experiment participants cats can be hard to work with and tend to "drop out" of studies. Unlike dogs who can enthusiastically drill a target behavior during training over and over, cats do better when trained consistently for much shorter intervals where cues are extra clear, they are set up for success from the start, and smaller steps in complexity are taken as their behavior is shaped toward the target.
Second of all, the historic domestication of cats came about much more passively (and recently) than it did for dogs. While dogs were quite early on bred for specific roles: hunting, searching, herding with a specific focus on intelligence, etc., cats were valued initially for behaviors similar to those that they had while wild (e.g. by "just doing their thing" cats were killing mice and protecting grain stores for example). Additionally, even when the breeding of cats became more rigorous and intentional it was, and still is, all but completely focused on appearance and general domesticity alone. Because of this, cat intelligence hasn't been as carefully documented or selected for. We really don't have a good understanding of the cognitive limits and abilities of cats at the species level, let alone across breeds and individuals.
Lastly, I came across a propriety product that markets itself as a game console designed to stimulate pets mentally as well as teach them to solve challenges (CleverPet) that was exactly what I was looking for. Unfortunately, it is somewhat cost prohibitive for many including myself. For a much, much, smaller cost I think any tinkerer can build something similarly effective, especially if it's developed openly and allows for each and every parameter to be optimally tweaked and fine-tuned to the needs and abilities of an individual pet.
Arduino Cat Console Prototype: The Cat Box
The console is still being actively developed but so far it's basic functionality is as follows:
Once powered up, a start screen is displayed until the input button is pressed. Pressing the button additional times will cycle through the available stages and repeatedly start a short timer (visualized with a loading bar) until timeout confirms your selection. A short delay occurs before symbols are shown on the LED matrix. The initial delay, symbols to be displayed, max duration a symbol is shown, the fixed or randomly varied wait time between symbols, which symbol is rewarded, etc. are currently set to defaults but should be played around with to adapt the learning progression to the observed cats' abilities and performance. As the stage runs, the LCD screen displays the number of treats remaining (as a health bar) , the moving average response time for successful hits, the number of misses (the count of rewarded symbols that timed out without a response), the number of wrong responses (the count of times when a click was made during a non-rewarded symbol, if any), and the number of whiffs (the count of clicks when no symbol was even displayed at all). Finally, if all the treats are consumed, an animated win screen is shown on the LCD with the total time it took to complete the stage.
Active tasks that I am working on currently and would love help with:
- Reorganizing EVERYTHING so that the code is easy to use as well as collaborate on (definitely open to/looking for people interested in being collaborators). I am just barely transitioning to using VSCode + PlatformIO after using the Arduino IDE (should of switched after the first couple hundred lines honestly) due to increasing complexity but also just for quality of life. This is my first time using C++ and I'm still learning the basics but making a platform that is as streamlined as the Crow Box's code would be rad so experienced collaborators would be a huge boon.
- An interrupt button that ends a running stage early but allows a user to capture the data recorded up until that point.
- A separate results screen after the run screen that has more space/shows other interesting statistics (e.g. the average reaction time for 'wrong' presses, as a similarity to the correct response reaction time would indicate that the cat is having trouble discriminating between the symbols).
- A good 3D design for the dispenser drum that is more precise than the one that I cobbled together out of cardboard to avoid any jams/hang ups.
- Finish stage 4: implement the sampling of random variables from the normal distribution to be used for the intermediary wait times between symbol flashes.
- Additional Stages: Ideas I've had so far I've listed at the bottom of this description/the repo README
Currently, only a few stages are complete. Below is the descriptions of what's been done so far and the general outline of how the learning progression is currently structured. I just copied this from the GitHub repository linked in this project, please check there for the most recent updates and activity.
Stage 1 [Complete]
Purpose: Get the cat used to operating the machine.
Description: A simple 'X' is shown, near constantly, and each successful press while the 'X' is illuminated is rewarded with a treat. (I say ‘near constantly’ because the LED matrix is cleared temporarily during motor operation/when extraneous inputs are blocked after a successful button press).
Rationale: For this to go anywhere the cat must first learn that a pushing of the button, specifically when a symbol is displayed, is rewarded. I chose to start with the 'X' because I thought perhaps it was the slightly more distinguishable starting point.
Stage 2 [Complete]
Purpose: Help the cat learn to wait for the LED display.
Description: The same simple ‘X’ is shown for a set time (e.g. three seconds max without a response) before getting cleared for a set period (e.g. five seconds). Only successful clicks made while the ‘X’ is displayed are rewarded.
Rationale: The cat must also learn that the button isn’t just a wand for summoning snacks and is in actuality associated with the LED matrix display, specifically this repeated symbol ‘X.’
Stage 3.A [Benched]
Purpose: Introduce random timing earlier to the learning process.
Description: The same basic conditions as Stage 2, however the wait time in between displays is now a random variable that is normally distributed (Two parameters, maybe the mean is kept at the previous wait time (e.g. 5 seconds) and the standard deviation is played with to generate desired variability.
Rationale: This should be an easy transition from the previous stage and strengthens the association between successful button presses and the LED display independent of timing.
Stage 3.B [Complete]
Purpose: Introduce symbol discrimination earlier to the learning process.
Description: The same display/wait times as Stage 2 (e.g. 3 seconds/5 seconds), but there is a random (50-50) chance that either an ‘X’ or an ‘O’ is displayed. Only button presses when the ‘X’ is shown will be rewarded.
Rationale: This demonstrates that not all LED displays are equal and this first challenge in symbol discrimination is perhaps aided by the previously learned timing regularity (assuming that the cat picked up much on the regularity of wait times in the first place, likely a negligible influence).
Purpose: Train discrimination between two symbols shown at random, with random wait times between display events.
Description: At random either an ‘X’ or ‘O’ is shown for the previous set times with random wait times in between. Only button presses when the ‘X’ is shown will be rewarded.
Rationale: This the natural progression from either option A or B for Stage 3, where both display unpredictability and discrimination are now at play. Whether Stage 3.A or 3.B is a better intermediate isn’t immediately clear and depends on whether we think introducing random wait times or symbol discrimination earlier (and in isolation) would be a more helpful learning progression.
Ideas for Additional Stages
- All at once, or one at a time, transition the 'X' and 'O' to the slightly more complex AND more co-similar 'smiley' and 'fontX' already in the code.
- Test adaptive learning by switching out the more complex ‘smiley’ or ‘fontX’ with a novel symbol that differs from both (e.g. the 'beer' symbol in the code that is rectangular, both filled and hollow, and is off center).
- Test fine grained discrimination: normal ‘X’ vs. fontX, or normal ‘O’ vs. smiley.
- Test response to reverting one symbol to a simpler/past symbol that was also compared against the current antagonist symbol.
- Test switching/cue blocking: flip what symbol is rewarded completely (previously ‘X’, now ‘O’). It would be interesting to see how quickly/with how much effort this would work. Perhaps the multiple, simpler stages leading up to the reward ‘flip’ will have to be similarly flipped around to build up to it. This seems like it could be an insightful measure of intelligent identification/discrimination, but there is a tension between rewarding an 'x-like' or 'o-like' symbol for a long time such that an ingrained association can be used as a solid foundation for more complex tasks, and switching the reward early during simpler tasks when it may be easier to transition completely, if possible at all. Likely this can't be determined until one sees how fast a cat clears levels and their aptitude for distinguishing symbols. Several months of rewarding 'X,' for example, would seem to make the transition to rewarding 'O' extremely difficult, but on the other hand the cat's behavior may have been reliably shaped in such a way that it will consistently select 'X' in much more complex arrangements (e.g. the holy grail: tic tac toe).
- Test discrimination between more than two symbols.
- Reward selection of a specific sequences of numbers (so you can pretend your cat can do sums for guests, or something of the like).
- Test reaction time: (slowly shorten the display time and therefore the window of time in which a successful click can happen, maybe increase treat pay out if personal records are smashed). This would be particularly interesting if paired with symbol discrimination.
- AND PROBABLY A LOT MORE (e.g. you get an RGB LED matrix and can train color recognition, keeping in mind cats have much fewer cones and see in blue-violet/yellow-green ranges).
A Note On Parts/The Basic Physical Build
Due to the lockdown I did not have access to the local maker space and therefore most of the tools/3D printing capabilities that would of made this something I could've built in a day instead of the week and a half it actually took. I had to scavenge things from around the house and get all the precision I could out of a metal ruler, scissors, wood glue, duct tape, and a utility knife while trying more than a few times to build a successfully working version of what I needed using material out of the recycling bin. A few of the solutions I came up with (beyond the Arduino kit components I had on hand to use):
- The Clicker Lever/Sound Box - Used a classic push button. Put it in the top of a small card board box lid (I used a small box from a pair of earrings) with a lever/pressure pad to make it sensitive to the slightest paw pressure. I made the lever augment out of cardboard pad glued to pen cap with hole through it (for the bamboo skewer cross bar it would rotate around), and put a thumb tack into the pen cap where it could act as a fulcrum on the pushbutton below. PRO TIP: cut a hole in the top of the small cardboard box's lid just below the button. The box itself will help to project the noise of the button being pressed which creates two clear clicks with different tones. This mimics the role of a clicker used in hand training by serving as a clear and consistent cue for the target behavior. Timing is important but it could be no more precise than it is in this arrangement as this ensures it sounds EXACTLY as the cat correctly taps the pad.
- Pringles Can-based Dispenser - The traditional DIY source of an easy to cut tube with a metal bottom has, and always will be, the Pringles can. I made a hole in the base of the can for the shaft of the stepper motor which I screwed on from the inside after cutting off the bottom several inches of the can (to cleanly cut the can with the limited tools I had I put the can sidewise on a table snuggly between two heavy books, taped the utility knife blade to the end of a back scratcher with the 'fingers' to help hold the blade vertical, and loaded up books/weights onto the back scratcher to hold the blade in place perpendicular to one side of the can as I rotated the can between the books and gently tapped the other end of the back scratcher to push the blade in a little deeper after rolling the can all the way around a few times). Cutting the rim of the can off the top and gluing it around the base of the can allowed me to use the can's lid for a clear, flat surface above the screw heads and drop hole in the bottom of the can upon which I could set the cardboard wheel with sixteen spokes (with a clear/aluminum lid from a tin of mints as a cover) that would be turned by the motor. Each of 15 treats was dropped into the space between the spokes so that one space was left empty and initially placed over the hole in the lid with the hole in the bottom of the can directly below. Every sixteenth of a revolution, then, lets a single cat treat drop through into the tube to be ejected through a chute.
- Wine Box Housing/Dispenser Tower - A wine box was the perfect size for housing the solderless breadboard I had as well as the Arduino while leaving enough space to be able to connect wires without too much trouble. By positioning both the Arduino and power module (on one the end of the breadboard) near the hole in the top of the box for the handle cutout I was able to press both the board's 'reset' button and the switch for the motor power by sticking my finger through the opening in the top without needing to open the box up. The opening for the wine nozzle is also at a good height to feed in the wires from whatever button/lever module is being used. A second wine box (seem to be more abundant now that both my gf and I are working from home...) I used to handle all cat treat dispensing because I knew at some point the cat would try and break into where she thought the treats where and I didn't want to have the wiring and components in the same place. The Pringles can segment with the stepper motor and drum holding the treats I simply taped to the top of the box (above the handle cutout hole) so that treats could fall down into an internal chute I made out of an empty tea bottle with the bottom corner cut out and angled upside down so that dispensed treats would slide out the mouth of the bottle which snuggly fit inside the nozzle opening of this box. I cut a hole in the back of the box as well so that the end of a small hand weight could be set inside to keep the whole thing stable during shakedowns.