Bipolar Motor Driver Cube

Previously, we saw how the motors connect to the wheels. Now I'll describe how motor power is delivered from the battery.

One of the techniques that I wanted to experiment with in the Afterthought Cake robot is to stack small PCBs in a cube, rather than make one large PCB. It produces a novel appearance that benefits a robot with exposed guts.

Robot PCB cube

Robot PCB cube

The inner motherboard is sandwiched by two outer PCB layers. They are connected using the machine pin headers described in chapter 16 of the second edition of Intermediate Robot Building. Although the headers are shorter than those on Roundabout, the same sockets are used and the same technique for soldering them to a height that matches the standoffs.

Each of the outer printed circuit boards are bipolar transistor motor drivers.

Low voltage high current bipolar motor H bridge

Low-voltage high-current bipolar motor H bridge

Bipolar types of transistors were selected because they are more efficient at delivering energy at low voltages (less than 5 volts) than are field-effect transistors (FETs). Because the escap motors use so little power, even the classic lower-current 3904/3906 transistors would have been satisfactory. Nevertheless, Afterthought Cake was installed with the highest performance Zetex transistors (ZTX1047A/ZTX1147A).

During debugging, I discovered that the motor driver printed circuit board had some wrong labels silkscreened next to the connector pins. The P4 (PNP) and N3 (NPN) transistors had their labels swapped. This resulted in an immediate short circuit when robot’s microcontroller powered up. Fortunately, a resettable fuse (Chapter 6 of Intermediate Robot Building) prevented any damage.

Debugging Stacked PCBs

A source of frustration during debugging was having to disassemble the PCB cube to get access to the microcontroller to reprogram it. Foolishly, to save space, I hadn’t installed an ISP6 pin interface for onboard programming.

The solution was to build an adaptor board to offset the motor driver. This also gave me the opportunity to add loops of bare wire to attach logic probes to aid diagnosis.

Motor driver offset board with test point hook loops for debugging

Motor driver offset board with test point hook loops for debugging

It worked well. The board shifts the top motor driver to a position where it can be held firmly in place with screws, but is still electrically connected to the motherboard. The microcontroller is now exposed for easy removal and reprogramming.

Left motor driver offset to access microcontroller during development

Left motor driver offset to access microcontroller during development

In future stacked PCBs, the microcontroller board will be the outermost board. Or, at the very least, a programming connector will be externally exposed.

Shrink Wrapping Components

This isn’t the first time that I’ve stacked boards. For example, besides the aforementioned Roundabout, the robot No.2 had triple-stacked boards.

Nevertheless, I am always on the lookout for exposed metal from tall components that might short traces on the board above. As protection, StreamHawk uses an insulating pouch made from recycled plastic. A thick plastic sheet at the bottom of each board, held in place by spacers, would be great solution for any stacked PCB project.

For Afterthought Cake, only the tri-color LED looked like a remote possibility of accidental contact. A wide diameter of clear heat-shrink tubing was placed over the inline resistors to provide moderate protection. It didn’t quite work out as well as I had hoped, as the tubing shrank vertically as well, exposing the elbows of the wire leads.

Clear heat shrink tubing protecting RGB color LED

Clear heat shrink tubing protecting RGB color LED. Left to right: bare, unshrunk tubing in place, and after shrinking

Notice that there are three different resistor values on the color LED. This is because red, green, and blue LEDs each have different voltage drops. An appropriate resistance is needed to provide a reasonably equal amount of current to each color, to provide reasonably equal brightness.

Finally, let’s look at the location of the battery.