NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Sensors, Actuators, and Robotics » A Nerdkit Hamometer

August 07, 2009
by hijohng
hijohng's Avatar

Do you know hamsters? Maybe your kid has one; maybe you had one as a kid; maybe you have one now. One thing we all notice about hamsters is how much they love to run in their wheels. Did you ever wonder how far they go? Nerdkits can help answer this age-old mystery.

The basic design of this project is to mount a magnet on the hamster's wheel and put a hall-effect probe near enough to the magnet that you can distinguish a revolution of the wheel. (We actually used 2 magnets, 180-degrees apart, on the wheel; one South-pole facing out, one North-pole facing out. This doubled the amplitude of the signal.) The hall-effect probe provides the analog input to the AVR microcontroller, allowing you to count revolutions of the wheel. This gives you distance. By time stamping each instance of a rev, you can also calculate speed.

We started with the simple circuit for the temperature sensor that the Nerdkits folks use to introduce us to their great microcontroller kit. Instead of the temperature sensor, we dropped in a hall-effect sensor from Allegro; the 1321, in this case. This device outputs a voltage proportional to the sensed magnetic field. You'll want to read the data sheet of course, but generally what's happening with the AVR's A/D converter and the 1321 is that you will see a value of "500" when no field is present; that number will go up by 5mv for each gauss of South field it senses and down by 5mv for each gauss of North field. The stronger your magnets, the more leeway you will have in making the measurements. The magnets we used I pried off the refrigerator. These are small, but quite powerful neodymium beasties (originally purchased from K&J Magnetics to hold up some particularly heavy masterpiece from a pre-schooler).

There are two slightly "tricky" parts to making this work. The first is a cabling issue. If you want to mount just the sensor in the cage, you will need to transport the signal from the probe to the AVR itself. We used about 20 feet of CAT-5 cable. The second has to do with software. You will want the wheel to go around one full turn before you count a revolution. You can't just look for maximum values, for example, since the hamster may simply park the wheel so that the magnet is very near the sensor. This will make it look like the poor thing is cranking along at about 100 mph. There are various ways you may choose to guard against this. We chose to define a "rev" in software as a maximum reached after a minimum. This is where having 2 magnets, pointing in opposite directions, can help.

One other word of caution. Since most hamster cages are made of metal, placing the sensor outside the cage attenuates the field strength as seen by the 1321. If you can get the magnet close enough to the sensor, you can still make this work. However, in our case, we positioned the wheel so that it was very close to the cage but mounted the sensor between two pieces of cardboard, on the inside of the cage. In our set-up, the hamster doesn't have enough room to get between the cage and the wheel and munch on the sensor and cable. It's something you will want to take into consideration.

So, how fast does a hamster run? How far does one travel? Care to guess? Run, hamster, run... Here's a graph of the data we collected from one night.

How far does your hamster go?

August 08, 2009
by wayward
wayward's Avatar

Excellent project! I love hamsters and magnets! Could it be any cooler than that? Perhaps if the hamster had a laser sight mounted on the head =)

Thank you for a detailed write-up. Please post more data as it becomes available; in particular, if you leave the thing running one full day, I want to know what the hamster's duty cycle is. :)

August 10, 2009
by BobaMosfet
BobaMosfet's Avatar

How far does your hamster go?

What a great tagline for the new millenium! Laughs with Glee.... actually, I'm thinking about building a hamster wheel for my teacup chihuahua.... if she uses it, it would be a blessing. She can wear me out, and she's only 4.25 lbs!

August 13, 2009
by hijohng
hijohng's Avatar

Dear All, the International Hamometer Webpage has some new, exciting photos of instrumentation details. Don't miss them!

Wayward: I like the idea of a hamster's duty cycle. Our's generally gets up between 9 and 11pm and is pretty much going at full bore until sunrise. He sleeps a lot, but the work-to-wake ratio is higher than most people I know. He doesn't ever seem to be goofing off.

BobaMosfet: We have a "Wodent Wheel"; would yours be a Chihuawheel?

August 13, 2009
by sgmaniac1255
sgmaniac1255's Avatar

this makes me want a hamster to meter. perhaps i can tag my cats with RFID and track them around the house :P

March 04, 2010
by Phrank916
Phrank916's Avatar

Any possibility of the code being open source? I'm planning to make a simple bike computer that does distance and speed, etc. I was thinking I would use a hall effect sensor with a single magnet, but I'm very interested in your 2 magnet with opposing poles method of computing a "revolution".

Post a Reply

Please log in to post a reply.

Did you know that a flyback diode is important when driving a motor or any inductive load? Learn more...