Ages ago I had my raspberry Pi set up to run headless and wireless, and had built a motor driver based on an H-bridge, all ready for it to become mobile. In fact it did become mobile by canabilising a remote control dalek toy of my son’s, but that didn’t work too well (it didn’t all fit in). A short while ago I saw a video from @museumsinspire of some Pi-based moving robots which inspired me to try again.
Moving robots in the 'Pi Power' session @computermuseum using @Raspberry_Pi and #python pic.twitter.com/UXWjD7Av1X
— Learning Team (@MuseumsInspire) August 13, 2015
@winkleink pointed me to the parts required–just £8 for the bits I didn’t already have, and after a few weeks wait while they ship from China:
No instructions, which I like: it saves all those “why don’t you read the instructions” arguments. After some help from my daughter
Soldering connectors to the motors was a real pain. Also, the chassis came with a 4xAA battery, but it was a bit bulky and I fancied 9v for two motors. However that PP3 doesn’t last long.
The pi and its power pack fit no the top in various configurations, I’m still not sure what works best. In the long run I guess I’ll drill some holes so they can be held more securely (sadly but not surprisingly, none of the existing holes are in the right place).
(The motor controller is in a wee box hidden on the other side of the pi.
I use the GPIO utility that comes with WiringPi for quick tests of the motor driver, to work out which GPIO pin send which wheel forwards or backwards, and also to write short shell scripts such as
#!/bin/bash #go forwards gpio mode 0 out gpio mode 1 out gpio mode 2 out gpio mode 3 out gpio write 1 0 && gpio write 2 0 gpio write 0 1 && gpio write 3 1
to put this little pi bot through its paces
Not a bad start. The battery was running low, it was nippier than that at first. Good enough to build on, I think. Once I’ve worked out where best to put all the parts, and got them fixed a little more securely, there are some other enhancements I would like to make. First, the wheels came with optical encoder discs but no sensors for them, so there is scope for some more precise control of positioning. Secondly there’s a pi camera module on that pi, so some scope for a seeing robot, and it would be nice to add other senses as well.