By turns: tinker, engineer, husband, author, amateur raconteur, recumbent cyclist, father, ham radio geek. So many projects, so little time!
When you come upon a scene like this, you know someone’s having a Bad Day:
I rode slowly past a line of stopped cars, became a pedestrian, walked through the lawns on the left, then turned back into a bicyclist.
It appeared to be a three-car collision, with two vehicles aligned almost perfectly nose-to-nose in the northbound lane:
The red 2015-ish Forester apparently snagged a rear wheel on the far side of another contestant:
Talk about heart-stopping: Mary had driven off to a meeting some hours before. Even though the wrecked Forester differed in enough details to make me absolutely certain it wasn’t ours , Mary got a firmer-than-usual hug when she got home.
A picture not shown: two expressionless officers supervising a guy having great difficulty walking the fog line.
I’ll never know the rest of the story, but the overall outline seems clear.
Posted in Electronics Workbench on 2018-10-20
Capacitors as charge-storage devices with An introduction to Function Generators & Oscilloscopes
Things to remember
- The green one over on the left is the 1 farad cap my EE prof said I’d never see: “It would be as big as a house”
- The small disk in front of it is a 600 mF (milli, not micro) polyacene “battery” rated at 3.3 V
- Air-variable and wax-dielectric caps = ghosts from the past
- Reverse-biased diodes act as capacitors, due to charge separation
- Silver-mica caps are pretty things to behold
- Voltage rating vs size vs dielectric, a cap charged to 10 kV will get your attention
Warmup exercise: Measure the caps with a variety of meters, noting they do not reach 1 farad. General patter, Q&A, introducing equations as needed.
I will resolutely squash all discussion of capacitors as analog / small signal circuit elements.
- C = εA/d with ε = dielectric permittivity = ε0 × εR
- ε0 = vacuum permittivity = 8.84 × 10-12 F/m
- εR = relative permittivity, air = 1.0006
- dielectrics: wax vs paper vs plastics vs whatever
- ignoring dissipation factor for now
- caution on dielectric absorption
- electrolytic caps vs capacitor plague
- brave / daring / foolish: aluminum foil with chair mat dielectric (εR ≈ 3)
- C = Q/V and (nonlinearly) C = Δq/ΔV
- thus Q = C × V, Δq = C × Δv = Δc × V
- by definition, i = Δq/Δt, so i = C × Δv/Δt
- “displacement current” vs “actual current”
- stored energy = 1/2 × C × V²
- charge 1 F cap to 3.7 V at 20 mA from constant current power supply
- estimate charge time
- plot V vs T
- disconnect power supply, connect white LED, observe light output for the next few hours
Capacitor applications in charge-storage mode
- Constant current → voltage ramp (scope horizontal)
- Large cap = no-corrosion (kinda sorta) small-ish battery
- Change plate d → microphone (need V)
- Trapped charge in dielectric → Electret mic (no V, but need amp)
- Change C (varactor) → parametric low noise amplifier (narrowband)
- C = C1 + C2
- expanded plate area “A”
- capacitor paradox vs reality: never switch paralleled caps!
- 1/C = 1/C1 + 1/C2
- increased separation “d”, sorta kinda
- floating voltage on center plates = Bad Idea
Now for some hands-on lab action
Connect function generator to resistor voltage divider
- calculate total resistance and series current
- calculate expected voltages from current
- show input & output waveforms on scope
- overview of oscilloscope controls / operations
Replace lower R with C, then measure V across cap
- series circuit: fn gen → R → C (C to common)
- scope exponential waveform across C
- not constant current → not linear voltage ramp
- except near start, where it’s pretty close
- e^-t/τ and (1 – exp(-t/τ))
- time constant τ = RC (megohm × microfarad = ohm × farad = second)
- show 3τ = 5% and 5τ < 1%
- integration (for t << τ)
Flip R and C, measure V across resistor
- series circuit: fn gen → C → R (R to common)
- scope exponential waveform across R ∝ current through cap (!)
- same time constant as above
- differentiation (for t << τ)
If time permits, set up a transistor switch
- display voltage across cap
- measure time constants
- calculate actual capacitance
Other topics to explore
- measure 1 F cap time constant, being careful about resistor power
- different function generator waveforms vs RC circuits
- scope triggering
- analog vs digital scope vs frequency
All of which should keep us busy for the better part of a day …
We generally don’t get hassled during our bike rides, perhaps because we ride like narrow vehicles and don’t pull stupid bicyclist tricks. The few folks who do hassle us seem to be twenty-something males, an endangered species of its own.
A shout of “Assholes!”
Unusually, there was no nearby traffic, so it’s not a case of mistaken identity.
Protip: Don’t do something in your employer’s vehicle that your employer may regret.
A shout of “Fuck you!”
Protip: Your car has a license plate. JCX-1393, matching my high-res version against the audio track; I shout the license plate and identifying information while I can see it.
Yes, I was young once … and stupid.
One hopes they outgrow it, too.
Posted in Machine Shop on 2018-10-18
Unlike the keypads on my streaming radio players, this one requires no configuration at all, because bCNC regards it as just another keyboard input. The catch: you must select any screen element other than a text entry field to have bCNC recognize the keystrokes as “not text”.
You would get the same results from the numeric keys on the right side of a full-size / 104-key plank. I’m using a small “tenkeyless” keyboard, which means I can put the keypad wherever it’s easiest to reach while tweaking the MPCNC.
The ÷10 and ×10 keys along the top row alter the step size by factors of ten, which is pretty much what you need: jog to within a big step of the target, drop to the next lower decade, jog a few more times, maybe drop another decade, jog once, and you’re as close as you need to be with an MPCNC. The -1 and +1 keys aren’t as useful, at least to me: changing from 5 mm to 4 mm or 6 mm doesn’t make much difference.
GRBL and bCNC don’t do smooth jogging and the discrete steps aren’t as nifty as the Joggy Thing with LinuxCNC, but it gets the job done.
Whiteboards from the SqWr Electronics Session 5, covering transistors as switches …
Reviewing I vs V plots, starting with a resistor and then a transistor as a current amplifier:
Reminder of why you can’t run a transistor at its maximum voltage and current at the same time:
A resistor load line, with power calculation at the switch on and off coordinates:
Detail of the power calculations, along with a diagram of the current and voltage when you actually switch the poor thing:
Oversimplification: most of the power happens in the middle, but as long as the switching frequency isn’t too high, it’s all good.
Schematic of the simplest possible switched LED circuit, along with a familiar mechanical switch equivalent:
We started with the “mechanical switch” to verify the connections:
Building the circuitry wasn’t too difficult, but covering the function generator and oscilloscope hookup took far more time than I expected.
My old analog Tek 2215 scope was a crowd-pleaser; there’s something visceral about watching a live CRT display you just don’t get from the annotated display on an LCD panel.
I’d planned to introduce capacitors, but just the cap show-n-tell went well into overtime. We’ll get into those in Session 6, plus exploring RC circuitry with function generators and oscilloscopes.
The picture also shows a defunct Sandisk Extreme Plus killed by continuous video recording in my Fly6 bike camera. I later replaced the EVO with a video-rated Samsung card which has been running fine ever since, albeit with the occasional crash-and-reformat expected with “action” cameras.
With that as background, a different Samsung EVO card from the same batch has been running the MPCNC’s Raspberry Pi for about a year. Over the course of a few days last week, the RPi went from an occasional stall to a complete lockup, although waiting for minutes to hours would sometimes resolve the problem. As I’ve learned by now, it’s not a software crash, it’s the controller inside the card suffering from write amplification while trying to move data from failing sectors.
f3write to the card shows the problem:
The write speed started out absurdly high as the card’s write cache fills, then slowed to to the flash memory’s ability to absorb data, and eventually ran out of steam during the last few files.
But, as you might not expect,
f3read reported the data was fine:
sudo f3read /mnt/part F3 read 7.0 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. SECTORS ok/corrupted/changed/overwritten Validating file 1.h2w ... 2097152/ 0/ 0/ 0 Validating file 2.h2w ... 2097152/ 0/ 0/ 0 Validating file 3.h2w ... 2097152/ 0/ 0/ 0 Validating file 4.h2w ... 2097152/ 0/ 0/ 0 Validating file 5.h2w ... 2097152/ 0/ 0/ 0 Validating file 6.h2w ... 2097152/ 0/ 0/ 0 Validating file 7.h2w ... 2097152/ 0/ 0/ 0 Validating file 8.h2w ... 2097152/ 0/ 0/ 0 Validating file 9.h2w ... 2097152/ 0/ 0/ 0 Validating file 10.h2w ... 2097152/ 0/ 0/ 0 Validating file 11.h2w ... 2097152/ 0/ 0/ 0 Validating file 12.h2w ... 2097152/ 0/ 0/ 0 Validating file 13.h2w ... 2097152/ 0/ 0/ 0 Validating file 14.h2w ... 2097152/ 0/ 0/ 0 Validating file 15.h2w ... 2097152/ 0/ 0/ 0 Validating file 16.h2w ... 2097152/ 0/ 0/ 0 Validating file 17.h2w ... 2097152/ 0/ 0/ 0 Validating file 18.h2w ... 2097152/ 0/ 0/ 0 Validating file 19.h2w ... 2097152/ 0/ 0/ 0 Validating file 20.h2w ... 2097152/ 0/ 0/ 0 Validating file 21.h2w ... 1322894/ 0/ 0/ 0 Data OK: 20.63 GB (43265934 sectors) Data LOST: 0.00 Byte (0 sectors) Corrupted: 0.00 Byte (0 sectors) Slightly changed: 0.00 Byte (0 sectors) Overwritten: 0.00 Byte (0 sectors) Average reading speed: 43.04 MB/s
Obviously, the card’s read speed isn’t affected by the write problems.
Assuming the actual data & programs on the card were still good, I slurped the partitions:
sudo partimage save /dev/sdf1 mpcnc_boot.gz sudo partimage save /dev/sdf2 mpcnc_partition.gz
And wrote them back:
sudo partimage restmbr mpcnc_boot.gz.000 sudo partimage restore /dev/sdf1 mpcnc_boot.gz.000 sudo partimage restore /dev/sdf2 mpcnc_partition.gz.000
Unshown: a finger fumble requiring MBR restoration.
Having forced the card controller to reallocate all the failed sectors, the card works now fine and runs at full speed again. This won’t last long, but it’ll be interesting to see how it plays out.
While I was at it, I wrote the partitions to a new-ish / unused Samsung EVO Plus card, now tucked under the MPCNC’s monitor in case of emergency.
An old SFF Optiplex with an SSD may be a better fallback.
Although you’ll read cogent advice to Never Talk To Police, somehow I knew this would involve a conversation long before I went around the curve:
And it did:
Evidently, someone just discovered a body floating in a bend of the small creek off to the left.
My helmet camera prompted some attention, although nothing of interest was visible from the road. A few days later, whoever owned the property bulldozed a substantial berm along the far shoulder to prevent random strangers from just driving in and doing whatever. A week or so later, a call from another police agency had me explaining I don’t have video records of the creek or of any activity, suspicious or otherwise.
Another traffic stop concerned a specific vehicle allegedly involved in an attempt to
pick up abduct a girl from a school bus stop: