Raspberry Pi answers: Are my hamsters lazy or super athletes?


[ad_1]

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.)

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

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, it 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 even mean? I mean, what even is the “hamster equivalent” of a marathon? With these questions in mind, I decided to put my hamsters 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:

  1. Silencing the incessant squeaking of constant running that was keeping me up at night. (The ball bearings that are designed to play a video tape smoothly allow for relatively frictionless—and therefore nearly silent—rotation.)
  2. 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.)

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. I’m a huge fan of recycling and open source, so I made a personal choice to opt for open source solutions and recycled parts in my design whenever possible. If you want to build you own hamstrometer, you can download the Fritzing model for this circuit on my GitHub.

Here’s my parts list:

  • Raspberry Pi
  • Raspberry Pi peripherals (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 cable, 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.

Notice the magnet stuck to the wheel, spinning past the sensor on the circuit

The logging of our rotation data and any additional calculation is handled by the Raspberry Pi. After observing my hamsters’ behavior, 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 five 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 therefore 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?

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

Q: How long is the average human stride?

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

Q: How long is the average Roborovski hamster stride?

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. 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:

Brilliant!

This would enable us not only to see the steps the hamsters took very clearly, but is also unobtrusive to the hamsters’ normal lifestyle.

Luckily, the bottom of my hamster cage is translucent plastic, so an extra pane of glass wasn’t necessary. With a ruler, a pen, and some tape, I graphed and labeled the

WORLD’S MOST SOPHISTICATED 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.

Q: How many human strides are in one mile?

(5,280 ft / mile) * (1 human stride / 2.2 ft) = 2,400 human strides / mile

A: There are 2,400 human strides in one mile.

Q: How far does a hamster travel in 2,400 strides?

(0.166 ft / hamster stride) * (2,400 strides / mile) = 400 ft / hamster mile

A: A hamster travels 400ft in one mile.

Q: How long is four hamster marathons?

(400 ft / hamster mile) * (26.2 miles / marathon) = 10,487 ft / hamster marathons

(10,487 ft / hamster marathon) * (4 marathons) = 41,950 ft / four hamster marathons

A: Four hamster marathons is 41,950ft long.

Upload and track the data

I’ve been using ThingSpeak to host my data. ThingSpeak is an affordable and open source platform for hosting your IoT data. There is an API you can plug directly in to your project to upload your data, generate CSV files, and graph your data in near real time. You can watch my hamsters’ live data here on my website.

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):

Not one time did they make the cut.

Wow.

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?!?

But really, I probably shouldn’t be so disappointed that they didn’t make the four marathons a day marker. They’re averaging between 1 and 2 hamster marathons a day, which translates to between 2 and 5 human miles a day. Those are pretty impressive numbers for a creature that maxes out at about two inches long.

Github | GPL-3.0 license

[ad_2]

Source link

,

Leave a Reply