Yummy PCB

Previously, we saw how large 10 mm LEDs provide headlights and taillights for the robot. Here is the printed circuit board that contains the brains and motor drivers.

Yummy PCB

Yummy PCB

  1. Power switch mounted horizontally to make it easier to reach when the candy tin is opened. That is, the board is screwed onto one side of the candy tin, which makes it difficult to reach controls placed on that side.
  2. Bulk capacitors (47 µF and 0.1 µF) to smooth the power supply
  3. MCP1702-5002 5 V voltage regulator selected for its low-dropout voltage and low power consumption
  4. Test holes and test loops for connecting a multimeter or other test instrument
  5. Atmel AVR Attiny861 20-pin microcontroller running at 8 MHz
  6. Square LED that blinks to show that power is on and the microcontroller is running
  7. Pushbutton that performs various functions depending on the mode selected. Notice the black wire running from the button? I accidently cut the ground trace to that region when depaneling the line-following board. Oops.
  8. 10 kilohms trimpot with thumb knob for selecting the robot’s mode. Digi-Key 3386F-103TLF. Mouser 652-3386F-1-103TLF
  9. Spare holes with ground, +5 V, and a microcontroller pin. These have a female socket soldered underneath that attaches to the headlight and taillight board. Whenever you have a spare pin, always surround it by power and ground holes to make it easy to expand.
  10. Connector to the line-following board
  11. Pair of MOSFET high-amperage motor drivers. This is way overkill for a robot with motors that consume less than 50 milliamps! This board was originally designed to drive a robot with much more powerful motors.
  12. Molex connectors to each motor
  13. Faulhaber right-angled gearmotor

Motor Drivers

I tried to cram too much functionality into the PCB, but still fit it into the maximum dimensions allowed by the PCB manufacturer for a prototype special deal. As a consequence, the eight wires connecting each MOSFET transistor to the microcontroller need to be wired by hand. What a pain.

Supplimental wiring and capacitor on bottom of PCB

Supplimental wiring and capacitor on bottom of PCB

Also noteworthy, soldered underneath the board are pull-down resistors and surface-mount bulk capacitors that supply the battery voltage to the motor driver. Having components on both sides of a board is easy when you’re soldering a board by hand, but is generally frowned upon when having boards manufactured and populated mechanically. The issue is that the bottom parts will fall off when bulk soldering parts to the other side of the board.

Speaking of soldering, I spent hours and hours debugging a serious fault that turned out to be bad soldering. The board would randomly short circuit at startup, and consistently short circuit when trying to drive the motors in certain directions. Thankfully, the board was attached to a power supply that automatically limits current to prevent damage.

Lousy soldering job cost hours of debugging

Lousy soldering job cost hours of debugging

The root cause was a failure to completely solder the output of a MOSFET driver pin. As such, the MOSEFT was not receiving a clear signal to either shut off or turn on. Sometimes the MOSFET would take the value of a nearby pin; sometimes the value would be random. Thus, sometimes both the high and low MOSFETs would be enabled on the same side of the motor driver, resulting in a short circuit across the battery.

Flatten Through-Hole Leads

Originally, the main board was going to sit directly against the motor mounting block. Unfortunately, the soldered leads of the pushbutton prevented the board from sitting flat. So, after soldering, I milled the leads flush (see yellow arrow).

Milling soldered leads flat

Milling soldered leads flat

You need to be very careful if you’re going to do this. The leads need to be well-soldered in the holes themselves, not just on the surface. Also, if you mill too deeply, you’ll disconnect the traces on the surface of the board (most of the pad above the yellow arrow has been accidently cut off). Be cautious with this approach.

It turned out that the robot needed additional room for the battery at the bottom of the candy tin. Nylon standoffs raise the board off of the motor mounting block, negating the need for flush component leads.

Depanelizing Smaller Boards

I mentioned earlier that the size of the board was dictated by the dimensions of the PCB manufacturer's prototype special pricing. To reduce the order cost, the line-following board was built into the main board -- a technique called panelizing. Upon receiving the finished PCBs, I needed to cut out the smaller board. Thus, a special fixture needed to be created to hold the PCB during depanelization.

I began with a nice flat scrap piece of PVC. I drilled screw holes at the same locations as the screw holes in the PCB. I also milled out wider diameters so that the PVC could sit on top of parallel block in the vise. (It wasn’t necessary for this particular exercise, but the PCB is being reused in other projects where this mounting plate may need to sit on parallel blocks during machining.)

Milling depth in number 42 hole so 2 56 screw head sits flush Screw head flush

Milling depth in number 42 hole so 2-56 screw head sits flush

The PCB is then screwed onto the PVC, with plastic standoffs in between to provide room for the tip of the cutting tool. Using a tiny 1 mm end mill, the smaller board is separated from the larger board.

Tiny 1 millimeter end mill separating inner PCB

Tiny 1 millimeter end mill separating inner PCB

Here’s what it looks like after vacuuming the nasty PCB dust.

Small PCB depanelized

Small PCB depanelized

In this particular case, nuts were not necessary on the top of the board to hold it securely, because the board itself had been tapped with thread holes. Let’s take a closer look at the line-following board.