Gas station without pumps

2017 November 22

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 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).

2017 November 17

Tape sensors

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

One of the requirements of the robot for Mechatronics is that it have optical sensors on the bottom to detect black tape on a white background, for detecting the edges of the field, alignment marks for the Ren-ship target, and other marks on the field that seem to be there just to be a nuisance and make the state-machine design harder.

We were issued a number of TCRT5000L reflective sensors, which consist of an IR emitter and a phototransistor in a plastic package that is optimized for a surface 2mm away.  Although the sensors are designed to snap into PC boards and could probably be snapped into carefully sized holes in MDF, I’ll be mounting them on perfboards, which will be screwed onto the top of the baseplate of my robot, with rectangular holes in the MDF for the sensor to poke through.  They’ll barely poke through (6mm high — 5mm MDF), which means they’ll be about 7mm from the floor.  At that distance, the collector current is about half what it would be at the optimum distance.  The MDF provides some extra shrouding from stray light from the sides, which should help with detection.

I’m planning to turn the IR emitters on only when I need to read the sensors, to save power and to allow synchronous detection of reflectance (looking at the difference in light levels between the IR emitter being on or off).  By keeping the duty cycle below 50%, I can run the IR emitters up to 50mA, though I may not need them to be that bright.

If I switch on 5 IR emitters at once, at 50mA each, I’ll be  using 250mA, which is the limit for what I could get from the Teensy 3.2 3.3V regulator (rated for 250mA, though that’s a thermal limit, so 500mA may be available for low duty cycle) and far exceeds the 100mA limit for Teensy LC or Teensy 3.1 boards.  I will be using a 5V regulator to power the Teensy boards, so I could use the 5V supply to power the IR emitters also.

If I use only 10mA per IR emitter, I only need 50mA total and so could power off of either 3.3V or 5V.

For 50mA at 5V, I’d need a current-limiting resistor of ≥(5V–1.2V)/50mA=76Ω, so an 82Ω resistor for 46–48mA would work.  For 10mA at 5V, I’d need ≥(5V–1.1V)/10mA=390Ω, and for 10mA at 3.3V, I’d need ≥(3.3V–1.1V)/10mA=220Ω.

I have a couple of choices for wiring up the sensors:

There are 3 wires to each sensor board, but only the current output is unique to the board—the IR emitter connections can be shared among all sensors.

Low-side switching only requires an nFET, but the power connection for the IR emitter is limited to 3.3V. High-side switching keeps the 3.3V power line from being routed near the motors, but requires a 5v-powered inverter to get a sufficiently large voltage to shut off the pFET.

The expected current from a white background @7mm is about 400µA for 10mA input or 2mA for 50mA input, assuming VCE is in the active region (above about 0.5V).  If I’m looking for a 1V swing between dark and light, I’ll want about 2.5kΩ for the sense resistor for a 10mA input and 500Ω for a 50mA input.

I did a couple of tests with the TCRT5000L using the low-side switching configuration, with 3.3V and a 220Ω current-limiting resistor.  I was doing the tests in a well-lit room (my breakfast room on a sunny day, but without direct sunlight in the room), so the background light is probably brighter than the robot will ever have to deal with.  I used one of the wheels from the MockRobot to be the target, since I could put a screw through the axle hole to get a more-or-less consistent spacing from the sensor.  I adjusted the nut so that the spacing was about 7mm from the sensor, but the angle was only controlled by eyeballing the levelness of the target, so probably varied by ±10°. I did not have any of the black tape that was used on the fields, so I substituted black electrical tape, which I think may be slightly more reflective.

I initially tried 2.7kΩ as the sense resistor, but after seeing the voltage range for that, I upped it to 5.1kΩ.

With 5.1kΩ, the voltages when illuminated are very different between black and white—a simple digital input would suffice.

The currents can be seen to be about the same, independent of the sense resistor, with the white MDF giving about 10 times current of the black electrical tape. The signal from background illumination is insignificant, though that might not be true if the IR beacon is lighting up the field.

It looks like 10mA (measured as 9.65mA) is more than enough light for the sensors to tell black from white, and that the signal is strong enough that I don’t really need analog input or synchronous sensing for the tape sensors.  If I get really worried about the digital signal in worst-case conditions (like too large a distance), I could increase the size of the sense resistor further.  With a 22kΩ sense resistor, I get a very clean separation between white and black even at 1cm.

I have to decide whether to pulse the IR emitters and wait at least 100µs before reading all the sensors, or just to leave them on all the time (at a cost of 10mA per tape sensor). If they are on all the time, I could use the 5V supply (with a 390Ω current-limiting resistor instead of a 220Ω one), and not worry about overloading the Teensy regulator. This could also simplify wiring, as the 5V regulator could be on the power board on the first level and the battery wiring would be limited to the first level.

The Teensy 3.1/3.2 digital pins are 5V-tolerant, so I could even connect the phototransistor collectors to 5V and put the multiplexer on the first level using 5V power. I could then put the sense resistors on the tape-sensor boards and have three wires for each board: 5V, GND, and WHITE.  I could use 3-pin male headers and standard Futaba servo cables to do the wiring.

I ordered a set of servo cables through Amazon, but they are not expected to arrive for another 2–6 weeks, so aren’t going to do me much good.)  I can make my own, but I’ve been having trouble lately with intermittent contacts from the crimp-on connectors and have taken to wicking tiny amounts of solder into the crimp, which adds a lot of time to making the cables.

With the multiplexer on the first layer, the only cabling from the tape sensors to higher levels would be 5V, Gnd, 3 select signals, and the (now digital) signal for sensing the tape. The motors are also on the bottom level, and they would additionally need 2 wires for controlling each motor and 2 wires per motor for feedback from the Hall-effect encoders. This makes the total wire bundle from the bottom level up to higher levels be only 14 wires (5V, Gnd, 4 for tape sensors, 2×4 for motors), with none of the wires having high-current switching.  The only high current wires are the 5V and Gnd wires, which may be feeding servo motors on higher levels—I may want a separate power wire from one of the switching regulators for powering servo motors on the higher levels, though.

The Teensy LC is not 5V-tolerant, so if I used that for the main controller board, I would need to communicate a 3.3V power line as well for the phototransistors and the motor encoders.  I think that I’ll simply declare that the main controller needs to be 5V-tolerant for digital inputs.

[Update 2017 Nov 18: I soldered up one of the TCRT5000L circuits, so that I could do a little more testing and make sure that I had a layout that worked.  It turned out that 22kΩ for the sense resistor was too large—at some distances the electrical tape reflected enough light to get above the 1.15V which is the guaranteed max VIL and maybe even enough to get to switch to high. I took out the 22kΩ and used a 10kΩ, and the problem with black reflecting too much light went away, but white still produced a very strong signal. I should be able to detect the white board reliably with just digital inputs out to about 1.4cm, much more than the 0.8cm clearance.

%d bloggers like this: