Gas station without pumps

2017 November 22

Pololu MAX14870 H-bridge with current limitation

Filed under: Robotics,Uncategorized — gasstationwithoutpumps @ 23:36
Tags: ,

After about an hour of frustration, I finally got a 0.1Ω resistor soldered in place of a cut trace on the Pololu MAX 14870 H-bridge board.  This is supposed to limit the current to 1A, by doing PWM when the current is exceeded.

I then tried seeing how well it would do current limitation, using a 300µH inductor in series with various combinations of power resistors.

When the resistance is large enough that the current is limited to <1A by the power supply voltage, no PWM is done. At lower resistances, current control is done, but the resulting average current is not a constant 1A, but varies with the load.

The current control is a little more aggressive than I expected, with currents as low as 700mA rather than 1A.

With a 5Ω motor, I expect the stall current to be limited to 750–800mA, delivering about 3W to the motor.  A beefier motor with lower resistance would actually get less power (a 2Ω motor would be limited to about 800mA, delivering only 1.3W.  Without the current limits a 9.9V voltage source would deliver 19.6W to a 5Ω load and 49W to a 2Ω load. Of course, the internal resistance of a battery limits the voltage and current it can deliver to a 2Ω load.  The LiFe batteries we are using are only rated for 1.5A at 9.9V, so 14.8W is about as much as we can sustainably get from the battery, and I doubt that we get even that much.

The motors have no trouble starting with the <1A current, but stalling the motors with a heavy load starts the current limitation, and the average voltage stays well below the 6V rating for the motor.  So I think that using the current limitation with the sense resistors on the H-bridges gives enough protection for me to be able to use the 6V motors with the 9.9V battery


First test cuts and progress report

Filed under: Robotics — gasstationwithoutpumps @ 12:27
Tags: , , ,

Yesterday, I again spent most of the day struggling with SolidWorks.  My goal was to model the tape sensor boards, fix the modeling of the threaded rods to be 8-32 instead of ¼”, check the positioning of the tape sensors and ball set screws to make sure there were no conflicts with the M10 nuts for the set screws, and check the modeling of the motor mounts, tape sensor boards, barrel jack and voltmeter, to make sure that the pieces I will cut for the robot will align correctly.

To check the modeling, I laser cut test pieces in MDF.  The test pieces are much smaller than robot layers, so as not to waste MDF on pieces I’ll end up throwing away (I was sure that I would find errors in my modeling).

Here is the first test piece showing the tape sensor mounted with no problems, but the motor mount showing misalignment of the hole pattern. The corner holes are an appropriate size for 8-32 rod.

The tape-sensor board can be mounted with 12mm M3 machine screws, though if I want to double-nut them I’ll want to switch to 14mm M3 screws. For the motor mounts I’ll use 16mm M3 machine screws.

I remodeled the motor mount to have the holes correctly spaced, and even with sloppy hand alignment the holes match well enough for inserting M3 screws.

Besides the screw holes, I wanted to check the sizing for my power panel, which holds a voltmeter/ammeter and a barrel jack that will be the main input for either battery or wall-wart power input (9.9V from LiFe battery, up to 12V from wall wart).

Here is the power panel showing the voltmeter and the barrel jack. This is the second cut for the power panel—the first one had a rectangular hole barely big enough for the voltmeter. The first cut let the voltmeter slide in until it reached the snap-in locks, but then would not fit the rest of the way. I changed the size of the hole without changing the voltmeter model.
The barrel jack is too short for the thickness of the MDF—the nut barely fits on the remaining threads.
Also, the drill hole on the right for a threaded rod is too close to the power panel, not leaving room for a nut. That doesn’t matter on the test piece, but would on the final robot—I have to check the position of the rod holes carefully.

To fix the barrel-jack problem, I used a ½” Forstner bit to cut halfway through the MDF. Note that the press-fit springs on the voltmeter are gripping theMDF (though not very tightly).

After thinning the MDF, the barrel jack protrudes an appropriate amount from the panel.

I won’t have much time to work on the robot tomorrow, as I have family obligations out of town for Thanksgiving.

I checked the schedule for the course and I’m about a week and half behind schedule. Electronics and mechanical prototyping was supposed to be done by 17 Nov, and I’m still working on both. I hope to have the track-wire sensor tested and soldered today, and perhaps a crude prototype of the bumper.

I’m still trying to decide how to power the motors. I’d originally thought to use switching regulators to reduce the 9.9V battery power to 6V and then Pololu MAX14870 H-bridges to do PWM control.  I still like the H-bridges, but the regulators oscillate rather badly under high load (probably because the resistor and capacitor used for controlling the feedback loop are the wrong size for a 6V output, but replacing the surface-mount components would be a pain).

I’m now thinking of running the H-bridges directly from the battery, but using their current-limitation capability to keep from burning out my 6V motors. I’ll have to test to see how well this works.  The current limitation is set by a surface-mount sense resistor, with the max current being 0.1V/R.  I bought 100mΩ and 51mΩ resistors of the right physical size, so I can do a 1A or 2A current limit.   The 2A limit is appropriate for the beefier 300rpm motors I bought (which I have 2 of) and the 1A limit is appropriate for the wimpier, nominally 210rpm motors that I now have 6 of.  Given that the battery is a 1500mAh, 1C battery, I shouldn’t be taking more than 1.5A from it anyway, so the 1A limit on each motor is probably the best choice.  I’ll have to cut the trace on the boards and solder in the tiny 100mΩ resistors, then test the motors with the H-bridge to see whether the current control works.   The internally generated PWM for the current regulation has a fixed off-time around 15µs (7.8–22µs according to the MAX 14870 data sheet), with a variable on-time (minimum 2.5µs), so at 60% duty cycle (the equivalent of running the motor at 6V rather than 9.9V at stall current), the period would be around 26.7kHz (18–51kHz).  There is some risk that this will interfere with the 25kHz track-wire sensor.  Luckily, I don’t expect to be running the current-limitation PWM very often—generally only when starting or reversing the motors for the robot.

By 24 Nov, I’m supposed to have “Working Prototype for moving robot and ball launcher; State Machine”. If I’m lucky I may have the robot layers cut on the laser cutter that day, but I don’t even have clear plans for the ball launchers. It is unlikely that I’ll have a moving robot and state machines implemented by then. If I’m lucky, I’ll have the low-level code for all the sensors and motor control done.

My fall-back position—having a moving platform that does the detection and control but replaces the launchers with just LEDs to indicate when a launch would happen if I had time to design and build launchers—is looking more and more likely.

2017 November 20

Track-wire detector sensitivity

Filed under: Robotics — gasstationwithoutpumps @ 20:52
Tags: ,

I tried out different inductors today, and found that I got the best signals with an RLB1314-103KL 10mH inductor (better than the RLB0812-103KL 10mH inductors that came with the class parts kit).  The difference is mainly in the ferrite core—the RLB1314-103KL is rated for 135mA instead of 34mA, though the DC resistances are not very different (32Ω vs. 39Ω).

Both larger inductors (100mH) and smaller ones (100µH) produced less signal in tuned tanks, and the 100mH inductor needed such small capacitors that it was very sensitive to detuning from parasitic capacitances.  It also picked up a lot of noise when it was not close to the track wire.

With a tuned tank circuit, I got the following signal as a function of distance from a track wire that had 180mA pulses at 25kHz:

The inductor was oriented so that the turns of the coil were parallel to the track wire, with the near edge of the coil at the specified distance from the track wire.

I expect to have the track-wire detector about 10cm from the track wire about 3″ high (centered on the 6″ length of the track wire), which means that I can expect signals to reach a maximum of about ±55mV.  If the robot is 3cm closer, then the signal would increase to ±97mV.

I plan to amplify just the positive excursions, to avoid having to have a virtual ground circuit and to avoid recentering .  So my amplifier should have a gain of around 30 at 25kHz, to get sufficient signal for a good SNR into the ADC without clipping.  That’s a bit too much to ask of a single stage of an op amp with a gain-bandwidth product of only 1MHz, so I’ll do two stages.  The first stage needs to be non-inverting, to avoid loading the tank.

I can increase the Q of the amplifier by using a (shielded) LC tank for one of the feedback elements, though I need to measure the impedance at 25kHz in order to set the gain appropriately.  A 100uH inductor in parallel with a 470nF capacitor peaks at only 655Ω, but a 1mH inductor in parallel with a 39.6nF capacitor (33nF||6.8nF) peaks at 3.07kΩ.  If I try to get a gain of 10 in that stage, I’d need a resistor to ground of about 300Ω.  The second stage could have an adjustable gain of 1 to 6, by using a 10kΩ potentiometer as feedback and a 2kΩ resistor to ground.

Possible schematic for track-wire detector, using a shielded tank circuit in the feedback of the first stage to get more noise rejection.

I’ll have to breadboard and then solder up this detector, leaving L1 not permanently connected until I’ve got locations for the board and the inductor—I’ll probably be putting the inductor near the edge of the robot just below whatever firing mechanism I use for the AT-M6 targets.

2017 November 19

Track wire sensor

Filed under: Robotics — gasstationwithoutpumps @ 22:26
Tags: ,

In Large inductor revisited, I suggested that using a 100mH inductor should produce larger signals than a 10mH inductor, based on my tests with a heavy 370mH inductor.  I got a couple of 100mH inductors  (RLB1014-104KL) on Friday and tried playing with them last night.  The inductors are specified to be 100mH±10% and 300Ω max, but the one I measured appeared to be only 80mH (though the 300Ω seemed accurate enough).  I measured it two ways:

  • Using the Analog Discovery 2 impedance meter with a 0.1% resistor as a reference impedance.
  • By making a tank circuit with a capacitor and fitting a model to the observed magnitude of impedance.

Over the frequency range we are interested in, the inductance was a pretty consistent 80mH.

The tank circuit was also best fit by about 80mH, even when the fitting was started with L=100mH and C=400pF.

I’m wondering whether the lower-than-expected inductance means I was saturating the ferrite core.  I was testing with a ±1V sine wave, which translates to about ±3mA, and the inductor is supposed to saturate at about 40mA, so a 20% reduction in inductance seems a bit much.

As can be seen in the plot of the tank impedance, I tuned the LC resonator pretty close to 25kHz. To my chagrin, this inductor did not seem to work any better at detecting the track wire than a similarly tuned 10mH inductor (which I already had 3 of).  I probably should redo the tests with careful measurements—if the magnetic near-field drops as 1/r2, then small differences in distance matter a lot.

So why did my test with the heavy 370mH inductor seem to work better?  My conjecture now is that the number of turns of wire and the self-inductance are not really the deciding factor in determining how big the signal is. Perhaps the increased resistance of the larger inductor cancels the expected increase in voltage.

Perhaps the shape magnetic field as determined by the shape of the core is most important.  The 10mH and the (nominally) 100mH inductors both have drum cores:

The drum shape is designed to bring the field lines close to each other to reduce radiation from the inductor.  Other core shapes do a better job of this (toroidal cores and cores that encase the inductor), but the drum shape is the cheapest to wind.  But that is the opposite of what I want, as I’m using the inductor to pick up the magnetic field from the 25kHz track wire.  I’m not interested in maximizing the self-inductance of the coil, but the mutual inductance between the coil and the track wire.

I’m now wondering if a longer hand-wound air-core inductor would give me a good signal at a larger distance, since it would not be concentrating the field lines so closely.  There is no way that I’m hand-winding a 100mH inductor (1000s of turns), but a 100µH inductor seems feasible (60–300 turns, depending on the size of the bobbin I wind it on).   I could easily build a resonant circuit with a 100µH inductor and about 400nF of capacitance—I could even get away with only 10µH.  But I still believe that a larger inductor should give me more current at a given distance from the track wire, and I’m not sure that 100µH is going to give me enough mutual inductance.

I do have a 100µH inductor with a similar ferrite core to the 10mH inductor I used, so I could do a test to see whether I get very different signals from the 10mH and the 100µH inductor (each tuned to resonate around 25kHz).

I don’t know whether I’ll bother winding a coil—it would only be for my own learning/amusement, as it would not advance the construction of the robot at all.  In fact it would be fastest just to rebuild the circuit I made for the track-wire detector of Lab 1 (perhaps adding a shielded LC tank for one of the feedback elements to increase the Q).

2017 November 18

Four tape sensors made

Filed under: Robotics — gasstationwithoutpumps @ 15:01
Tags: , ,

I decided to make the tape sensors be as simple as possible, without switching the IR emitter on and off.

The tape-sensor boards have three ports: power, ground, and voltage output. The 220Ω resistor means that about 10mA is used at 3.3V and 18mA at 5V.

I soldered up four copies of this design today (all the TCRT5000L parts I had—I’ve ordered more that should be here early next week).

The three ports are color-coded male header pins on the top of the board. The TCRT5000L is mounted on the reverse side of the board.

I drilled holes for M3 bolts in the corners (the perfboard came with M2 holes) on the corners of  a 0.5″ by 9″ rectangle. M3 may be a bit big, but I only thought of that after drilling one of the boards.  I have both M2 and M3 bolts, and I also have M2 screws, which I’ll be using for fastening servo horns to MSF—I could have used M2 screws for mounting the tape sensors also.

The initial design was a little bit smaller, as I have 22kΩ resistors that are the same size as the 220Ω resistors here, but I had to squeeze in the larger 10kΩ resistor on the first prototype I made when the 22kΩ resistors proved to have too much gain at some distances from black electrical tape, so I ended making the whole thing be longer than necessary.  The boards are about 20mm by 34mm, but I could trim them down if needed to about 14mm by 28mm (and cut off the corners that don’t have mounting holes).

I tested the boards after soldering them, and they all seem to be working.  This design is only good for robots that run very close to the floor—the working distance for sensors as digital sensors is less than about 1.4cm.  (Analog sensors with synchronous sensing could probably go to 5cm or more, using one of the designs in Tape sensors).

Next Page »

Create a free website or blog at

%d bloggers like this: