Neil Lambeth, of Red Robotics has recently released his first motor controller board for the Raspberry Pi. “Oh, not another one!” I hear you cry… Well, hold up there – this is one to pay attention to and it’s not ridiculously expensive, either.
TL;DR – Just buy one if you’re into robotics – it’s fantastic!
Coming in at £30/$38, the RedBoard+ is a HAT-sized controller board and it’s just packed with features:
- It takes a battery input from 7V-24V and has reverse polarity protection.
- It powers the Pi with a steady 5.2V, 3A power supply, meaning it will cope with a Pi 4, if necessary.
- It has a 3.3 Volt 800mA Regulator.
- It can control two sets of DC motors with two H-bridges on-board, capable of handling 6A per channel (12A overall!) This is one beefy controller.
- It has a 4-Channel 5V level shifter for driving Neopixels, DotStars or other 5V electronics.
- It breaks out three channels of an analogue-to-digital converter (one channel is used for battery monitoring)
- It has one RGB LED on-board used for anything you like, but most useful as a battery warning light and/or an IP blinker (both scripts are included on the code repository).
- It can directly drives up to twelve hobby servos (with a separate power input for large ‘robot’ servos).
- It has one user-programmable button which is best used, as supplied, to shutdown or reboot your Pi with different hold-times.
- An actual power switch to route battery power to the Pi and the motors.
- Four I2C channels broken out onto headers.
- Headers for serial communication (RX & TX).
- Several Ground and Power pins.
- A “really useful header” onto which you can plug an optional (but not yet available) OLED screen – this came in really handy, so thanks Neil for including one in my review pack!
Using the board
I have a robot I’ve been working on for ages with four powerful, 12V motors and a wooden chassis. It normally uses another motor controller board, but it makes an ideal test platform for the RedBoard+. Here it is in action (with thanks to the wife for doing the recording!):
I used a 10 x 1.2V rechargeable AA battery pack to power the Pi and the motors together, through the RedBoard+. To start with, the Pi kept rebooting and I wondered why… Panic set in! But it turns out that the batteries I was using were… not very good. Neil had pointed out that this could be the problem right at the beginning, but I spent a good few hours in denial before switching over to some Eneloops/Amazon Basics batteries (after which the problem miraculously went away!) Lesson learned: Always Use Good Batteries. It will also work with LiPo batteries, but I’m not that brave… yet! There’s even a test script in the GitHub repository that monitors battery power, tuned for LiPos.
For reference the offending AA batteries were these ones (EBL batteries which I got through Amazon):
Blummin’ things! Anyway!
All this time to test things out meant that I got to code a script to control the robot, with some help from Neil’s original test scripts and a program I’d written (for that other motor controller) that used Tom Oinn’s approxeng.input library (if you haven’t tried this out and you’re into robotics, give it a go – it’s lovely and is compatible with a lot of different games controllers.
Code and Scripts
The controller comes with a GitHub repository containing a simple-to-use library and various test scripts. These were instrumental in trying out the controller board and diagnosing the battery issue. If you get really stuck, and don’t want to install the software yourself, there’s even an SD card image linked to from the GitHub page. Neil’s really put a lot of thought into the user experience. The code he’s released works with both Python 3 (thank goodness) and Python 2 (shudder).
I’ve yet to put to the test the servo capabilities, but if you look at the bottom of this blog post, you’ll see an example of the board using servos as well as DC motors.
There are a lot of motor controllers out there, some more capable than others. If you want a controller board that does more than “just run a couple of motors”, I thoroughly recommend the RedBoard+. It’s good on price, fantastic on functionality and just oozes usefulness. Use the right batteries though – some just aren’t good enough to reliably run the Pi – stick with Eneloops or Amazon Basics or IKEA rechargeable batteries (which seem to all be the same base unit).
Put it another way: if I had to return this review unit (I don’t), I’d buy one in a heartbeat. When you consider the complexity of robotics competitions such as Pi Wars and the need to run more than just two DC motors at low speed, a controller that can handle a wide input range, can deliver high ampage to the motors and can also handle servos (including high-power servos) at the same time, RedBoard+ is what you need.
You can buy a RedBoard+ from Tindie.
I’ll leave you with this demo video, shot by Neil himself. It shows all the functionality being used!