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:

Build a Real Robot – Part 1 – Introduction

Build a Real Robot – Part 2 – Base Design

Build a Real Robot – Part 3 – Selecting Motors

Build a Real Robot – Part 4 – Selecting Wheels

Introduction

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.  

Build a Real Robot Part 5

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.

Base Electronics

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:

DB1 Base Modules

  • 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.  

Modules on Acrylic

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.

Modules on Spacers

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.

Module Functions

Now we will take a look at what function each of the modules will perform once they are hooked up and programmed.

Cytron MD10C

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.

Power Distribution Board

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.

Motor Controller Board

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.

Microcomputer Selection

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.

Conclusion

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!

Build a Real Robot – Part 5 – Base Electronics
Summary
Build a Real Robot - Part 5 - Base Electronics
Article Name
Build a Real Robot - Part 5 - Base Electronics
Description
In part 5 of the Build a Real Robot series I will show you the electronic modules that are installed on the base of the DB1 robot.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:
Subscribe
Notify of

11 Comments
Oldest
Newest
Inline Feedbacks
View all comments
David Farning
5 years ago

Interesting approach. I tend to be a cheapskate and try to stick as much as possible per micro-controller… So much so that it gets confusing.

Will be interested to see what you decide to do regarding the navigation computer. I’ve developed a love/hate relationship with the Raspberry PI. I love the idea and the community… but for some reason in anything that is meant to last longer than a prototype I seem to eat though SD cards.

David Farning
5 years ago

Bill, one question for when you do the motor controller board video. When you do that video, could you explain why you made the decision to use two separate Arduino Nanos, one for each motor? I assume that it has to do with the ability of a single Nano to handle the load. I don’t understand the limits of a single Nano and when to use two. If anyone beside Bill would share their thought that would help. I would be great if us viewers/builders could work together to figure out these types of things by using space this as… Read more »

Mark Day
5 years ago
Reply to  David Farning

I was surprised that the motor control wasn’t being done by the Arduino Mega. It has PWM and digital outputs to drive the Cytron board. Bill pointed out that you only need one of the encoder outputs to determine speed; you only need both if you need to determine direction. Presumably you know the direction because you’re controlling that already. So even an Uno’s (or Nano’s) two interrupt inputs would be enough to track the speed of two motors. A Mega’s 6 interrupt inputs would be plenty. In one of his videos, he talked about using higher frequency PWM for… Read more »

David Farning
5 years ago
Reply to  Mark Day

Mark,
Thanks for your thoughts. This series is really working out well for me so far.

I spend most of the week designing and thinking about the next steps in robot build. Then when Bill releases an episode I build along with him. Hopefully, by following this approach I can can learn about the general design considerations that go into a robot… while using Bill’s design and schedule to help keep me grounded on and schedule.

Warren
5 years ago
Reply to  David Farning

I was wondering the same thing. The Mega should be more than enough to handle that and much more. I’m curious what he has to say about it in the upcoming video on that.

Daniel
5 years ago

Hello, This robot looks promising. I was wondering if you will explain the power distribution board (size of male pins for the motors, size and kind of fuse, where to get those fuse boxes, the usb on little pcb is that a mini-micro because I can’t find this little module, as well as how it is all connected under) as well as the connections under the motor controller board. Thank you

Doug Durdin
5 years ago

Hi Bill. Where did you get the 4 gold connectors for the motor connections on the power distribution board?
I am really enjoying this series. I have a Raspberry Pi B+ but I ordered a Jetson Nano to try out as well. I think that for this project the RPI might be problematic. I would like to do face recognition with the camera and maybe voice recognotion as well. Maybe even try out Tensor Flow. Thanks again.

Jack
5 years ago

As a long term robotics and electronics hobby enthusiast I will follow this project with interest. In the past I have always used a PC for brain power and the parallel port and discrete ICs to interface with the motors and sensors and later the USB port and the K8055 interface. However I have been writing code for the Raspberry Pi and the Arduino with the thought of using them in another robot project. I know nothing about the ROS so that will be something new.

Juan
3 years ago

im a newbie at robotics but i have requirements for a robot that has on the order of 25 motors in it. originally i started out with steppers because i need the belt driven linear actuators to go to a specific point. but im seeing steppers are too slow because i need the belt to quickly travel maximum 1000mm at the speed of one of those toy race track race cars. probably a little slower but you get the picture. so sounds like i need DC motors but my understanding is that DC is just fast but not precise at… Read more »

ray ratell
3 years ago

you can use a dc motor and a rotary encoder for speed! the encoder would position the dc motor. but at those speeds you will need to ramp up and down at start and end because dc motors have no brakes or positoning! a small size servo has alot of speed maybe try that or a big one with big pulley! large size pulley will travel fast and not need a lot of rotational speeds and still have braking power to hold position.

ray ratell
3 years ago

i have a question about mosfets and amps for 12 to 17 volts i want to use a hall sensor rotary encoder that puts out 0-5 volts at 0-90degree rotation to opperate a mosfet 0-5volts to give me 0 to 12 to 17 volts and stay inside of 90 degrees rotation! i think the auduino can adjust movement to go from 0 to maximum output. but i may only need 70 degrees of movement. or 65 degrees, is there a way to adjust the pwm/hall sensor range of motion?