# Gas station without pumps

## 2017 August 28

### More on cheap buck regulators

Filed under: Robotics — gasstationwithoutpumps @ 18:40
Tags: , , ,

A couple of days ago, I wrote about the cheap buck regulators I bought, and expressed some confusion about how poorly they were working.  I’ve spent a couple of days trying to diagnose the problem, and I think it is beginning to make some sense to me.

## 2017 August 25

### Door locks replaced

Filed under: Uncategorized — gasstationwithoutpumps @ 22:19
Tags: , ,

Today was my day for repairing things.  Not only did I fix the oven (see Oven repair headache), but I replaced the deadbolts on the front and back doors, plus the lever set for the back door.

A week or two ago, the deadbolt on the back door started feeling funny—it still functioned, but the key and the thumbturn seemed loose.  I opened it up and noticed that a metal spring had broken—this spring normally sits against flat spots in the shaft, giving the lock its bistable characteristic.  Without the spring the lock easily slid from one end to the other, without clicking into the “open” and “locked” positions.

The brand of deadbolt that we had no longer seems to exist (at least, the only example I found on the web was a used one on eBay), so I decided to upgrade to new Schlage locks.  Because the front and back deadbolts are keyed the same, I needed to replace the front deadbolt at the same time.  My wife also requested that the door knob on the back door be replaced to be the same finish as the new deadbolt on the door.  She wanted satin nickel for the back door and antique brass for the front door.

I ordered the locks from handlesets.com, who had decent pricing.  When the order arrived, I realized that I had made a mistake in the entry of the order, and ordered a satin chrome deadbolt instead of a satin nickel one.  The lever set for the door was satin nickel, and did look better.

So I had to call their customer support to find out how to rectify the mistake.  They needed to know the number stamped on the key, so that they could send me a properly keyed replacement lock, and they sent me email to print a UPS return label, promising to credit my credit card when they got the lock back.  A few days later the replacement lock arrived, properly keyed and in the right finish.

Putting the deadbolts into the doors was fairly straightforward, as the backset and drill sizes he been fairly standardized for a while (the doors on the house are at least 30 years old, and probably more like 50 years old).  The holes in the edge of the door were just a tiny bit tight, so I used a round file to open them up just enough to squeeze in the new deadbolts.

The lever set was a bit more of a problem—putting it into the door was no problem, easier even than the deadbolts, but the strike plate was smaller than the old strike plate on the door jamb.  The bottom screw needed to be in the same place as for the old strike plate, but the top screw would have gone into empty space where the larger old strike plate had had an opening.

To fix the problem I used a razor saw to cut a tiny piece of pine (1″×½”×⅝”) and glued it into the hole with Gorilla wood glue.  I’ll have to wait a day for the glue to dry, then shave a little off the block to make the strike plate fit perfectly.  I’ll probably also prime and paint the bit of wood so that it doesn’t stand out, though the whole door and jamb really need painting.

Filed under: Uncategorized — gasstationwithoutpumps @ 21:46
Tags: , ,

Our gas oven (LG brand model LRG3093SW) stopped working a week or two ago—it wouldn’t light any more.  It had been flakey for a while, but it had finally failed completely.  I suspected that the problem was that the oven igniter had failed, for two reasons:

• It is the most failure-prone part on gas ovens.
• We had had the igniter replaced once before in a similar situation (on the same stove).

I first went through the trouble-shooting instructions in the manual, which are a very short list of things to check (like whether the stove is plugged in and the gas turned on), ending with calling a professional.  Under “Oven Control beeps and displays any F code error”  subpart “You have ‘F11′” (the code it displayed), it suggests checking the oven gas shutoff valve (and cross-references “Surface burners light but oven burner does not”).

I decided to check the oven gas shutoff valve first, before checking the igniter.  The manual shows where the valve is located, but the drawing is so poor that it is not possible to make out what it is supposed to look like.  “PULL TO OPEN” is not very informative.  I ended up looking at oven gas shutoff valves on the web, and realized that the “lever” was a sheet-metal cam that pulled the valve open.  I toggled the lever and made sure I left it with the gas valve open, but this did not restore function.

I then looked at videos online for testing and replacing the igniter.  The videos by RepairClinic are pretty good, even if their parts price is among the highest on the web.

I disassembled the oven (taking off the door, removing the bottom plate of the oven, removing the heat diffuser over the burner) and checked whether the igniter glowed when the oven was set to turn on—it didn’t.  So my next step was to turn off the power to the stove to take out the igniter.

Unfortunately, the outlet for the stove is inaccessible (behind the stove, under the counter), so I needed to turn it off at the breaker box.  The stove outlet is not on the indoor breaker box, so I had to use the breaker in the outdoor box.  That turned out to be more effort than I expected, because the contractor who installed my solar panels 2 years ago had painted the box to match the house.  Unfortunately, he had painted the box shut, and I couldn’t slide the front down to swing it open.  I had to chip out the paint in several places with a knife, then tap the panel with a hammer and a solid screwdriver, before the paint seal was broken.

Having opened the box and figured out which of the unlabeled breakers was the stove, I turned off the stove to test the igniter. (I labeled that breaker when I was done.)  I didn’t bother removing the igniter, just made the wires to it accessible and tested for continuity with an ohmmeter.  The igniter was definitely broken, showing an open circuit.

I cleaned the pieces and put the oven back together (having a little trouble getting the door back on, until I watched the video again and realized that I was missing the step of opening the door completely after re-inserting it).

So I spent a little time on-line looking for a decent price for the igniter.  I found prices from $20 (on eBay for a generic igniter that looked like the one that had just failed) to$125 for ones that claimed to be OEM (original equipment manufacturer). I finally chose to go with a mid-priced option: \$68 from Sears Parts Direct which claimed to be manufacturer-approved (though not necessarily OEM).  I believe we had bought the stove originally at Sears, so it was not too surprising that they stocked parts for it.

The new igniter arrived today, so after supper I decided to replace the broken one.  Because I had recent disassembled the oven, I figured that there would be no trouble—it would be a quick job. Ha!

It did go smoothly at first.  Oven door off, racks out, bottom panel removed, heat diffuser removed, igniter cable detached (and screwdriver inserted to keep connector from falling back into the oven out of reach), first screw holding the igniter removed, and then frustration. No matter how much I turned the second screw (the back one that was harder to reach), it would not come out.  It turned, but did not back out of the hole.  I enlisted my son’s aid—he had no more luck than me. (He did help me find the one screw that I had gotten out—it had wandered half a room away.)

Eventually, I decided to take out the whole burner assembly (it is only held by two easily removed screws), so I could get better access to the screw.  This didn’t help much. Eventually I tried pushing on the tip of the screw, while turning the screw head with a phillips screwdriver bit in a socket-wrench handle.  I got the screw about halfway out when the head broke off.  So I grabbed what was left of the screw with visegrips and managed to unscrew it the rest of the way.

I now had the broken generic igniter off the burner assembly, but I was short one screw for reassembling everything.  The screw needed appears to be a coarsely threaded self-tapping sheet metal screw, probably #8.  I looked through all my boxes, jars, bags, and piles of screws and finally found one that looked like it might work (I’ve no idea what it was left over from).  It wasn’t self tapping, but the threads seemed to be the same size as the remaining screw.

I cleaned out the hole where the stuck screw had been by screwing and unscrewing the self-tapping screw that remained a few times.  After that, my newly found screw worked in the hole with no problems.  I then attached the igniter to the burner assembly, replaced the burner assembly, turned on the power, and checked to see with the new igniter glowed.  It did! and the stove lit!

I turned off the stove, replaced the heat diffuser, the bottom plate, the oven racks, and the door.  There were no problems with the reassembly this time.  I checked the stove once more, and it ignited fine.  I ran the oven at 350°F for about half an hour to drive out any residual fumes from packing materials or whatever—there was some smell, so there probably was something that needed to be burned off.

The repair took me about three times longer than I had expected, and the unremovable screw was pretty frustrating, but I’m pleased now that I got it fixed. And that my outdoor breaker box is now accessible in an emergency.

## 2017 August 23

### Motor testing

Filed under: Data acquisition,Robotics — gasstationwithoutpumps @ 02:20
Tags: , ,

I bought some 6V motors with mounting brackets, wheels, and Hall-effect rotary encoders from Ali Express (https://www.aliexpress.com/item/1-set-2-set-High-torque-Electric-Encoder-Gear-Motor-DC-6V-210RPM-0-13A-Mayitr/32820157282.html), which arrived today, so I spent most of the day playing with them and trying to characterize them.

The first thing to do was to try to relate voltage, current, and speed.  I used the power supply in the Analog Discovery 2 to drive the motor through a resistor, monitoring both the voltage across the motor and the current through the resistor.  I used a Teensy LC board running PteroDAQ to monitor the frequency of the pulses from one of the Hall-effect sensor.  Initially I had tried looking at the pulses with the logic analyzer of the Analog Discovery 2, which gave me a fine short trace from which I could look at individual pulse widths and periods, but not get a long-term average frequency.

Varying the voltage on the motor gave different speeds, and the speed was linear with the voltage.  The current also went up with the voltage, but not linearly (it remained around 40mA even for very low voltages, and only went up to about 67mA at the highest voltages).

The standard simplified model for a motor is an “RLV” model: a resistor, an inductor, and a speed-dependent voltage source (referred to as the back-EMF).  $V(s) = R I + L dI/dt + V_s s$, where the speed is s, and the current is I. With a constant input voltage, the inductor is not really modelable, so I came up with an RV model:

The speed here is represented by the Hall-effect sensor, which gives 11 ticks per turn of the motor shaft. The back-emf is about 7.64 mV/Hz and the resistance is about 4.8Ω.

I needed about 2.5–3V to start the motor, but once it was running I could reduce the voltage to around 0.667V before the motor stopped (the lower speeds in the plot above were done by reducing the voltage with the motor running).

I tried measuring the impedance of the motor with the new impedance tool of Waveforms 2015. I got somewhat different results depending on the frequency used and the test voltage. For ±1V and low frequencies (under 300Hz), I got around 3.5–3.6mH+4.25Ω, but at higher frequencies the inductance dropped and the resistance increased: at 40kHz I had 1.946mH+438.5Ω. With a 5V signal I got 5.1mH+4.88Ω around 20Hz and down to 1.62mH+484Ω at 40kHz. The resistances at low frequencies are fairly consistent with the resistance I inferred from the back-EMF+IR model. So I’m reasonably comfortable in modeling the motor as having
$V(s) = (7.64 mV/Hz) s + 4.8\Omega \,I + 4mH \,dI/dt$.

I may have to tweak that inductance, though, as I’m not sure which frequency’s inductance is relevant.

I also recorded the turn-on transients of the motor. I tried first doing this by turning on the power supplies while the oscilloscope was waiting for a trigger, but the power supplies turn on quite slowly, so I added an nFET to the negative rail and controlled the gate with a pushbutton. The pushbutton connected the gate to a positive voltage and the gate had a large pulldown resistor to ground. The large pulldown resistor eventually turns the FET off when the button is released, but slowly enough that contact bounce does not result in turning the nFET on and off.

The voltage initially spikes up to the supply voltage, then the current increases through the inductor, until the resistive voltage divider controls the voltage. Then the motor starts moving and the back emf increases. The initial spike is very short (about 2ms), but spinning up the motor takes over 200ms.

You can see the enormous commutator signal in the voltage and the current. The current is directly controlled by the commutation—the voltage signal is only affected because of the IR drop across the 10Ω sense resistor I used for sensing the current.

We can use the initial turn-on spike to estimate the inductance, by looking at the exponential curve for the growth of the current:

The current is growing towards 412.5mA with a time constant of 311.76µs.

The inductance is just R times the time constant, where R is the series resistance (the 10Ω sense resistor and the 4.8Ω internal resistance—I’ll ignore the on-resistance of the MOSFET). $L = 311.76 \mu s 14.8\Omega = 4.61 mH$.

All the speed measurements here were in terms of how fast the Hall-effect sensor on the motor shaft was pulsing, but how fast is the output shaft of the gearbox turning? There are two questions: what is the ratio of sensor pulses to motor rotations, and what is the ratio of motor rotations to output shaft rotations?

The website for the motor claimed “Encoder motor end: 11 signals”, which I took to mean that there were 11 pulses per rotation.  I confirmed this by doing a Fourier transform of the commutation signal (the current) and of the pulse signal.  The fundamental of the pulse corresponded to the 11th harmonic of the current, so there were 11 pulses per turn of the motor shaft.

Determining the gear ratio (ratio of motor speed to output shaft speed) was more difficult.  I set up an optical interrupter to be blocked by a bit of electrical tape on the end of the output shaft once per revolution, and recorded the optical signal on every rising edge of the Hall-effect pulse using PteroDAQ.  By recording for a while, I could count the number of Hall-effect pulses for some integer number of shaft rotations.  Taking the pulses/output rotation and dividing by 11 gave me the motor-shaft rotations per output shaft rotation (the gear ratio I was seeking).  Getting a real number for this was fairly straightforward, but I wanted a rational number using products of small integers, corresponding to the gear teeth on the gears!

For one run, I had 856 shaft rotations with 200523 or 200524 pulses (depending whether I counted between rising edges or falling edges of the optical signal), giving me 234.255841121 to 234.257009346 pulses per rotation, or a gear ratio of 21.2959855565 to 21.2960917587.

I did a longer run with 4811 shaft rotations with 1126978 pulses or 1127000 pulses , giving me 234.250259821 to 234.254832675 pulses per rotation or a gear ratio of 21.2954781655 to 21.2958938795.

I converted the gear ratio to a continued fraction using my pocket calculator, getting

$21+\frac{1}{3+\frac{1}{3+\frac{1}{-3+\frac{1}{2+\cdots}}}}$,

which expands to

21 + 1/3 = 21.3333333…

21 + 3/10 =21.3

21 + 8/27 = 21.29630…

21 + 37/125 = 21.296  = 2662/125 = 2 * 11^3 / 5^3

The last ratio factors nicely, and looks feasible for a gear ratio.  To confirm my estimate, I carefully took apart one of the gearboxes and counted the teeth on the gears.  I got

• motor shaft 12T
• engages 22T linked to 10T
• engages 22T linked to 10T
• engages 22T linked to 10T
• engages 24T on output shaft

This gearing does indeed give me the 2 (11/5)^3 gearing I calculated!

So my gear ratio is exactly 21.296 and I have exactly 234.256 pulses per rotation of the output shaft (with the quadrature coding from two Hall effect sensors, I get exactly 937.024 transitions per rotation).

With 6.0364V across the motor, I got 752.37Hz from the sensor, so the output shaft was rotating at 3.212Hz, or 192.7 rpm (somewhat slower than the claimed 210 rpm for 6V no load). The wheels that came with the motors have a circumference of 215mm, so the maximum speed would be 69cm/s, which is about 1.54 mph—not a real zippy machine, but more than fast enough for a small robot.

The tires are pretty squishy, though, and if I want to use the wheel turns to keep track of location, I’ll probably want wheels whose diameter doesn’t vary with the load—perhaps I could wrap the hubs with friction tape. The hub circumference is only 161mm. I could also laser-cut some wheels to get whatever diameter I want.

Next Page »