Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.
Category: Science
If you measure something often enough, it becomes science
The whole point of the Hall effect current sensor was to get a reasonably efficient linear LED driver that could control the LED current until the battery voltage matched the LED forward drop. Based on the preliminary firmware, it works pretty well.
With a setpoint of 160 mA, the current stabilizes around 150 mA due to the Arduino’s 0.4% PWM resolution. It steps back and forth between 150 and 190 mA as the loop bumps the PWM by one count; these scope shots came from the lower current passes.
At 8.4 V from the bench supply, the MOSFET sees about 2 V. The top trace is the drain voltage, the bottom is LED current at 50 mA/div:
VIN 8.4 V – VD ILED 50 mA-div
At 7.4 V, close to the nominal voltage during most of the discharge curve, the drain sees about 1 V:
VIN 7.4 V – VD ILED 50 mA-div
And at 6.4 V, even though the drain voltage hits zero, the current remains around 150 mA:
VIN 6.4 V – VD ILED 50 mA-div
Admittedly, down there the loop doesn’t have much in the way of control authority, but I planned to turn the lights out at about that point, anyway.
The driver efficiency is 86% at 7.4 V and it’s pretty nearly 100% at 6.4 V.
Of course, the Hall effect circuitry and Arduino Pro Mini soak up another 40 mA or so, so (assuming a 10% duty cycle) the overall efficiency is down around 70%, but that’s including the debugging LEDs and suchlike, so some tweaking is in order.
We hauled 70 pounds of apples back across the river last month:
Apple Ride – 2013-10-20
If only there were a Spackenkill Road bridge across the Hudson…
We laid the bags out on the garage floor, seeing as how they can’t go into the cold cellar with the root crops (apples give off ethylene gas, which doesn’t mix well with long-storage crops). I dropped a Hobo datalogger into one bag to record the temperatures:
Apples and air temperature
The purple trace comes from a data logger in the attic, which is as close as we have to an outside air temperature record.
Those low air temperatures suggest it’s time to move the remaining apples into the basement, as far from the root cellar as possible, as we have more nights in the teens ahead.
According to Wikipedia, Polylactic acid, a.k.a. PLA “is soluble in chlorinated solvents, hot benzene, tetrahydrofuran, and dioxane” and is not soluble in acetone, alcohol, or water.
Just to see what happens, I dunked a pair of those 3D printed dummy bullets in Shooter’s Choice Gun Solvent (which has since gone obsolete) and Hoppe’s No. 9 Gun Bore Cleaner (which seems to have been reformulated several times), then let them air-dry in those background puddles:
PLA dummy bullets after solvent bath
Nothing much happened: they’re not soft or gummy, haven’t slumped, and seem undaunted.
That’s in contrast to ABS plastic, which isreadily soluble in acetone and the aromatic hydrocarbons commonly found in solvents used around firearms. Apart from that, ABS would be a slightly better choice on mechanical grounds. I’m not sure the difference really matters for most purposes, given the very wide tolerances on 3D printed objects.
VG 1193 mV – ID 50 mA-div – 1 ms PWM filter – overview
The top trace is the gate drive at 200 mV/div, the bottom trace is the LED current at 50 mA/div. Expanding the timebase gives a closer look at the fuzz:
VG 1193 mV – ID 50 mA-div – 1 ms PWM filter
Yup, that’s what deriving an analog voltage from a PWM output looks like. Verily, you’re seeing a 32 kHz PWM passed through a 1 ms = 160 Hz low-pass RC filter; the PWM frequency is 2 decades + 1 octave above the filter, so the 5 Vpp digital signal should be down 46 dB. Squinting at the ripple, it’s maybe 40 mV = -42 dB, which is certainly close enough, all things considered.
The MOSFET controlling the LED current operates in its linear region (the whole point of this exercise!) and acts as a Class A amplifier. The datasheet says the forward transconductance is 21 S at VDS = 5 V and ID = 8 A, which certainly isn’t what we have here (about 1 V and 150 mA); you’d expect a 40 mV ripple to produce 840 mA of sawtooth. Under these conditions, the transconductance seems to be 2.5 S = 100 mA/40 mV.
Anyhow, because the gate drive comes from an Arduino PWM output, it has 0.4% resolution and the voltage steps by a bit under 20 mV per PWM increment. Here’s what increasing the PWM output by one count looks like:
VG 1213 mV – ID 50 mA-div – 1 ms PWM filter – overview
Expanding the timebase:
VG 1213 mV – ID 50 mA-div – 1 ms PWM filter
The gate drive is 20 mV higher and the current is 50 mA higher, so the transconductance again works out to 2.5 S.
Note bene: The smallest gate voltage increment produces 50 mA more LED current. It works the same way in the other direction, too, putting a lower limit on the allowable LED current: when the ripple becomes larger than the nominal current, what’s the point?
So, not surprisingly, precise LED current control isn’t possible with an Arduino’s PWM output, at least under these conditions. Using 16 bit PWM would increase the resolution (by a factor of 256), but the PWM ripple means the LED current varies by nearly 2/3 of the setpoint: 100 mApp for a 160 mA nominal LED current.
You could apply a more drastic low-pass filter, but remember that the whole point is to blink the LEDs, not gradually turn them on and off. Eyeballometrically, the LED current risetime = 7 ms, which is very roughly what you’d expect from the 1 ms filter time constant: 5 τ = 99.3%. Doubling the filter time constant wouldn’t be a step in the right direction…
To do this right, you need a real DAC with maybe 10 or 12 bit output (and careful attention to analog layout), which would be absurd in a circuit with an Arduino Pro Mini jammed on top.
Given that it’s just blinking LEDs, none of this really matters: the LEDs are shatteringly bright and blink most satisfactorily. It’s a keeper, even with all that ripple…
What’s the difference between the winding on this toroid:
Hall effect sensor – toroid CW field
And the winding on this one:
Hall effect sensor – toroid CCW field
Very good!
In the first picture, the top lead goes down the hole. In the second picture, the bottom lead goes down the hole.
Bonus question 1: Why is this important?
The winding’s chirality determines the direction of the magnetic field in the toroid by the right hand rule: grab the wire with your right hand, with your thumb pointed in the direction of (conventional) current flow, then your fingers wrap around the wire in the direction of the induced field.
The Hall effect sensor snuggled in the toroid’s gap produces a bipolar output that depends on both the magnetic field’s direction and intensity, so reversing the field direction changes the phase of the sensor output: an increasing field can either increase or decrease the sensor’s output.
Bonus question 2: For a given sensor orientation, what’s the probability of winding the toroid correctly on the first try?
It’s not practical to reverse the sensor orientation, the leads weren’t quite long enough to swap, and turning the toroid upside-down is effectively the same as swapping the too-short leads.
The size of the solder blob at the end of the top lead tells you everything you need to know about the sequence of the picvtures.
We attended the Walkway Over the Hudson’s Moonwalk event / fundraiser on the night of the Hunter’s Moon, which also happened to be a penumbral eclipse. You can barely see the darkness in the lower right-hand quadrant, down around Tycho Crater:
Penumbral Eclipse of Hunters Moon
That’s a fairly crappy picture by contemporary standards: taken with my Canon SX-230HS, zoomed tight, hand-held, braced atop the Walkway’s railing. Any of the telescopes deployed along the Walkway produced better / sharper / more impressive images. Heck, we’ve been there and brought back moondust, despite being stuck in LEO ever since.
Galileo upended the universe with observations based on images no better than that. What’s your excuse?
Wisely is it written: A poor craftsman blames his tools.
Go read Galileo’s Daughter by Dava Sobel. If you have dry eyes at the end of the last sentence, then I’d say you have what it takes to be the CEO of a really big financial institution.
The HRECOS folks installed a display on the Walkway Over the Hudson that shows current environmental conditions at the river sampling station just north of the bridge:
HRECOS Display with internal condensation
Those two blurry white rectangles are paper charts taped to the inside of the case below the scrolling LED display, so I think they’re discovering what happens when you trap ambient air inside a sealed enclosure without dehumidification. Even if they weren’t opening the case every now and again to change the charts, diurnal pumping would pull outside air past any affordable non-hermetic seal.
That fancy electronics won’t last long under those conditions; I foresee several pounds of silica gel in their future…