Intro: Ultimate Hamster Tracker Wheel – Featuring: Mbed C++, LCD Display, Laser Cutter
About a year ago, I made an uncommon choice for a college student; I got a pet hamster for a roommate. It ran so much during the night, the noise of that squeaky wheel kept me awake.
Lying awake at night, I asked myself the following questions:
- How far can this hamster run in a night?
- Where can I get a silent wheel?
- I wonder what I can do with the mbed stored in my closet?
The answer became a fun project to keep me busy in my spare time. In Solidworks I designed a new hamster wheel out of laser cut birch wood. The fundamental components to the wheel are 2 skateboard ball bearings for silent operation. Built into the design is a hidden reed switch (magnet proximity detector) and wire that connects to the mbed. Finally, I wrote the C++ code that logs and displays wheel activity data on a small LCD screen.
This guide assumes you have experience with laser cutting equipment, mbed microcontroller, breadboard wiring, and soldering. Most Electrical and Computer Engineering Students (or any determined maker) will have these skills. As an Electrical Engineering Student, I only needed to spend an additional $40 to complete this project.
Step 1: Gather Materials and Tools
- 1x mbed LPC1768 ($55) https://www.sparkfun.com/products/9564
- 1x uLCD-144-G2 ($35) https://www.sparkfun.com/products/11377
- 1x breadboard and jumper cables ($25) https://www.amazon.com/EXTERNALLY-SOLDERLESS-TIE-...
- 1x reed switch ($5 or $10 for 10) https://www.amazon.com/Directed-Electronics-8601-...
- 3x birch wood sheet, 12inx24inx1/8in thick ($25 for 6 sheets) https://www.amazon.com/gp/product/B002WXD5UK/ref=...
- 2x skateboard ball bearings, 8mm core x 22mm outer diameter x 7mm width ($10 for 10) https://www.amazon.com/gp/product/B00NX1WBA0/ref=...
- 1x bolt, 5/16inx5in long (I used 5.5in long bolt in photos)
- 4x washers, 5/16in
- 5x nuts, 5/16in
- 2x magnetic washers, #4 (#4 = 0.120in)
- 1x screw, #4x3/8in long (#4 = 0.120in)
- 1x nut, #4 (#4 = .120in)
- 1x spare wire or broken headphones, ~30in long
- Wood glue
- 2x wrench (I used an Ikea wrench and skateboard tool)
- 1x short wrench (I used small pair of pliers)
- 1x philips-head screwdriver
- 1x soldering iron (I used a cheap $15 30W iron - not recommended)
- Access to laser cutter (I used maker space resources on my college campus)
Step 2: Laser Cutting the Wheel
Start by downloading the Solidworks files attached to this step. I have included all of the part files, assembly, and the drawing file for the laser cutter. I prefer to print directly from Solidworks, instead you can generate your own printing file in AutoCAD by laying out the parts in the quantities listed below:
- 1x wheel-side
- 1x wheel-side-screwhole
- 2x wheel-side-bearing-support
- 30x footpath1
- 1x switch-holder-A
- 1x switch-holder-B
- 1x base-bottom-m2
- 2x base-side-m2
- 2x base-support-m2
I used an Epilog Legend 36EXT 50W with a 36inx24in cutting area. Consult the laser cutter manual for recommendations about cutting 1/8in birch wood. Our manual only had 1/8in Cedar listed, so I reduced the cutting speed from 30% to 20%. Finally, I reached the following settings:
- Speed: 20%
- Power: 80%
- Freq: 500Hz
To print the wheel, open the three drawing files listed below and send print to laser cutter with the settings explained above. This print will use three sheets of birch wood.
- This type of birch wood may arrive warped slightly, I used a couple large washers to press down the highest point of the surface.
Step 3: Wheel Assembly
Clean up the laser cut parts by wiping away soot with paper towel. To go the extra mile you can use sandpaper to get rid of burnt edges. Use wood glue to bind parts together while being sure to wipe away any excess glue. Keep in mind, wood glue dries yellow and can spoil the look of the wheel if you rush this step. Get a friend to help you with this step if possible. Sorry for lack of pictures - I was eager to put this together after it was cut.
Glue the base of the wheel together. Like any puzzle, order matters but it is straight forward - I won't waste time explaining it.
Glue the ball bearings into place with the bearing support placed on the inside of the wheel cavity. The ball bearing should be flush with the outside face of the wheel side. Do not get glue on sides (or inside) of ball bearing.
Gluing the footpath to both sides of the wheel is the most difficult step. Before adding any glue, I recommend putting the bolt through the two wheel sides and add four equally spaced footpath planks to temporarily hold the final shape if the wheel. Start by gluing more footpath planks to just one side of the wheel. This will allow you to glue one side while ensuring the footpath planks line up with the yet-to-be-glued side. Finish by quickly adding glue to every footpath plank then place the yet-to-be-glued side on. You can put away the glue now.
Assemble the wheel with nuts, washers and the main bolt. There is a little flex in the sides of the base that will allow you to alternate between screwing the nuts into position. Once again, this step is like a puzzle: righty-tighty, lefty-loosey. I found it easiest to use my hands to get the nuts to the final position then use the tools to fix them into place. Use the short wrench (or pliers) to tighten the nuts on the inside of the wheel cavity.
Remember to tighten the nut closest to the bolt head first and work away from there. The order of components is as follows:
- Bolt head | washer | wood | washer | nut | bearing | nut | empty space | nut | bearing | nut | washer | wood | wood | wood | washer | nut
Also install the magnet with the small bolt and nut. Do not over-tighten - magnets are brittle, I snapped one. I added a couple drops of glue when tightening as a thread locker - I do not want the hamster eating these small pieces. The order of components is as follows:
- Bolt head | magnet | wood | magnet | nut
Step 4: Install Simple Circuit Onto Wheel
Create the wire lead that connects the reed switch to the breadboard, then to mbed pin 24. The reed switch and wire is fixed inside a U-shaped wood layer. Two other wood layers sandwich the switch so that the hamster does not interact with it.
Use the assembled wheel to estimate the ideal location of the reed switch. When the magnet is present, the switch is closed and the pull-up circuit yields a binary 1/ON. Without magnet present, the switch is open and the pull-up circuit yields a binary 0/OFF. Some minimal software de-bouncing is applied to the signal. You should be able to hear two distinct clicks (one close and one open) on each revolution. The ON-time between clicks should be as long as possible to ensure detection. Avoid more than two clicks per revolution. Mark the best position found with an X.
Use your wire striping and soldering skills to create the reed switch package that still fits inside the wood sandwich. I used old headphones so that I could disconnect the wheel from the breadboard using a small red breakout board I had. For an outline of the circuit please look at the two napkin notes attached above. The circuit appears more complicated than needed because I used all four wires for a two-wire job. Finally, use some tape, glue or friction to keep the reed switch in place when the wood layer sandwich is complete. The final nut should be enough to keep the wood layers flush together.
Note on electricity and hamsters:
The scale of the electricity used here should not harm the hamster even if chewed through. The hamster should be safe - no promises.
Step 5: Mbed Wiring and C++ Code
You have two options: you can rewire your breadboard to match the images above, or you can edit the C++ code to work with your current wiring setup. If you have done an mbed project with these components before, either option should be straight forward.
As shown in the images above, some components present are unused and some components are optional. I have added doodles to highlight key details. See images above for exact pin connections that work with the code provided. See these pages for more applications of the uLCD and ShiftBrite.
In the future I may add a photo of a bare-bones breadboard with only the needed components present.
Next you will need to get a compiled version of the program onto your device.
Sign into your mbed compiler account: https://developer.mbed.org/compiler
Go to my other page and click "Import into Compiler": https://developer.mbed.org/users/bstrickland9/code...
Once in the IDE make sure the correct microcontroller is selected (LPC1768) then click compile. Download to your mbed via USB.
Step 6: Final Testing, FAQs, and Safety
Your Ultimate Hamster Tracker Wheel should be complete and ready for action. Of course you can test the functionality without the hamster present.
Here is a list of possible FAQs:
- How do I power my mbed without connecting it to a computer?
- Take care when using 5V wall wart to power your mbed. The mbed draws very low current; some USB phone chargers will reach 14V when current is this low! Do some homework to make sure the power supply is voltage regulated and ripple is low enough for this application. After I did my homework, I found an unused Apple iPhone charger that works fine.
- Why is reed switch not activating consistently?
- This is when I discovered I needed to re-position the reed switch from Step 4 - a quick fix.
- Why does the reed switch not activate when wheel is spinning over 2m/s?
- I wish the system was capable of that kind of speed but this turns out to be a non-issue. Hamsters have a max speed around 4mph or 1.8m/s.
- Why is data missing from the display?
- From the moment the system gets power, it will keep track of 24hr periods. After one day most data should be present.
- How is the average calculated?
- It is a running average of 5 previous days. The past 5 days are initialized to a hard-coded value of 10,000 revolutions or 6283m. Wait 5 days for your hamster to generate original data.
- Why is "Lowest:" blank?
- The "Lowest:" field is not updated if the hamster caused a "NEW HIGH". If your hamster keeps improving then "Lowest:" will remain blank. Just wait a few days.
- Are you sure my hamster ran 10km?
- Maybe. My hamster likes to use the side of the wheel like a vertical treadmill. He racks up miles with less energy and can take breaks while the ball bearings do the work. Assuming normal use, the hamster tracker is accurate. Expect your hamster to run between 4-8km a day.
Some notes on hamster safety:
I have included some images above showing my expert climber trying a previous iteration of this project. I had to redesign the base of the wheel to reduce pinch-hazards and nose-bonks. Please watch your hamster closely for the first few days with this wheel. This solutions seems to work for my hamster but maybe not yours. I am not responsible for damage to any furballs.
See Step 4 for comments on electricity and hamsters. Even with the improved design, my expert climber managed to chew through the wire lead coming from the top of the wheel. Very rarely he manages to use the 5.5in bolt as a foot-hold to reach the top of the wheel. As listed in the materials, I recommend a shorter 5in bolt to reduce this risk greatly.
I should explain my choice of birch wood for this project. Cedar is a more common plywood but contains oils that will make your hamster sick. Birch wood is food-safe for humans and hamsters - it is the same material as a popsicle stick. Originally I wanted to use acrylic/plexiglass to construct the wheel to make cleaning easier - and there are a variety of color options. Since this is a prototype I went for the cheaper option; the price point of acrylic is about $5 per square foot compared to birch wood at $2 per square foot.
Step 7: Future of the Project
Thanks for making it this far in the instructable. I appreciate your interest. If you have any feedback for the project or this instructable please leave a comment below.
Some improvement paths to explore in the future are listed below:
- I want to increase the granularity of the data displayed to 10-minute windows. Currently data for 24hr periods are recorded.
- I want to experiment with different display modes (graph, table, chart) that the user can switch between with the push of a button.
- I want to store all data to the SD card already installed on my breadboard. This will allow export to excel on a computer for further analysis.
- Fitness statistics like this can tell you more about your hamsters health over time. This is outside my field of expertise but it is still interesting.
- The wheel design could be made out of different materials and could take on different shapes. See the end of Step 6 for more information.
If you would like to build your own project using the design presented here please do so in accordance to the Licence Terms CC BY-NC-SA 2.5, repeated below:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
- NonCommercial — You may not use the material for commercial purposes.
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
Second Prize in the
Microcontroller Contest 2017