Joe's Robot Challenge is over!
It was hard work from everyone involved but I think we pulled it off.
The idea was to create a Robot and Raspberry Pi
themed experience that would raise money at the school fete. Joe had been bugging me for more than two years to get involved with the fete. First year he was too young, we had no preparation time, then last year we were dealing with Sarah's leg.
This year we had lots of prep time and brainstormed the idea of a very simple interface to a destructive robot. The user would be required to press a single button to set the direction and then the speed of the robot that would then knock over empty drinks bottles.
I had a cool Raspberry Pi
battery that screws onto the bottom of the Pi, but sadly, it did not have the power to supply the Pi when connected to HDMI. Well, it did but the power warning icon keep appearing. As I had worked with Pis in the early days, where power problems often corrupted SD cards irreparably, I was overly cautious.
WINGONEER Lithium Battery Pack
The robot is from the
CAM JAM kit 3
that was unbelievably cheap at the Raspberry Pi
Birthday sellers market back in 2016, due to no P&P. Consisting of just motors and an interface board, it plugs into the Pi and once powered via AA batteries, it just works. The Cam Jam kits also come with other components like an Ultrasound distance detector, but we have never tried that.
The code is worryingly short. Just tell the Pi you are using specific GPIO pins and set two pin states for each wheel. GO and FORWARD/BACKWARDS, that's it! For steering/directions it is all about how long each wheel does what.
I already had the cool looking button
The last piece of the puzzle was the graphics/interface. I had done some work with PyGame before so we went with that. We just setup the button polling code to run during frame redraws.
It took a while to put it all together and I am not sure it is very "good", but on the day it worked enough that everyone trying it had fun and we raised a load of money!
I did want to have Joe's photo in the game but I could not see a way to do it that did not kill the frame rate, so it only appeared on the start screen.
The juggling balls made an ideal stand to hold the robot steady when testing the motors ;) We originally used a standard Raspberry Pi
Model B+ v1.2, but swapped for a quad core Pi 3 for improved development experience.
The biggest problem on the day was the wind knocking over the up turned water bottles. The fix was to tape sweets into the necks to lower the center of gravity.
All the code is on GitHub.