This is the fifth article and video in the series “Build a Real Robot”. Here are links to the previous articles if you are just joining us:
DB1 has lost its top! I have taken the tower off of the robot and are going to focus on the base unit for a while.
If you have been following along since the start of this series you may remember that the base unit is also known as the Navigation section. It moves the robot around and takes care of collision avoidance. It also is responsible for power supply and distribution for the entire robot.
In the previous installments of this series we have focused on the mechanical aspects of the base, getting the frame built and selecting motors and wheels.
Now it’s time to focus on the electronics that will drive those motors and get DB1 moving around. So I have mounted a number of modules onto the acrylic platform at the back of the base and finally peeled off the protective paper to reveal the beautiful black acrylic.
Let’s take a closer look at the modules we will be using.
There will be more electronic components mounted to the base later on, most of these will be either sensors or the electronics to interface with them.
There will also be all of the parts needed to power the robot, the batteries, voltage and buck converters plus the associated wiring and connectors.
Right now we are just going to focus on the modules that mount onto the back panel. They are as follows:
- 2 x Cytron MDC10C motor driver boards
- Arduino Mega 2560 microcontroller
- Custom Power Distribution board
- Custom Motor Controller board
- Raspberry Pi 3B+ microcomputer
That last item, the Raspberry Pi 3B+, has a “question mark” on it for a reason – it may not be microcomputer used in the final design. I will explain that in a few moments.
Mounting the Modules
The modules are arranged on the acrylic in approximately the same layout you see in the above diagram.
They are attached to the acrylic using nylon standoffs, however, they don’t all use the same size of standoff.
The Cytron motor drivers and the Arduino Mega use 3mm thread standoffs, they are 8mm in height (although the height really is not too critical).
The remaining components use 2.5mm standoffs, as their mounting holes are smaller. They are also 8mm high and again, the height is not that important.
Almost all of the standoffs are mounted to the acrylic in threaded holes, I used a 2.5mm and 3mm tap to do this. It makes it a lot easier to install the standoffs and I think it also looks neater.
The exception is for two of the 3mm standoffs used for mounting the Arduino Mega. Two of the mounting holes on the Arduino are positioned right beside the I/O connectors, making it impossible to insert a screw as the screw head is too wide to fit. For these holes, I drilled a wider hole in the acrylic and passed a 3mm screw through it, and then mounted the standoff upside-down.
As the Arduino Mega has an additional four mounting holes this arrangement is still very secure.
If you don’t have small metric taps you can use that arrangement for all of the standoffs and secure them to the boards with a nut instead. Or if you can find the snap-on variety of standoffs in the correct diameter you could use those instead.
Incidentally, the idea of tapping the acrylic came to me from one of my YouTube viewers, I’d like to give my thanks for the suggestion.
Now we will take a look at what function each of the modules will perform once they are hooked up and programmed.
The Cytron MD10C is an h-bridge motor driver that employs MOSFETs to dissipate a lot of current with a very high efficiency. It is rated at up to 10 amperes at 5 to 30 volts.
Despite this high power rating the device does not need a heatsink.
We have used the controller before, in the tutorial on driving large DC gearmotors.
This is a very easy device to use. It is powered by the same supply used for the motors and has inputs for a PWM signal and a direction control.
In the DB1 robot, the use of the Cytron MD10C is pretty obvious, it will drive the two gearmotors that move the robot chassis. It will receive its PWM and Direction signals from the custom Motor Controller board.
Arduino Mega 2560
I have no doubt that you are familiar with this component, this is the “big brother” of the Arduino Uno. You can even use most shields designed for the Uno with the Arduino Mega as the front pins are compatible in layout and, for the most part, in function as well.
The Arduino Mega 2560 has some impressive specifications:
- 54 Digital I/O pins
- 16 Analog Input pins
- 256Kb of FLASH memory
- 8 Kb of RAM
- 4KB of EEPROM
- 4 hardware UART serial ports
- 6 External Interrupt pins
- I2C (TWI) and SPI interfaces
In our application the Arduino Mega will be the main controller for the navigation unit. It will interface with the sensors using either I2C or direct connections. Its 6 external interrupt pins will allow it to instantly respond to events that the robot needs to deal with immediately.
The Arduino Mega wil also command the Motor Controller board, which it will connect to using I2C.
The board will be controlled by the microcomputer, currently a Raspberry Pi 3B +.
Power Distribution Board
The Power Distribution Board is a custom board. As DB1 is a prototype this board is wired on a small (7cm x 9cm) piece of perfboard.
The board itself is quite simple. It consists of connectors for the 12-volt and 5-volt power in. These voltages are passed through fuses and then routed to the appropriate outputs – the 12-volt lines power the Cytron motor drivers and the 5-volt lines power the other modules.
The board also takes the motor outputs from each Cytron motor driver and passed them through another set of fusses to some connectors that mate with the motors.
The fuses are all used for protection against a catastrophic short circuit.
Motor Controller Board
This is the second custom board. Unlike the Power Distribution board, this board will require a lot of explanation, in fact, it will be the subject of its own episode in this series.
The board will use a couple of Arduino Nanos for its horsepower. Each one will control a single motor, providing PWM signals to control its speed, direction bit to control the motor direction and accepting the pulses from the motors rotary encoder.
Each Nano will also act as an I2C slave unit, so the Motor Controller board will have two I2C addresses.
The board is also wired on a perfboard, the same size as the one used for the Power Distribution board. It has connectors for 5-volt power from the Power Distribution board, and for I2C to interface with the Arduino Mega 2560.
The board also has 3-pin connectors to interface with the Cytron motor controllers, and 4-pin connectors to attach to the rotary encoders on the back of the DC gearmotors.
I will be showing you this design in detail in a future episode.
Raspberry Pi 3B+
The final board is another familiar part to most experimenters, the Raspberry Pi 3B+. As of this writing this is the flagship board in the Raspberry Pi family.
You will note that I put a “question mark” over this board on the layout diagram. This is because the Raspberry Pi 3B+, while being a very capable microcomputer, may not be the ideal choice for DB1.
It really depends upon what you want to do with it.
The microcomputer used on the navigation unit is responsible for controlling the Arduino Mega, which in turn interfaces to the sensors and motor controller.
The navigation unit can be operated in two different modes:
- Standalone mode. In this mode the navigation unit, or base, is the entire robot. It does not have any intelligence other than to avoid obstacles.It is guided by either remote control or by using a pre-programmed sequence.
- Intelligent slave mode. In this mode the navigation unit is part of the robot and is guided by the Intelligence Layer. It could also perform all of the functions used in standalone mode if desired. Otherwise, the Intelligence Layer decided where to move the robot. The navigation unit still will intervene if given an impossible command or if an obstacle is detected.
The Raspberry Pi 3B+ would work well in standalone mode, however it might not be the best choice for Intelligent slave mode.
Raspberry Pi Strengths
The Raspberry Pi has a lot of great things going for it. For the price it packs a lot of power. It is also very well supported, being probably the best-known microcomputer on the planet today.
It has both WiFi and Bluetooth, so remote control will be very simple to implement. It can run several different operating systems as well.
It has four USB2 connections and an Ethernet connection. Remember, we are using Ethernet to connect the different layers together.
But for all of its strengths the Raspberry Pi and has a few drawbacks.
Raspberry Pi Weaknesses
One weakness of the Raspberry Pi (any Raspberry PI0 is just a physical one, the way the power is connected. The Raspberry Pi 3B+ uses a micro USB jack for power. This is a nice feature for a development board but for a board used in a permanent design it is a bit of a weakness.
To be fair, there are actually three ways around this:
- Use a Raspberry Pi 3 Compute Module. This is a Raspberry Pi equivalent that is on a small card with a SIMM connector. But this choice involves a carrier board and can get fairly expensive.
- Solder wires to the two pads beneath the micro USB connector. This will work, as long as you don’t mind soldering directly to your board.
- Wire 5-volts directly to the GPIO connector. While this will work it is not recommended, as it bypasses the power protection circuits incorporated on the Raspberry Pi.
Another weakness of the Raspberry Pi design is that it depends upon a microSD card to load its operating system and provide storage. While this is a great development feature it is a weakness in a permanent design, as the card socket can lose its grip on the card after a lot of bumping around.
But another, more important, weakness is its power and memory.
In standalone mode this is not an issue, it has more than enough power and memory to act as a remote control receiver or to execute pre-programmed sequences.
But in Intelligent Slave mode it may not be enough, as in this mode we will be running ROS, the Robot Operating System. And while ROS does indeed run on the Raspberry Pi 3B+ there are other microcontrollers that can perform much better.
Right now I’m going to keep the Raspberry Pi 3B+ in its place, it will certainly suffice during development and it may indeed be powerful enough to do everything I want it to do. But I am also going to evaluate other single board computers to see if I can find a better one.
This is why I left a lot of space beside the Raspberry Pi. Although many single-board computers use the same form factor (and same GPIO pins), there are others that will require a bit more room.
DB1 is a prototype, so changes like this can be expected throughout the design.
Now that we have our modules mounted the next step is to wire them up. And, of course, we need to actually prototype and build the Motor Controller.
We will be doing all of that in the next few articles and videos, so stay tuned!