It all started by watching a my then favourite show on TV. I was experimenting with adding graphics to PCBs on my laptop, whilst watching Sons of Anarchy on TV in the background. That biker influence ended up with the design for the MotoZero!
I decided I’d make myself a cool looking motor board using some easy to use through-hole motor controller chips.
It was only initially intended to be a personal project (despite a lot of requests to make it) until it caught Jamie’s eye. One hour and two cups of coffee later – we had agreed to partner-up to produce the board!
So what is the MotoZero?
This zero-sized add-on board is my take on a motor controller for the Pi Zero, yet it also fits on other 40-pin Pis as well.
I wanted something that wasn’t necessarily the most advanced controller on the market (because I’ve used some feature-packed boards and found them to be a bit heavy going) but also wanted the ability to control 4 motors.
It had to be a self-solder kit rather than something pre-assembled in a factory, because I think putting kits together is half the fun.
Last but not least, I wanted something that looked good – really good! I wanted black. I wanted engine parts. I wanted symmetry!
Easy To Code
A lot of you will know that programming isn’t my strong point. As a result, It’ll come as no surprise that a key part of my design and part selection was making something that’s really easy to code.
The L293D chips used are super simple to programme. 3 GPIO pins are associated to each motor – 1 acts like a master on/off swith (enable), and the other 2 pins go HIGH/LOW or LOW/HIGH to go forwards or backwards. It’s as simple as that!
Ben Nuttall from the Raspberry Pi Foundation is also working on adding the board to the super simple GPIO Zero library as well – https://github.com/RPi-Distro/python-gpiozero/issues/366.
Here’s an example of a single motor going forwards for 3 seconds with standard GPIO usage:
# Import GPIO import RPi.GPIO as GPIO # Import sleep from time import sleep # Set the GPIO mode GPIO.setmode(GPIO.BCM) # Define GPIO pins Motor1A = 27 Motor1B = 24 Motor1Enable = 5 # Set up defined GPIO pins GPIO.setup(Motor1A,GPIO.OUT) GPIO.setup(Motor1B,GPIO.OUT) GPIO.setup(Motor1Enable,GPIO.OUT) # Turn the motor on GPIO.output(Motor1A,GPIO.HIGH) # GPIO high to send power to the + terminal GPIO.output(Motor1B,GPIO.LOW) # GPIO low to ground the - terminal GPIO.output(Motor1Enable,GPIO.HIGH) # GPIO high to "enable" this motor # Leave the motor on for 3 seconds sleep(3) # Stop the motor by 'turning off' the enable GPIO pin GPIO.output(Motor1Enable,GPIO.LOW) # Always end this script by cleaning the GPIO GPIO.cleanup()
Let’s show you some of the features and design elements I put into this board.
Twin Motor Drivers
I added two L293D motor driver ICs to this board, which simply means you can control 4 motors. I wanted this many motor terminals as my AverageBot robot runs a lot better with motors running at each corner, and independent control is cool too!
Raw Motoring Style
I mentioned before that I was experimenting with PCB graphics when I made this board.
I added some cool piston graphics to the front of the board at angles, that make them look like they’re coming out of the chips. It gives it an awesome engine look that I haven’t see done before.
The font adds to this look with a retro motoring feel to it, finishing the board nicely.
Symmetrical things generally look good right?
I designed the MotoZero to be as symmetrical as possible, minus a couple of parts. Just because this is an electronics kit and we’re all geeks, doesn’t mean we have to be all functional and ‘sensible’ about part layout!
Chunky Terminal Blocks
This was an absolute must for me. I HATE those crappy tiny motor terminals you get with some controller boards. They’re weak, they round off too easily and the plastic bodies twist out of place.
I ordered all different kinds of terminal blocks to find the right ones, and I’m really happy with these. The screw is a chunky flat head that grips a screwdriver well, and the motor terminals are positioned so that you can slide them together to stop twisting.
I’ve added sockets to the kit rather than opting to solder the motor chips directly to the PCB. Whilst it’s unlikely to happen (if you follow the guide), if you manage to kill a chip you can simply source a replacement and swap them out. It also avoids cooking the chips when soldering.
This is another reason I prefer through-hole kits like this.
Yes it’s another Pi Zero sized board! These things are very ‘in’ right now aren’t they? I love the Pi Zero. It’s cheap, small, cheap and cheap. It’s also very cheap.
For robotics you can’t beat it with its tiny size and low power usage, so of course, the MotoZero is sized for the Pi Zero. You can still use it on other 40-pin Pis, but it’ll look best on the tiny Pi.
Nothing is ever perfect, and if it was, it wouldn’t be at the cheaper end of a market…
Reverse Current Protection
I didn’t add any reverse current protection, which in English means, if you wire the motor power the wrong way round, you might break it (or your Pi).
My view on that is this: if you manage to wire power cables backwards despite the user guide, warnings and visible indicators, should you really be tinkering with electronics?
I also wanted to keep this board at the simpler and cheaper end of the market, and therefore keep components to a minimum (yes I do see the irony of this board having 2 motor drivers!).
I only managed to keep the upper HAT mount holes as the space was needed for the terminal blocks.
I find Pi Zero add-ons are much more stable than full size HATs, so there’s not much need for this anyway.
Now I’m of course biased, but I just love this board!
It’s simple, easy to use and looks great. It functions well with those nice chunky terminal blocks, fits on your Pi Zero a treat and will let you control 4 motors independently.
Perhaps one of the most exciting things is the kit form. There’s a good amount of components here, and once you’ve finished soldering there’s a real sense of achievement as you feel the weight of the single soldered unit in your hand.
You know what to do…go grab one from the Pi Hut!
Until next time…