How I Open Sourced My Hamsters for Science
Last year, I brought two new Roborovski hamster pups into our home. They looked identical at the time, so I named them both Hamtaro. (Fast forward the 1.5 years I’ve owned them, and one has grown significantly tubbier than the other… So I’ve nicknamed her Hamtaro Grande.)
Hamtaro y Hamtaro Grande
After having the Hamtaros home for about a week, one thing became extremely clear: they run all the time. At least, that’s how it feels when I’m trying to sleep through their squeaky wheel.
That’s Hamtaro on the wheel, and Grande on the ground
So back in January, curiosity led me to start researching my hamsters on The Internet. Confirming my suspicion, I read that Roborovski hamsters in particular are one of the most active hamster breeds in the world, and run “an equivalent of four human marathons each night on average”.
So this got me wondering: Could it be possible that my Roborovski hamsters are really running the hamster equivalent of four marathons a night?
…And if they are, what does that mean? I mean, what even is the “hamster equivalent” of a marathon?
Fast forward a few months, and I ran into my friend Kevin at CRASH Space. He showed me a project he was working on in an effort to encourage his lazy cat Toonces to exercise more. Kevin had modded his cat’s wheel with a little fin and a distance sensor to create a pedometer, and was uploading his cat’s daily progress to Strava.
(Needless to say, Kevin’s ungrateful cat has yet to thank him for his efforts.)
Feeling inspired by my friend’s dedication to his cat’s personal health and fitness, I thought back on the claims The Internet had made about my hamsters, and decided to put them to the test with some citizen science.
Here’s how it works:
Mod the Hamster Wheel to Allow for Safe Tracking
Luckily, I had already done the work to mod my wheel back in January. Back then, I had two goals in mind:
- Silencing the incessant squeaking of constant running that was keeping me up at night. (The ballbearings that are designed to play a video tape smoothly allow for relatively frictionless —and therefor nearly silent— rotation. )
- Provide a surface external to the cage to attach other apparatuses safely outside of hamster reach. (The VCR head has an axel that can reach through the cage bars, allowing me to mount the head itself to the outside of the cage.)
Notice that the VCR head spins on the outside when they run on the inside
You can see detailed instructions on how to mod your own hamster wheel here.
Build a Device to Record Hamster Data
The hamstrometer itself is essentially just an ethernet-connected pedometer. (If you’re following along with hopes of building your own, know that there are a million versions of these online, just in case the method I’m using doesn’t work for your needs.)
Notice the magnet stuck to the wheel, spinning past the sensor on the circuit
I’m a huge fan of open source, so I made a personal choice to opt for open source solutions in my design whenever possible.
You can download the Fritzing model for this circuit on github
Here’s my parts list:
- Raspberry Pi
- Raspberry Pi Periphreals (In an effort to cut down on waste, I got all of mine second-hand out of the CRASH Space junk bins): monitor, mouse, ethernet cord, hdmi cable, power cord (taken from an old modem), usb cord
- Sticky-backed Breadboard
- Hall Effect Sensor
- Rare Earth Magnet
- LED (optional: for notification and debugging)
- Jumper Wires
The primary functionality in the circuit is happening between the rare-earth magnet and the hall effect sensor. Hall effect sensors sense the presence of a magnetic field, and are therefore capable of counting rotations once we have mounted the rare-earth magnet to the rotating portion of the VCR head on our hamster wheel.
The LED lights up whenever the magnet is near the sensor
The Hamstrometer, dominating my entire dinner table
The logging of our rotation data and any additional calculation is handled by the Raspberry Pi. After observing my hamsters’ behaviour, I determined that they generally tend to wander on and off of the wheel several times within a very short timespan. Because of this, I decided to record their data in “sprints”. Whenever the sensor senses the presence of the magnet, it considers this to be the start of a new sprint. Each consecutive time it senses the magnet after that initial pass, it logs the current timestamp. It will continue to record as long as it senses the magnet. If 5 seconds go by without any activity, it terminates the sprint and logs the sprint data to a SQLite database.
Measure and Calculate Distances
The claim made by The Internet is that my hamsters run, on average, the equivalent of four marathons a night. So the in order to determine if this is true, we first have to ask ourselves: What is the “hamster equivalent” of four human marathons?
To determine this, I decided it would be fair to assume that if it takes a human X human-sized strides to run a human-sized marathon, then it must therefor take a hamster X hamster-sized strides to run a “hamster marathon”.
So in order to solve this problem, I had to answer a few other questions first:
- Q: How far does a hamster run in one wheel rotation?
- Q: How long is the average human stride?
- How long is the average Roborovski hamster stride?
- Q: How many human strides are in one mile?
- Q: How far does a hamster travel in 2,400 strides?
- Q: How long is four hamster marathons?
Knowing all of this, there was one last measurement to take. The hamstrometer is recording rotations of the wheel, so we need to ensure that we are converting properly between wheel rotations and feet.
I measured the diameter of my hamster wheel, and it is 0.5 ft.
0.5 ft X PI = ~1.5 ft
A: The distance a hamster runs in one wheel rotation is 1.5 ft
Luckily, this data is readily available all over the internet. I chose to go with the value of 2.2 ft, as that was quoted as being the average female human’s stride length, and my hamsters are ladies.
A: The average female human stride length is 2.2 ft
This one was a bit harder to figure out. It appears that the internet has significantly less data on the average stride of a female Roborovski hamster just lying around for the taking.
I started crafting ideas for tests, and threw a few of them out on twitter to see if any would stick.
@electricatz instead of ink (which means you have to find a non-toxic one) you could use water + food dye
— codebear (@codebear) July 9, 2015
The community was full of suggestions! We all chatted back and forth about the pros and cons of the various ideas, how much work they would require, how accurate they might be, and how irritated my hamsters might be by the whole ordeal.
Then one of us came up with the perfect idea:
@electricatz Make a cage with a glass floor. Put a 1″ scale measure on underside. Point camera up at their walking. Analyze.
— Zed (@zedshaw) July 9, 2015
This would enable us not only to see the steps the hamsters took very clearly, but is also unobtrusive to the hamsters’ normal lifestyle.
HAMSTER STRIDE MEASUREMENT SYSTEM!
And voila! After filming them and playing the footage back in slow-mo, I was able to get several measurements of hamster strides, and take the average.
A: The average stride length of my Roborovski hamsters is 0.166 ft.
A: There are 2,400 human strides in one mile.
A: A hamster travels 400ft in one mile.
A: Four hamster marathons is 41,950ft long.
Upload and Tracking the Data
The code I wrote for this project is in Python, with the exception of the database and tables, which are supported by SQLite. You can find the code I wrote for this project here on Github, available under the GPL-3.0 license.
Analyzing the Data
I tracked my hamster’s activity for one month straight, and (spoiler alert):
Perhaps this is because my hamsters are getting old? Perhaps domesticated Roborovskis don’t perform as well as they do in the wild? Or maybe mine are just …really lazy?
OR MAYBE THE INTERNET WAS LYING ALL ALONG?!?!?!?!!?
So… What’s the low-hanging fruit here?
But really, I probably shouldn’t be so disappointed that they didn’t make the 4 marathons / day marker. I mean, these are still pretty impressive numbers for a creature that maxes out at about two inches long:
Definitely farther than I run each day, that’s for sure.