My chubby tubby hamster does not exercise enough. On average, a hamster runs 2-3 miles a day. Because hamster is nocturnal animal, she usually doesn't run on the wheel until I go asleep. In the day time, she runs occasionally, but because I spend most of my time in school I can't see her daytime activity either. To motivate her to get enough exercise, I want to design a reward mechanism that can automatically offer her treats when he runs over 2 miles a day, without me closely monitoring her activity.
This device should count and indicate how long my hamster runs for a day. When she runs over 2 miles a day, she will receive a treat. A magnet is going to be attached to the outside of the hamster wheel, and when the wheel rotates once, a hall effect sensor will sense it and count once. Using the inner perimeter of the wheel I can calculate how many turns equals to 2 miles.
An LED is also needed for indication of functioning.
When she reached the goal, a servo with food will rotate and drop off food into her bowl. This will help solving the problem because the mechanism will motivate her to run more.
Built rough circuit: a servo, a sensor, and a button. Applied existing codes from reference sources.
Adjusted codes for each part
Removed button
Added codes so that two parts are communicating
Added LED to indicate servo move
Adjusted codes to reset sensing counts
Added button back in
Adjusted codes to use button to manually reset sensing counts
Added RGB LED to indicate counts, and adjusted codes
Adjusted codes
The biggest problem I met was to make the codes work. Every time the codes were realizing some functions but not all of them, so I have to adjust them over and over again. I also struggled to decide if I should let the system automatically reset the counter or should I manually reset it. In one version I used both but that was a mess, so I just decided to manually reset it.
The final prototype uses a hall effect sensor to sense and count the rounds the wheel turns. When the wheel turns 6726 times it's approximately 2 miles. When reached that goal (for indication the prototype will use 20 instead of 6726), the servo will turn and drop food into the cage. Before the sensor sense anything, the LED is blue. When it started to sense, it turns red until it reaches the goal, then it turns green. A button is used to reset the counts, and when reset, the LED is blue again. When servo moves, another LED whill be on to indicate its movement.
Before this project I barely know anything about coding, but during this project I learned a lot from not only class but also from friends and internet. If I would have done it differently I might want to try more different sensors to figure out which one is more suitable for this project. Overall, I'm quite happy about the result of the outcome and I think I've learned a lot of new things. I think I could do better if I had a chance to dig into coding.