3. Building the Joystick Controller Circuitry

(article continued from previous page)

One of the problems with using discrete electronics rather a microcontroller is that you end up with a lot of parts and a lot of wiring. Even so, the joystick motor driver circuit isn’t that difficult to implement on a solderless breadboard.

Solderless breadboard wired with a joystick controller circuit and FAN8200 motor driver.

Solderless breadboard wired with a joystick controller circuit and FAN8200 motor driver.

The transistor-based fire button circuit (D1, R1, Q1) is located on the left side of the breadboard. The wire from the joystick fire button would be connected directly below the purple 'F' on the breadboard. The white and brown wires go to the weapon motor.

The diodes for the three groups of directional buttons appear at the bottom-center of the board. The part numbering is somewhat scrambled compared to the full schematic on the previous page. However, they are arranged so that each directional button (R=right, D=down, U=up, L=left) can be connected to a single hole on the breadboard. The other end of each diode in that column connects to the appropriate resistor/transistor.

For example, look at the column with the purple 'R'. The wire from the right direction button on the joystick connects in the hole directly under the letter 'R'. There are two 1N914 small-signal diodes connected to that column with the each diode’s black band located closest to the breadboard (band down). The other end of diode D7 connects to the breadboard column with resistor R3, and the other end of diode D8 connects to the breadboard column with resistor R4.

DB9 Connector for an Atari Joystick

There are two ways to attach an Atari joystick to the solderless breadboard. You can cut off the end of the joystick cord and connect the joystick wires directly to the board. However, this alteration of the joystick makes it unusable on the original game system or computer, and is not as easy to swap out if the joystick breaks.

A better choice is to purchase a DB9 male-pin connector from DigiKey, Mouser Electronics, Jameco, or other electronics suppliers. (Wikipedia says that it is technically a DE-9 connector, but you won’t be able to find the part using that term.) The DB9 connector is exactly the same type used for RS232 computer serial ports.

Test jumpers attach to a right-angle D-sub connector to which an Atari joystick can be attached.

Test jumpers attach to a right-angle D-sub connector to which an Atari joystick can be attached.

The pins on a DB-9 connector won’t snap onto a solderless breadboard. For temporary debugging purposes, you can use alligator clips or test jumpers instead.

Printed Circuit Board (PCB) for an Atari Joystick Motor Driver Circuit

For long-term use, I prefer to solder the circuit to a perforated breadboard or a printed circuit board.

A printed circuit board for a joystick remote-controlled robot.

A printed circuit board for a joystick remote-controlled robot.

My plan was to assemble several joystick controlled robots to have a battle. Therefore, I wanted the quickest way to make several sturdy boards. Rather than hand wiring several point-to-point circuit boards, I ordered some PCBs from a PCB manufacturer. I could fit two boards per sheet, which means I got six robot PCBs (2 x 3) for $59.

I planned on using Lego parts for the robot bodies. To best mount the PCB on the Lego bricks, you need to space your PCB mounting holes in increments of 8 millimeters. Most PCB layout software lets you display metric units.

For a #4-40 clearance screw hole, select the 0.160 inch diameter pad with 0.125 inch diameter hole (1/8 inch). The four holes are positioned at 3.99 mm x 3.58 mm, 43.99 mm x 3.58 mm, 3.99 mm x 59.58, 43.99 mm x 59.58. That means the holes pattern is 40 mm (43.99-3.99) x 56 mm (59.58-3.58). Divide by 8 mm to determine that the compatible Lego brick area is 5 x 7.

On a Lego Technic brick, you can drill the holes in the centers of the studs by hand. The hollow centers help positioning.

Or, you can buy #4 screws with tips that cut into the plastic as the PCB is screwed on.

Repeatedly drilling into the center of a Lego nub by using a magnet on the side of a machining vise on a drill press.

Repeatedly drilling into the center of a Lego nub by using a magnet on the side of a machining vise on a drill press.

The best option, if you have a drill press or milling machine with an x-y table, you can create a setup to drill in the same location for a bunch of Lego bricks:

  1. Place a magnet on the side of a vise to act as the side stop.
  2. Place a 1x5 Lego beam into a vise. (You may need to put another Lego brick underneath to raise it up enough to see the top well.)
  3. Push the Lego beam flush against the back of the vise and flush against the magnet on the side. As long as each subsequent beam is placed in the same position, the holes will be drilled in the same spot for all beams.
  4. Tighten the vise.
  5. Center a #43 drill (assuming you want tapped #4-40 screw holes) over the stud on the end.
  6. Drill the hole. (You can use the backstop on the drill to prevent from drilling too deeply)
  7. Loosen the vise and remove the Lego beam.
  8. Inspect the hole. If you feel the hole is off center, nudge the x-y table in the desired direction. Over time, each hole will be centered better with these adjustments.
  9. Flip the beam around so that the stud on the other end of the 1x5 beam can be drilled.
  10. Repeat this process for each end of the bricks or beams that you need.

The first couple of holes may not be centered as well as you’d like. So, you may want to start with some common Lego bricks that you have extras of. Eventually, you'll get the drill lined up and you can drill the ends of the final bricks in a nicely-centered repeatable manner.

After drilling, tap the holes with a #4-40 tap to create threads for the screws to screw into.

Now, how about building the rest of the robot?