Raspberry Pi Wifi Robot Car (2016)

Off the bat, I’m not a ‘maker’ but I have an interest in that area, and have for a long time had some Raspberry Pis, an Arduino Uno board and some other random things about the place for various small home projects and general tinkering.

Here then, I’m going back in time a few years to the Summer of 2016, and the Raspberry Pi wifi robot car I built. It’s not that complicated, and largely was done by following a project guide, and getting components from Adafruit.com. I had a Raspberry Pi 2 kicking around and was looking for something to do with it, and something which my kids could do some thinking around and tinkering with, without it being a simple remote control item.

I bought the few bits I needed from Adafruit, which was mainly the motor HAT, metal chassis, motors and a wifi dongle since the Pi2 doesn’t have that onboard.

Prior to this, it’d been a while since I’d done any soldering in anger, so getting the HAT pins all connected and tested with the multimeter was a lot of fun, and in all honesty, they all worked first time. The robot has two batteries - a USB one which fuels the Pi itself - in the photo that’s the large brick looking one, but in use, I have a smaller cylindrical one which works fine. The second battery pack is the black one on top, which holds 4 x AA batteries which power the motors via the HAT.

The trickiest part was getting my cylindrical battery to sit properly on the front, which I initially solved with BluTak, and then with a mount made from some Sugru I’d forgotten about.

There’s a few pictures there to show the build, but what about the usage?

In short it did exactly what I wanted which was a vehicle I could programmatically direct around the house, and this allows me to do just that. The way I use it is to connect from my laptop (or via JuiceSSH from my phone for a bit of fun) over SSH and create basic Python scripts locally on the car’s Pi to tell it how to move.

All of that is down to some configuration, largely via the Pi HAT Python library available on github. You can edit some of the defaults, which determines the speed the motors turn, a certain amount of trim, and torque, within limits, which address variability on what can be a loose build in some ways.

The rest is really telling your robot car how you want it to move, so how long to move forwards, how long to drive one wheel to effectively turn and so on. It was actually when I thought about this stage that it occurred to me that this was some how addressing repressed shame at breaking the BigTrak my parents bought me when I was a kid (sorry about that).

In the couple of years since I’ve built it, I’ve programmed it to ‘draw’ pictures in the street outside when I mounted some chalk to it - not great, but it worked. I’ve also sat and made some scripts with my kids to see how long a script they could do without running it, and how closely it matched to the way they imagined it in their heads. The goal of that thread was to get it to navigate a simple maze.

In the future, especially now as I revisit it, I wanted to add a few bumper sensors, for it to stop when it hits objects and build upon that.

I also note from reviewing the current Adafruit page on this, is that they now recommend using a Bluetooth low energy Feather controller to not only remove the Pi from the equation, but to control it via BlueTooth from your phone. I’m not sure that’s the direction I wanted to take this, but that’s definitely an interesting alternative.