2011 October 25

HexMotor 2.3 and pressure-sensor boards

Top view of my second PC board. 3 copies of HexMotor 2.3 and 2 copies each of 3 different breakout boards for a pressure sensor.

I got the boards back from 4pcb.com about a week ago.

The HexMotor rev2.3 boards have several new features: LEDs for +5v and +6.25v, a reset button, 16-bit shift register instead of 8-bit, servo outputs connected to pins 13, 7, 2, 9, 10 (rather than to the pins used for PWM).  The new board should be able to do either 6 PWM motors or 4 PWM motors, 5 servos, and 2 non-modulated reversible motors.  I was going to have the robotics club solder the board today, but they did not have time.

I made some breakout boards for the MPXHZ6250A pressure sensors from Freescale Semiconductor,  which gave me my first taste of SMD soldering.  At least the design uses gull-wing pins, which can be hand soldered.  The breakout board that I think that the robotics club will end up using puts a pressure sensor on one side and headers for a piggyback ADXL335 breakout board on the back.  that way there only need to be one set of wires for connecting the analog inputs and power to the sensors.

That is the board I soldered a sensor to.

Top view of the breakout board with the sensor and headers soldered in place.

The pressure sensors are tiny! I found it fairly difficult to solder the  sensor to the boards, even holding it with clamping tweezers. I did eventually get everything to stick with no shorts between the 3 signal wires, but I did have some trouble with the unused copper pads delaminating from the board.  For future reference: all pads should have wires going to them (even the unused pads) to have enough surface area for good adherence and so that some of the pad is tucked under the solder mask.

Here are the solder connections on the side where none of the pins are used.

Here are the solder connections for the power and signal pins (and an SMD capacitor).

Despite the rather sloppy soldering, the pressure sensor does work.  It turns out that the port size is just the right size for Lego pneumatics components, so testing was pretty easy.

Sensor attached to Lego pump and gauge for testing.

Here are the results of calibration tests with the (probably not very accurate) Lego gauge, done by my son and me.

Pressure (psi) Arduino analogRead
0 367
5 518
6 542
7 576
8 599
9 632
10 657
11 683
12 710
13 734
14 775
15 801
16 832
17 861
18 887
19 915
20 941
21 967
22 1000

The range is about right, since 22 psi plus one atmosphere is about 250kPa, which is supposed to be the high end of the sensor’s range. Also, 600″ (50′) of water is 21.67 psi, so the range from 367 to 1000 corresponds to about 50′, so the sensor should give the robotics team a resolution of about 1″ for measuring depth, as expected from the spec sheet.

The data are well fit by \mbox{Arduino reading}= 28.57 \mbox{psi} + 371. The club members will have to recalibrate the pressure sensor in water, to get calibration as depth in cm. They’ll probably have to re-zero the sensor every day they use it, to compensate for atmospheric pressure, since it is an absolute pressure gauge.


2011 September 27

4pcb.com sticklers for the $50 multiple-image surcharge

4pcb.com put a hold on my second order from them, asking for an extra $50 (bringing the cost up to $100.30) for the new board, because there were multiple images.

I asked them on the phone what the rule was now for defining multiple images.  Although they did not give an exact algorithm, basically they are looking for separate pieces unconnected by copper traces.  I suspect that they either do a quick look at the board manually or have some very crude program to detect probable repeats.

They are not looking just for exact repeats (which is the rule that Gabriel Elkaim told me they used), but anything that looks like multiple boards. Now I have to decide whether to pay the $50 surcharge, find another vendor, or redesign the board.

For the tiny breakout boards I may be better off with a BatchPCB.com order, at $2.50/sq in + $10 setup. I had 3 (slightly different) copies of the hexmotor 2.3 board, plus 2 each of 3 different breakout board designs for the pressure sensor.

The areas and prices for the boards (not including shipping) are

board dimensions area BatchPCB.com price
pressure 1.3 0.7″ × 1.45″ 1.015 sq in $15.08 for 2
pressure 1.4 1.5″ × 1.0″ 1.5 sq in $17.50 for 2
pressure 1.5 0.475″ × 0.8″ 0.38 sq in $15.00 for 2
hexmotor 2.3 3.95″ × 3.15″ 12.44 sq in $41.11 for 1, $103.32 for 3
combined 7.537″ × 6.737″ 50.78 sq in $136.94 for 1

So if I keep the original order, I’m better off with 4pcb.com pricing, but if I get only 1 motor controller board, I could reduce the price to about $75+shipping (with a new combined board, to avoid the repeated $10 setup).  If I just want the breakout boards, I could do all of them without the hexmotor board as 2 copies of  a combined 1″ × 3.825″ board  for $29.13+shipping.

UPDATE: I decided I want the new features of the hexmotor 2.3 board enough to spend the extra $60 rather than just using the old hexmotor 1.3 board.  When I want tiny boards, though, I’ll try BatchPCB.com, which will be cheaper for boards smaller than about 13 square inches (depending on shipping and how many are ordered).

2011 September 23

New board designed

I’ve just sent a new set of boards for fab.  The HexMotor rev2.3 boards have several new features: LEDs for +5v and +6.25v, a reset button, 16-bit shift register instead of 8-bit, servo outputs connected to pins 13, 7, 2, 9, 10 (rather than to the pins used for PWM).  The new board should be able to do either 6 PWM motors or 4 PWM motors, 5 servos, and 2 non-modulated reversible motors.

I’m also making some breakout boards for the MPXHZ6250A pressure sensors from Freescale Semiconductor, which will require doing some SMD soldering.  At least the design uses gull-wing pins, which can (supposedly) be hand soldered.  One of the breakout boards also has a place for mounting an ADXL335 accelerometer, which may be more difficult to solder.  I don’t think I want to spend the money for a hot-air rework station, and I’m a bit dubious about my ability to solder using a toaster oven.

The pressure sensors are tiny!  My original suggestion to the robotics club was to drill a hole in the dry box and superglue the pressure sensor to the inside of the box (after the pressure sensor had been attached to the breakout board, of course).  Now I’m not so sure that there will be enough glue area to hold firmly enough.  Perhaps a dab of some sealant on the outside of the box might help, if we can keep from plugging the hole in the sensor.

The breakout board that I think that the robotics club will end up using puts a pressure sensor on one side and headers for a piggyback ADXL335 breakout board on the back.  that way there only need to be one set of wires for connecting the analog inputs and power to the sensors.

One limitation of the Arduino for use with this combination of sensors is that the accelerometer is a 3v part and the pressure sensor is a 5v part. We’ll have to set up the analog-to-digital converter on the Arduino to have a 5v range, which reduces the precision of the acceleration readings.

I’ve also bought some other sensors (not for the underwater vehicle, but for physics class and dry robotics): a couple of ultrasonic rangefinders.  More on those in a separate post, after I’ve had a chance to play with them.

2011 August 14

Pressure sensor

I’ve been thinking about what other parts I need to buy for the high-school Robotics Club, so that they can finish their underwater vehicle.

Some I’ve known about for a while, but just haven’t gotten it together to buy the (expensive parts).  For example, they will need several IP-68 connectors for the tether power, for the tether CAT-5 cable (see Long USB cable problem solved), for the motors, and for whatever suite of tools they build for this year’s challenge.  I bought a 4-pin Buccaneer standard connector (made by Bulgin)  for the power tether, and am leaning toward 8-pin mini Buccaneer connectors for the motor and tools.  I’ve still  not decided whether to get another 8-pin mini Buccaneer for the Ethernet connection, or to try using their IP-68 ethernet connector.

One that I only just started thinking about is a pressure sensor for determining depth. The challenges for the past 2 years have involved going to a particular depth, so having a depth gauge is a good idea.

Pressure sensors are classified into 4 types: differential, absolute, gauge, and sealed gauge.  In truth they are all differential, measuring the difference in pressure.  The absolute gauges measure the difference to a vacuum chamber, the gauge-pressure sensors measure the difference to atmospheric pressure, and the sealed gauge sensors measure the difference to a sealed chamber that has a known pressure in it (probably around one atmosphere).

If the club members put the pressure sensor sticking through the wall of the dry box, we could use any of the types of pressure sensor, but absolute or sealed gauge would be best, since we don’t know how much the pressure inside the drybox changes as we submerge it.  The sidewalls will flex, so the pressure will go up, but we don’t know how much.

I spent some time today looking for pressure sensors at DigiKey. It looks like absolute pressure sensors are cheaper and easier to find than sealed-gauge, so we’ll go with them.  There are also price variations depending on whether the sensor has temperature compensation, and on whether the output is a low-voltage differential signal or an amplified one ready for input to a microprocessor A/D input.  I’m pretty sure that we need the simplest interface we can afford, so the ones that don’t need external amplifiers are the best bet.

I also spent some time reviewing how much pressure to expect at different depths, so that I could help the club select the appropriate part.  I found an on-line pressure calculator that can convert depth of water to pressure (in PSI, kPa, or atmospheres).  Each meter of depth adds 9.8 kPa (or 1.42 psi).  In a 20′-deep pool,  they could have up to 59.7 kPa, and in a 12m deep pool (like at NASA) they could have up to 117.6 kPa.  Of course, this is just the water pressure that is added to the atmospheric pressure, so the real range they need to cover is 100 kPa to 220kPa.

It looks like Freescale Semiconductor makes some absolute pressure sensors with a 20–250 kPa range (for example, the MPXH6250AC6T1), which is just about right for us.  They run on 5 v and provide a ratiometric output, that we should be able to read to 10 bits of precision, or about 0.25 kPa, which would be a depth resolution of 1 inch. The accuracy of the pressure sensors is only ±1.5% of 250kPA, which is ±3.75kPa, ±15in, or ±38cm.   They get full points if they are within 50cm, so this is accurate enough for us.  The could calibrate to higher accuracy, by lowering the machine at the side of a pool while looking at a ruler or tape measure along the side of the pool and taking measurements.  So, now that I know what is needed, I can have the robotics club try to solve the design problems.

I think I will have to do one more thing for them, though—the pressure sensor is a surface-mount component, so I think that they will need a breakout board for it.  I’ll design a breakout board that has room for some bypass capacitors and an output filter capacitor.  Although surface-mount, the part has 0.05″ pitch leads sticking out, and so should be hand solderable, though it might be worthwhile to get a heat gun and solder paste to try reflow soldering.

Come to think of it, since the pressure sensor will be glued to the side of the drybox, it might be a good idea to mount the 3-axis accelerometer on the same board.  That would reduce the amount of cabling they need to do.  But the ADXL335 chip has the SMD pads underneath the chip, which can’t be easily hand-soldered.  That brings up the question of whether we try soldering with a heat gun or toaster oven, or pay $12 more for the chip already on a breakout board. (The DigiKey breakout board is the same price and a similar design to the LadyAda  breakout board—both are copying the ridiculously overpriced breakout board from Analog Devices.)

I could play around with a few different designs and stick them on my next PC board run—I want to do a revised version of the HexMotor board anyway, and it won’t cost any more to toss in some sensor boards on the same fab run.

Makers Factory Meetup report

Filed under: Makers' Factory,Printed Circuit Boards — gasstationwithoutpumps @ 18:46
Tags: , , , ,

I went to the  Santa Cruz New Tech Meetup on Friday 12 Aug 2011 to find out more about the Makers Factory that is starting in Santa Cruz in November.  (I blogged about the Makers Factory already.)  Details about the event are on the meetup web page.

At the meetup they confirmed that they will not be getting the sort of expensive shop equipment that places like TechShop (over the hill) have.  The initial setup will be suitable for mechatronics work, similar to what Gabriel Elkaim teaches in the Mechatronics class at UCSC.  Gabriel was the fifth of five speakers at the MeetUp and provided a nice overview of the Mechatronics class.

What the Makers Factory will have are low-cost 3D printing machines (which I suspect will not be useful for much, but are fun toys), a laser cutter, a vinyl cutter, and some electronics equipment (soldering stations and some oscilloscopes, I guess).  They’ll probably also get some board shears.  I think I talked them out of trying to do their own PC board fabrication, in favor of ordering boards from some place like 4pcb.com.  You can probably do a class full of small boards as one $145 order from 4pcb.com (even without a .edu address) and give each person 4 copies of their board.  The 2-week turnaround time is fine for a class. It would probably take longer than that to make your own using low-cost tools in a classroom setting with only a few hours of class time a week, and the quality would be much worse.  I’d also hate to be the one in charge of getting rid of the hazardous waste produced by PC board etching.

I brought my HexMotor board with me to the MeetUp and showed it off to a few people, including Gabriel Elkaim, who was properly polite about it.  He also told me about the new PC boards he had just sent out for fab—they are redoing the electronic cockroaches that are used for the first lab in Mechatronics, since the old ones have started acquiring too much damage.  The problem is that students were much more inventive in discovering ways to damage the boards than originally expected, so the new design has a lot more protection circuitry.

I did get a chance to talk with Chris Yonge, who will be running Makers Factory.  It sounds like he is interested in having me teach an Arduino programming class and PC board design using free tools. I recommended Eagle for PC board design, even though it is not open-source, because it is fairly mature, the free version is enough for classes and hobbyists, it runs on both PCs and Macs, it has an adequate auto-router, and the licensed version is still fairly cheap.

There are open-source projects for PCB design, like FreePCB, which runs only on Windows and has no auto-router, KICAD which runs under Linux and Windows (but not Mac OS X, I believe), and many others.  There is a good list at http://www.olimex.com/pcb/dtools.html.  The general consensus of the hobbyist community seems to be that currently Eagle is most fully featured and robust free PCB editor, and that none of the open-source projects comes close yet.  Since I need Mac OS X software, and most of the open-source software is for Linux, my choices are more restricted still.  I don’t know what sort of computers Makers Factory is planning to get for classes—but they should choose software as much as possible that is platform independent.



2011 August 9

Board fully populated and tested

Top view of the HexMotor rev 1.3 board fully populated.

I got the board fully populated yesterday, plus I made a heat sink out of a piece of ¼” × ¾” aluminum bar stock.  The heat sink makes an enormous difference.  Before using it, running a small motor at low power for 20–30 seconds was enough to make the H-bridge uncomfortably hot.  Now running the same 12v motor stalled at full current (3A) for a full minute raises the temperature only to 100ºF.

The motor got warmer than that, and I think I burned it out, since it no longer runs and has a 400kΩ resistance.  I’m not really surprised—it was a cheap door-lock actuator, and only intended to be used with fraction of a second pulses.  Further testing will require a more robust motor.

As you can see from the photo, the screw terminal for motor 4 (second from the bottom) is a bit crooked—I’ll have to unsolder it and straighten it.  For the HexMotor 2 board, I’ll use slightly smaller holes so alignment is easier.

The thermal grease I used (Cooler Master IceFusion High Performance Thermal Compound 40G RG-ICF-CWR2-GP) was more liquid than I expected, especially since it comes with a little spatula for applying it.  I had to put on a fairly thick layer, because the aluminum extrusion was not very smooth, and when I tightened the bolts the stuff oozed out making a sticky mess. Next time, I’ll sand the aluminum smooth first and use much less thermal grease.

Closeup, showing the excess thermal grease puddling under the H-bridges, where it is very difficult to wipe off.

This closeup photo, in addition to showing the pooled excess thermal grease, shows the header pins with shorting jumpers to configure the H-bridges for either lock antiphase or sign-magnitude control.  (Because of the last-minute change from TLE-5205 to TLE-5206 chips, the silk-screen labeling of the header pins is wrong—this board is actually configured for sign-magnitude throughout not lock antiphase.

The photos also show that I did not leave room for the heat sink between the electrolytic capacitors.  The HexMotor 2.0 board will fix this problem also.

The HexMotor software now can handle 3 different boards: the HexMotor rev 1.3 board shown here, the Adafruit Motor Shield, and the HexMotor rev 2 board, which I am just about done fussing with the design for.  I’ve only tested with an Arduino Duemilanove board, but the software should work with an Arduino Mega as well.

2011 August 5

Board (partially) populated and tested

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.




2011 August 2

Boards arrived

The hexmotor rev 1.3 boards before cutting them apart.

The printed circuit boards for hexmotor rev1.3 came today from 4pcb.com. I ordered the boards on July 21, so the total turnaround time from order to delivery was only 12 days. No wonder the company is so popular for student projects—low prices and fast service will do that!

The boards looked pretty good, so the first thing I did was to check some crucial dimensions:

  • I put headers into the holes for the connection to the Arduino board and checked that it would plug in.  No problem!
  • I checked that I could spread the pins of the TLE-5206-2S chips to fit the holes where they were supposed to plug in.  No problem!  In fact, it was surprisingly easy to get the right spacing, by using the board itself as a tool for bending the pins.
  • I checked that I could put in both the MTR2 TLE-5206-2 chip and capacitor C5 without conflict (as I’d noticed that the silk screen outlines overlapped only after I’d sent in the order).  This also turned out not to be a problem
  • I checked that the mounting holes on the board lined up with those on the Arduino.  Only 2 out of 3 do.  What is going on???I got the hole placement from the Adafruit library for Eagle, and it has 3 holes, but they are not in the same places as the Arduino board.  It turns out that two of the holes correspond to holes on the Arduino board, and two to holes on the Arduino Mega board, which has holes in different locations.  Neither pair corresponds to the holes on the  Adafruit motor shield, which has only 2 diagonally opposite holes, the two holes that are actually in common between the Arduino and the Arduino Mega footprints.  For the next revision of the boards, I have to decide whether to use the 3-hole design of this board, or to go with the pair of diagonally opposite holes.  Or put in 4 holes, so that either Arduino or Arduino Mega can be securely attached with 3 screws. I think that there is room for the fourth hole, if I move one of the electrolytic capacitors.
  • I also did some continuity checks on the power lines.  The power and ground lines connect to the right pins on the TLE-5206-2 footprints, and they aren’t shorted.  The 6.25v and 5v lines also seem fine.
  • I had to make some Eagle library components for the screw terminal blocks I was using, and they seem to be fine, except for two little problems: I put a silkscreen mark for the bump on the side of the 5mm block on the wrong side, and the holes specified by the manufacturer seem a bit too big for the pins.  I’ll specify a smaller drill hole (closer to the spec for the pin size) in the next revision.  Neither of these little problems will interfere with functionality.
  • I checked out the Sparkfun header pattern, with the slightly staggered holes to hold the headers while soldering.  The holes must be a bit bigger than Sparkfun gets from their manufacturer, or my headers smaller, because the headers were not held by the staggered holes.  They fit fine, but the holes are loose enough that they aren’t held.

Tonight, I’ll fix up my Eagle library to have a 4-hole Arduino template and to have a better 5mm screw terminal component.

Here's a 12" board shear that costs $379 from Circuit Specialists.

Tomorrow I’ll go up to campus and see if I can cut the boards apart with the board shears.

I took a look at  printed circuit board shears on the web (you need to include “printed circuit” if you search, or you get book-binding equipment), and they range in price from $125 to $500, depending on size and quality.  I don’t plan to buy one for myself, but it seems like the sort of low-price, special-purpose tool that a place like Makers Factory ought to get.

2011 July 31

More design errors in hexmotor rev1.3

I should have known better than to send the PC board to fab before I wrote the software.  That’s precisely the sort of optimistic thinking I chide my students for.  There are all sorts of design errors that can be uncovered when you work out the details of how to use the hardware.

In my case, the motor functionality of the board all looks ok (so far), but the extra servo functionality is somewhat messed up, because I had not really understood how servos are controlled and how the Arduino servo library uses pins.  I “knew” that servos used pulse width to control position, but I had not bothered to look into the details or think about exactly what that meant—I just assumed that you had to use the PWM pins for the purpose.  Wrong!  If I’d ever actually used a servo with the Arduino, I would have known better.

Servo control is based on the actual on-time of the pulses, not the ratio of on-time to off-time (as is the case for controlling brushed DC motors).  You do have to give up one of the timers used for PWM in order to control the pulse width, but you can provide the pulses on any output pin.  The Arduino Servo documentation clearly says

The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.

So putting servo control on the PWM pins is precisely the wrong choice of pins for maximum flexibility.  The hexmotor rev1.3 board has more or less the capabilities I thought it had (I can do up to 6 servos or up to 6 motors, and I can trade off servos for PWM control of motors, though I always have to give up PWM control of motors 4 and 5 to get any servos).  The initial application of the hexmotor board called for 4 fully PWM-controlled motors and 2 extra controls that could be motors or servos.  We can still do that, though we have a choice of 2 PWM-controlled motors or 2 servos and 2 forward/backward/brake (not PWM control), and can’t mix a servo with a 5th PWM-control motor.

But there is no reason to limit the board the way I did.  With slightly different wiring I could have simultaneously allowed 4 PWM-controlled motors, 2 forward/backward/brake motors, and 5 servos, with the main limitation being the power to the servos (due to the 1.5A limit of the switching regulator).  Three extra servo outputs could be really handy!

I also did not think about making the board compatible with the Arduino Mega board.  The current design does not use the Arduino Mega’s extra pins, which is no big deal, but it also blocks access to those pins, which could be a problem.  Furthermore, I did not look at what pins the Arduino Mega provides PWM on, nor which it gives up for the Servo library.

Incidentally, I was frustrated in looking on the Arduino site for the pin mapping of the Arduino Mega boards—they’d hidden that essential information behind a password (for no discernible reason).  I finally found the Mega pinout info on the forums, where someone frustrated by the inaccessibility of the pin mapping page had re-created it from other documentation.  It turns out that all the digital pins 2 through 13 can be used for PWM on the Mega, so any redesign I do on the board would have at least as much functionality on the Mega as on the standard Arduino.  I will have to be careful to put in conditionals for the pins in the software, though, as some of the pins are mapped from different ports on the Mega.

Redesigning the board to pass through the Arduino Mega pins would be a pain, as the pins take up three sides of the 1.825″×4″ footprint of the Mega board, and the remaining side is where the USB and power connectors are, so through-hole components can’t be mounted there.  I don’t think I can fit in all the TLE-5206-2 chips and screw terminals for the 12v power and motors and stay below the Eagle 8cm×10cm board size limit if I have to put in connectors for all the Arduino Mega pins.

I won’t be able to stack boards above the motor board anyway, as the electrolytic capacitors I’ve designed in to clean up the power are very tall (2cm), as are the TLE-2506-2 chips: particularly if I put on heatsinks.  I’ve bought a strip of 1/8″ thick, 3/4″ wide aluminum bar stock for a heatsink—I plan to drill 6 holes in it to bolt the TLE-5206-2 chips to.  It won’t matter if the bar connects the chips electrically, as they all have a common ground connection anyway.

I think that I’ll populate one rev 1.3 board with only 4 TLE-5206-2 chips, the minimum for the robotics club to be able to experiment with their underwater vehicle, and see how it works before making a new set of boards with full functionality.

So, for rev 2.1 I’m definitely going to change the way that the servo outputs are wired and make sure the software can work with the Arduino Mega boards, but I won’t be trying to connect to the Arduino Mega’s other pins. (Hmmm—I just had an idea for how I could pack everything in, with a massive rearrangement of components.  I might try that as separate branch of the design, to see whether it really is feasible.)

2011 July 26

Time to start doing software

The PC board for the hexmotor H-bridge is ordered and supposedly going to arrive soon, and I’ve ordered all the components from Digi-Key. The total coast of the project is looking like about $180 (including the PC board and shipping) for 2 fully populated boards (not counting an enormous amount of my time). I’ve already started designing a revised board (rev 2.0) that will be designed around the TLE-5206-2 from the beginning, and will have more versatility. I’m thinking that I’ll populate one rev 1.3 board for testing, finalize the rev 2.0 design, and send it out for fab, rather than populating a second rev 1.3 board.

Here is a preview of what my panel of 4 boards should look like.

In addition to the 6 TLE-5206-2 H-bridges, both boards have 74HC594 serial-to-parallel converters for control signals and 74HC86 XOR gates. The serial-to-parallel conversion is similar to that of the Adafruit Industries motor shield (which I have, but which does not have enough current capacity as it uses L293D H-bridges, which only support 0.6A per channel, and I need at least 2.5A per channel).

Copying the choices on the Adafruit board, I made the pin mapping LATCH=Arduino pin 12, DATA=Arduino pin 8, CLOCK=Arduino pin 4. I was wondering at first why they did not use the built-in SPI interface (which would simplify the programming of the serial output), but then realized that the output bit of the SPI interface (MOSI=pin 11) is also OC2A, one of the PWM outputs. Since there are only 6 PWM outputs (one per motor), and the serial interface does not need to be very fast, using software control of other pins is a good idea.

I’ve also brought out all the PWM signals to 3-wire servo connections, so that I can use each PWM signal as either a servo control or a motor speed control. All the connections to the Arduino digital pins are jumpered, so I can reconfigure the board if needed. For example, if I just want forward/backward/brake control of a motor, without speed control, I can rewire the input that would normally be to a PWM bit to be to a different digital pin, and free up that PWM bit for servo control.

On the hexmotor rev 2.0 board I added another 74HC594 chip (in series) so that I have 16 control bits available. Six of them are used for motor control, as on the rev 1.3 board. Another 6 are brought out to header pins adjacent to the speed control pins, so that those pins can be jumpered either to the Arduino PWM pins or to the shift register outputs, allowing 6 motors and 6 servos to be controlled by the board, as long as only 6 continuous values are needed, and the servos don’t exceed the 1.5A capacity of the switching regulator. The remaining 4 of the 16 parallel bits of the rev 2.0 will be brought out to individual header pins, so that they can be used as arbitrary digital outputs. (Also, the hexmotor 2.0 board will have an LED to indicate that 5v power is properly being provided—if the board is used as intended, with the Arduino powered from the switching regulator on the hexmotor board, this tests that all the power connections are made and the Arduino board plugged in.

I will have to start writing software for the hexmotor board soon. I’ll probably base some of the software on the Adafruit AFMotor package, to make it easier for the robotics club to switch between the Adafruit motor shield and the hexmotor board, but there will be some important differences. Since the hexmotor board has several jumpers that can customize it, but no way for the Arduino to read that configuration, I need an easy way to tell the software how the board is configured. I want software that will work with either revision of the hexmotor board. Since the rev 2.0 board has more possibilities for configuration than the rev 1.3 board (thanks to the 8 extra output bits), I’ll design the software for that, making sure that the rev 1.3 board is covered as a special case.

I’m going to have to dive into both the ATMega328 data sheet and the Arduino code to find out how to get access to all 6 PWM signals.  I already know that the Arduino initialization messes with the PWM frequencies, so the AFMotor.h control for the PWM frequencies doesn’t work.  It may turn out that using OC1A and OC2A (which the Adafruit board does not use, but which I use for motors 4 and 5) interacts in some unpleasant way with other Arduino functions.  I may have to put up with some constraints on PWM frequency, as I want to retain clock and analog input capabilities.

Next Page »

Blog at WordPress.com.