# Gas station without pumps

## 2017 November 18

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

### Checking out the new gearmotors

Filed under: Robotics — gasstationwithoutpumps @ 09:07
Tags: , ,

Last night I did some quick checks of the new 210 rpm and 300rpm motors (one of each).  The new 210rpm motor seems to be substantially the same as the ones that came with the wheels, but the 300rpm motor is indeed faster.  I assumed that the difference in speed would come from a difference in the gear box (same motor but different gear ratio), but instead it seems to come from a different motor on the same gearbox.  The 300rpm motors have a lower DC resistance and so take more current at the same voltage.  That shifts the speed-vs-torque line upward, giving more free-running speed and more stall torque.  The cost, of course, is that they take more current to provide the extra torque.

It may be worthwhile for me to use these beefier motors in my robot, since I can PWM to lower speeds, and the torque-per-amp seems to be about the same for the two motors (assuming that the gearhead efficiency is the same).  One of these days I’ll have to build myself a stand for testing running torque and stall torque on my motors and characterize them properly—but probably not until after mechatronics is done, as the details of the motors are not on the critical path for completion.

## 2017 November 17

### Hardware obtained today

Filed under: Robotics — gasstationwithoutpumps @ 19:56
Tags: , , ,

In addition to working on the circuits for the tape sensors, I went to the hardware store to get some threaded rod for clamping the layers of my robot together.  I found an old pice of 8-32 threaded rod around the house (left over from the days of the robotics club 5–6 years ago), and I realized that ¼” rod was way bigger than I needed, so I’m redesigning around 8-32 threaded rod instead.  I only had 3 feet of the rod, so I went to the hardware store to get more 8-32 threaded rod and some acorn nuts to go on the ends.  While I was there I also got some M10 nuts and E clips, for keeping the ballpoint set screws in place.

It turns out that 8-32 acorn nuts are only 6.5mm high, so there should be enough clearance under the robot for the acorn nuts.  I could probably have used them (or slightly larger 10-24 acorn nuts) as skids rather than the \$6.01 M10 ball-end set screws, but I’ve got the set screws, so I might as well use them.

When I got the rod home, I cut the old one and part of the new one into 11″ pieces with bolt cutters, then ground the ends smooth and slightly rounded with a wet wheel.  I checked the length of each one with acorn nuts on the end, to make sure it was a couple of millimeters short of 11″, so that when mounted on the bot, the tips of the acorn nuts on top should just be at at 11″.  I had to grind a mm or two off of some of the rods to make them the right length—cutting with bolt cutters is not very precise, as it squishes a few mm of the rod, which then gets ground off.

Here are the 8-32 rods with the nuts on them. The hex nuts will sit above the top layer of the robot, clamping the layers together (I may add washers to spread out the force a bit).

You may notice that there are only 7 acorn nuts, not 8.  I bought the right number, but one of them was not threaded all the way to the end, so I’ll have to go back to the hardware store tomorrow to replace it.  While I’m there, I’ll also buy a box of 8-32 hex nuts, because I only had 8 left of my last box of 100, and I’ll need them for the robot, as shown on the rods here.

Here are the set screws with an E clip and a jam nut. I’m thinking of putting an E clip below the MDF and one or two jam nuts above the MDF, but this plan may need adjustment, depending how well the E clip works.

In other hardware news, I got four packages in the mail today:

• a Digikey order with 100mH inductor to make a more sensitive passive track-wire detector (and some smaller shielded inductors, if I want to increase the Q of the amplifier with an LC tank for feedback).
• another pair of gearmotors with encoders, wheels, and motor mounts for \$25.53 with shipping.  These were spares I ordered on Nov 2 from AliExpress, and I didn’t expect them to arrive for a month—two weeks is pretty fast for cheap shipping from China.
• four spare gear motors with encoders, but without wheels or motor mounts, also ordered from Ali Express on Nov 2 for \$8.89 each (2 @210 rpm and 2 @300rpm)  These motors have the same part number (JGA25-370, DC 6V 210RPM) as the ones that came with the wheels, but the label is different, so I need to check—maybe these really are 210 RPM motors. The JGA25-370 number just refers to the shape of the gearmotor, not to gear ratio.  If my robot is too slow, I could try replacing the 210 rpm motors with the 300 rpm ones.
• 10 roller microswitches from Amazon for \$6.99.  These are tiny, low-quality switches, but I think they’ll work ok for the bumper switches.  It turns out that after I ordered these, I found a bag of 5 tiny microswitches (the same form factor, but different levers) at the back of my drawer of switches.  I’m not sure when and where I got the set in my drawer.  I’ll probably try both sets of switches and see which work better with the bumpers.

I also ordered today the multiplexer that I had omitted from my previous Digi-key order and some more of the TCRT5000L reflectance sensors.  My current robot design calls for 5, and I only have 4 in the parts kit for the course.  The usual team of 3 people would have 12, which is an ample supply, but 4 is probably not enough for the robot this year.

I’ve started thinking some more about the bumper design.  Originally, I was going to use stainless-steel wire to make whiskers that turn a rotary microswitch, but the rotary microswitches are expensive and large (particularly compared to the tiny ones I now plan to use).  I could still use whiskers, but I’m now thinking of a rounded bumper sticking out about 2mm from the front of the robot, pushed forward by the two switches, and retained by a couple of screws in slots.  I’ll have to sketch out the design, then laser-cut it to see whether it works.  I’ll probably be ready to laser-cut everything for my first two layers on Tuesday.

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

## 2017 November 16

### Another day fighting SolidWorks

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

I spent another day working on the SolidWorks model for my robot.  I’m getting better at it, but the user interface is still a struggle to deal with.  Here is my model so far:

I’ve got the first layer mostly done, but the second layer is barely started.

On the first layer, I still have to put in small starter holes for screwing down the optical reflection sensors, which I plan to mount on pieces of perfboard. Having the sensors on perfboard will make wiring them easier (I hope), and make them easier to replace if one fails. Also, recessing them into the perfboard should improve their directionality.

I’m planning to clamp the layers of the robot together with ¼” threaded rod—the acorn nuts I’ve put on the ends are just decorative, and there isn’t room underneath for an acorn nut.  My clearance to the ground is just 8mm, which is less that the ⅜” minimum height for an acorn nut.  There is room for one 7/32″-high hex nut or two 5/32″-high thin hex nuts, but that’s it.

[Update 17 Nov 2017: I’m now going to use 8-32 threaded rod, not ¼”, so there will be room on the bottom for the acorn nuts. See Hardware obtained today.]

The view here is mostly from the back, showing the power panel (with a voltmeter/ammeter and a hole for a barrel jack) behind the LiFe battery.  I should remodel the battery to curve the wires up to the jack and to tuck the charging wires back along the battery.

I have to decide on how the AT-M6 ball launcher interacts with the rest of the components—if I use an accelerator wheel  underneath (which I was planning), then there needs to be clearance for the wheel between the first and second layers.  But the tops of the drive wheels look like they’ll interfere with such an accelerator wheel.  I could mount the accelerator wheel in front of the drive wheels, but then I’ll have the track-wire sensor further from the edge—will it be sensitive enough? I guess I’ll to make the sensor and test it. I should also prototype the accelerator-wheel design, to make sure that it will throw ping-pong balls.  I still have a few inches of uncollapsed 1-½” PVC pipe that I could use for making (or at least prototyping a launcher.

The track wires will be running a current of 180mA—the design used in the targets is a 12V power-supply with a 1.2V drop from using a darlington transistor (why not an nFET?), and two 120Ω 1W current-limiting resistors in parallel.  The typical VCE for the TIP122 darlington at 180mA is more like 0.75V, so the current is going to be more like 188mA.

To imitate that with my track-wire that has 2 47-ohm resistors in parallel, I’d need a voltage of 4.4V.  The power dissipation would be $(4.4V)^2/(23.5Ω) (0.5) = 412mW$, which is just below the ½W limit from using two ¼W resistors. Rather than wire up a special circuit (using an LM555, as they did), I’ll just use the Analog Discovery 2 power supply for the 4.4V and the function generator for the pulse train to the gate of an nFET.  It’ll be a little inconvenient, since the function generator, power supply, and oscilloscope leads are so short, but I can make it work with some “extension cables”.

I think that tomorrow I’ll work on sensors, both electronics and programming, and leave the mechanical design for later—I think I’ll make more progress on the more familiar tasks, and I’m so far behind most of the groups that I’m not sure I’ll ever catch up.  I don’t even have a name for my robot!

« Previous PageNext Page »

Blog at WordPress.com.