Step 1: Tracking the Wheel
The first step was locally tracking the spinning of the hamster wheel.
I used a magnetic door sensor to track the turning of the hamster wheel, not only because it’s very easy, but it also wouldn’t hurt or kill my hamster.
I used this Adafruit tutorial to track when the magnet passed by the sensor.
You can find the code used below and on GitHub.
Step 2: Connecting to ThingSpeak
I used this ThingSpeak tutorial to connect the hamsterwheel to the IoT service.
ThingSpeak was very easy to setup, easy to use and it creates these cool graphs. I highly recommend it!
Step 3: Adding the LCD Screen and Casing
I added the LCD screen to the Raspberry Pi, by following this tutorial by RaspberryPi-Spy.
My screen displays the amount total amount of km run per day, plus the speed in km/h.
To hide all the wiring and display the LCD screen, I lasercut a box.
Step 4: Collect Data and Enjoy!
Let your hamster run, and enjoy all the cool data you collect!
The summary of the data was made using Google Data Studio.
As you can see, it’s not always very accurate, the sensor got stuck a number of times, creating records of +40km a day, but overall it’s pretty neat!
Of course, a bonus picture of Harold the Hamster looking cute!