Using a Raspberry Pi to make a hamster pedometer

Stanislav Cociorva, 123RF.com

Racing Rodents

Researchers assert that hamsters run the equivalent of four marathons per night. We tested this with the help of a converted playback head from a video recorder, a hall sensor, and a Raspberry Pi.

Last year, two young Roborowski miniature hamsters [1] took up residence in my home. At first, the two little creatures looked exactly alike. As such, both the male and the female were given the name Hamtaro. In the meantime the hamsters have matured into adulthood, and the female weighs more than the male. She is therefore now known as 'Hamtaro Grande'. Within the first few weeks, it was clear that the Roborowskis were excellent athletes. During the night, they could run endless laps on their hamster wheels without ever taking a break. The constant squeaking from the wheels kept the household awake.

I turned to the Internet out of curiosity and a desire to learn more about the activity level of Roborowskis. As it turns out, they are the most active members of the crecitid family. According to the available literature, they run the equivalent of four marathons every night. I could not help but ruminate on this astounding piece of information. What actual distance is considered to be a marathon for a hamster? Do these tiny rodents really run this distance four times over each night, even though this effort would cause a even a professional human athlete to collapse? With these questions in mind, I decided to find out what the hamsters are truly capable of by applying some learning along with a Raspberry Pi as a measuring device.

README

Hamsters prefer to stay in their nests during the day. Once it starts getting dark though, they have a strong urge to get moving. During the night they can exhibit a very high level of activity. The DIY "cricetidometer" described in this article answers the question of whether these cricetids actually do outperform the best marathon runners.

Building a cricetidometer

The first step in the testing process was to improve the stability of the hamster wheel in order to minimize squeaking and provide the hamsters with a continuous, smooth running surface. I used a ball bearing mounted head drum from a discarded video recorder to make the hamster wheel stable and to reduce noise associated with turning almost altogether. The next step was to develop a cricetidometer which would serve as a network-capable pedometer for reporting the distance run by the Roborowskis.

Figure 1: The two experimental Phodopus roborovskii hamsters known as Hamtaro and Hamtaro Grande.

Being a fan of both free software and recycling, I used open source software and repurposed parts in my designs wherever possible. As a result, many of the parts used for this experiment came from the trash cans of the Hackerspace CRASH Space in Los Angeles. [4]. The open source software Fritzing was used to develop the necessary switches (Figure 2). The reader can find the corresponding models and the source code for the software programs that were created as part of this project on Github [6].

Figure 2: The open source electrical engineering application Fritzing was used to develop the switches.

The main function of the switching circuit is to capture the fluctuations in the signal of the hall sensor which occur when the magnet passes by. Consequently, in order to count the rotations of the hamster wheel, the magnet sits on the axle of the video recorder head and the sensor is tightly mounted on the cage. A Raspberry Pi assumes the tasks of recording the rotations and all other computations. The computing power of a first generation Raspberry Pi is definitely sufficient for this (Figure 3).

Figure 3: An overview of the suspended construction of the cricetidometer. The video recorder head and the hall sensor hang on the cage. The Raspberry Pi interprets the data.

In observing the hamsters, we noted that they tend to quickly jump on and off the wheel in short intervals. As a result, the data is recorded in "sprints". As soon as the sensor registers a movement of the hamster wheel, the measurements start a new sprint. After the first rotation of the wheel occurs, the software records each succeeding rotation with a time stamp. As soon as the sensor notices that there have been no rotations for a five second time period, the measurement program will close the current sprint and write the data to an SQLite database.

Table 1

Components

Components

Comments

Raspberry Pi

The Cricetidometer requires minimal computing performance so a first generation Raspberry Pi or Raspberry Pi Zero will do.

Raspberry Pi equipment

Monitor, mouse, Network and HDMI cables, a power supply, an adhesive backed "Breadboard".

Hall sensor

Rare earth magnet [9]

Neodymium iron boron magnet or similar.

LED

Optional. Used for messages and debugging.

Adafruit Pi Header

Jumper cable

Hamster Marathon

Citing a BBC documentary, the English language Wikipedia states that Roborowskis run four marathons every day. Of course this does not mean that they run 42.195 kilometers a day but rather a distance that would be proportionate to the much smaller stride of these animals. Therefore, we had to determine the distance actually involved.

Assuming that a human being must take x number of steps in order to complete a marathon then it follows that the length of a hamster marathon is the sum of x (number of average sized mincing little hamster steps) times h, (length of hamster steps). A few questions must be answered to determine values for x and h.

The first question would be how far the average person moves by taking one step. There is extensive information on this issue on the Internet. Since both of the hamsters in question are female, we looked at the average length of steps for women. Various websites declare that a woman steps 67 centimeters on average.

The next question would be how far a hamster moves when turning the hamster wheel backwards. The cricetidometer measures the rotations of the hamster wheel. Therefore we need to make sure that we correctly convert the measurements. The inner diameter of the wheel amounts to about 15.2 centimeters. Applying the formula for calculating the circumference to this (D=2xrxPi), we can determine that the distance for backward wheel movement is about 47.8 centimeters.

How long is the average step of a Roborowski hamster? This question is not so easy to answer. For some unknown reason, there are practically no researchers interested in this question(!) After some brainstorming and consultations with associates, we placed a hamster on a pane of glass with a scale drawn on it. Once the hamster started to move, it could be filmed from underneath. The resulting video makes it easy to determine the length of stride without disturbing the little rodent. Since the glass hamster cage itself has a transparent bottom, this made the idea easy to implement (Figure 4). Through analysing the videos in slow motion, we found that the mean length for a step was almost exactly 5 centimeters (Figure 5).

Figure 4: Drawing a scale on the transparent floor of the hamster cage makes it possible to measure the length of a hamster step.
Figure 5: Analyzing the video in slow motion shows the length of the step of a hamster to be about 0.166 feet, or just about 5 centimeters.

Now it is possible to easily calculate the distance of a hamster marathon. The distance covered in a human marathon race amounts to 42.195 Kilometers. Assuming an average step to be 67 centimeters long, then 62,978 steps are required to complete the marathon. A hamster having a step that is 5 centimeters long will therefore have to run 3.15 kilometers in order to complete an equivalent marathon. If the citation in Wikipedia is correct, then a hamster has to run over 12.5 Kilometers every night.

Figure 6: The Cricetidomether counted up to 500 rotations of the hamster wheel per sprint.

Buy this article as PDF

Express-Checkout as PDF

Pages: 5

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • How to get your Pi to go

    Pi2Go-Lite is a new fully integrated robot kit that makes it easy to get into robotics with the Raspberry Pi. We speak to its creator about how it works, then build our own autonomous line-following robot.

  • A home intrusion detection setup (sort of)

    At least part of the popularity of the Raspberry Pi can be attributed to its high maker value; that is, a skilled maker with a Pi can build marvelous and beautiful things. Me? Not so much, but I was willing to try to build a home security system with the stuff in my junk box. Here's what happened …

  • Building Rasp Pi into Mindstorms projects with BrickPi

    BrickPi lets you build a Raspberry Pi into your Lego Mindstorms projects – you can even connect your Pi to Mindstorms sensors and motors.

  • Building the SunRover navigation system

    The Switch Doc continues his effort to build a solar-powered robot. This month the emphasis is on the navigation system.

  • Taking the Raspberry Pi over hill and dale

    The Raspberry Pi is the heart of many different projects, be they navigation devices or flight scanners. When equipped with a suitable keyboard and simple monitor, the little computer can also be put to use for tasks in the great outdoors.