This simple project that is a simple fitness tracker for hamsters. The idea came up together with my kids, who recently got one hamster each, and we discussed how far they run each night.
Overall buildThe hamster wheel I used is made out of metal, and therefore I made it simple for myself, and selected a inductive proximity sensor, they cost 10$ in an electronics store.
I attached the sensor to a piece of wood that I attached with a few nail to the metal frame of the hamster wheel.
As CPU, I used the Trinket Pro 5V/16MHz. But I actually do *NOT* recommend this, as the USB is a faked version and it have created massive problems. I had to use the "FTDI" programming mode This project would run equally well on an Arduino Uno.
The circuit:
- Using built in LED pin 13
- Rotation sensor attached to pin 10
LCD connect as:
- LCD (4) RS pin to digital pin 12
- LCD (6) Enable pin to digital pin 11
- LCD (11) D4 pin to digital pin 5
- LCD (12) D5 pin to digital pin 4
- LCD (13) D6 pin to digital pin 3
- LCD (14) D7 pin to digital pin 1
- LCD (5) R/W pin to ground
- LCD (1) GND pin to ground
- LCD (2) VCC pin to 5V
- LCD (3) VO pin (pin 3) connected wtih a potentiometer for contrast. In the first build I just grounded it for simplicity.
The software is extremely simple, and are right now work-in-progress.
Simple, but at least a start:
If time allows, I plan to add interrupts to detect running (to avoid missing edges), do a little more exact speed measurements, since it has quantization errors, and also potentially move to NodeMCU or Bluetooth to get connectivity. And also use memory to store the data so it is possible to access it and get a more elaborated view.
The buildStarting by attaching the sensor to the hamster wheel, and then solder the VCC/GND to the CPU-board, and then connect the sensor input to PIN 10.
If you want to use LCD, you solder it according to the description above. If you don't want to use an LCD (yet), you can change the define in the firmware, and be able to see what's happening in the serial monitor in Arduino IDE:
#define _LCD 0 // this will use serial port instead (9600)
The LCD is using the parallel reduced bits (DB4-DB7) mode, and pinout is explaine above. The firmware can be found here: https://github.com/petergullberg/hamster-fitness-tracker
Open it in Arduninio IDE, compile it upload it to your CPU. Once the Arduino starts, it will start determine speed (if any), and also calculate the total distance the hamster have been running. Today there is no memory, so when power goes out, the distance is reset.
Next steps will be to mount it inside the hamster cage, and isolate the wiring from the hamster. And also measure how much the hamsters are running.
Comments