My 4-up board about to be cut apart on the board shears. The adjustable railing for the back edge of the board and a railing along the bottom make it fairly easy to line up boards for repeated identical cuts (which I did not need). The bottom rail was useful for making sure that the cut was square, though.
Yesterday, I went to the basement shop where the support team for the enginineering teaching labs have their offices, and used their board shears to cut my PC board up. The shears are like a souped-up paper cutter. The noise they make when cutting through the PC board is a bit scary, though as it it sounds like you are crushing the board, rather than cutting. It makes a pretty clean cut, despite how it sounds.
HexMotor rev1.3 board with one H-bridge installed.
This morning I woke up early and decided to populate the board. I soldered in the switching power supply (and associated resistors and capacitors) first, and checked that there were no shorts and that it produced the correct output voltage. I then added the digital logic, the sockets for connecting to the Arduino, and the various headers.
It turned out that most of the headers did lock in place nicely with the Sparkfun offset-hole header design, making soldering much easier. A few of my 3-pin headers seem to have slightly smaller posts, and they did not lock in place as nicely. The hardest thing to solder in place were the 0.1″ jumper wires (which are not part of the next design). I may want to leave another 1–2 mm for the resistor, also, as I found it a bit difficult to fit the resistor I had into a 5mm spacing. Perhaps I should go with a 7mm spacing.
I only put in one H-bridge for testing, as I did not want to unsolder H-bridges if the board did not work. If I’d been really careful, I would have waited on the switching regulator as well, since it is not really needed when there are no servos and the Arduino is powered over the USB line.
I spent most of the day writing driver code for the Arduino. I came up with a pretty simple interface (much simpler than the AFMotor library for the Adafruit motor shield—I may want to extend the library to cover that board as well).
There is one global declaration of a HexMotorBoard to explain how the board is configured. As a minimum, you need to specify for each motor whether it is configured for Antiphase, Sign-Magnitude, or On-Off control. I suppose that if you connected the boards with ribbon cables, you could control several HexMotorBoards from a single Arduino Mega board, though with a standard Arduino there’s not much point to having more than one HexMotorBoard, as there are only 6 PWM pins (unless you just need full-on Forward/Backward and brake).
In the setup() procedure, you call the setup() member function of the HexMotorBoard. To control a motor, you just use a single function: motor_name.run(speed). The speed is always in the range -256 to 255, with a speed of 0 meaning brake. The software takes care of translating the speed into appropriate commands for the H-bridge, depending on how the H-bridge is jumpered. (For convenience, I provided an inline function for motor_name.brake() that just expands to motor_name.run(0).)
I couldn’t come up with a much simpler user interface: declare the board, declare each motor, one setup() call for the board, and one function (run) to control each motor. I suppose that I could get rid of the setup() function, since all it currently does is set the appropriate pins to be output pins and that could be folded into the run() function, but I’ll have to think about the value of keeping the HexMotorBoard::setup() function around to provide a place for consistency checks (like whether the configured pins are capable of PWM output).
Because I’m using the standard analogWrite() and digitalWrite() commands, and not fussing with the PWM frequency, very little code is needed to run on any Arduino.
I tested the board with its single H-bridge using a 12v door-lock actuator, and it worked in all three modes (antiphase, sign-magnitude, and on/off). I did notice that the TLE-5206 got quite hot when the actuator was run for a few seconds, so I’m definitely going to need a heat sink. I was planning on using a shared heat sink for the 6 H-bridges, but the electrolytic capacitors get in the way a little. I’ll make sure to leave more clearance for heat sinks in the next revision.
I don’t have much time over the next few days, but on Sunday I hope to bring the board up to 4 or 6 H-bridges and make and hook up the heat sink. Hmm—I don’t have any thermal grease—yet another thing to order.
, board shears
, motor controller
, Printed circuit board