Archive for category Electronics Workbench
Ex post facto notes from the third Squidwrench Electronics Workshop.
Exhibit various 50 Ω resistors, including my all-time favorite, a 600 W 3 GHz dummy load:
… down to a 1/8 Ω metal film resistor.
The dummy load’s N connector triggered a regrettable digression into RF, belatedly squelched because I wasn’t prepared to extemporize on AC concepts like reactance which we haven’t covered yet.
Discussion of resistor applications, power handling, power derating with temperature, etc:
Why you generally won’t find 50 Ω load resistors in Raspberry Pi circuits. Cartridge heaters for 3D printers, not aluminum power resistors, although everyone agrees they look great:
Discussion of voltage vs. current sources, why voltage sources want low internal resistances and current sources want high resistances. Bungled discussion of current sources by putting diodes in parallel; they should go in series to show how added voltage doesn’t change current (much!) in sources driven from higher voltages through higher resistances:
Use Siglent SDM3045X DMM in diode test mode to measure forward drop of power / signal / colored LEDs, discuss voltage variation with color / photon energy. Measure 1.000 mA test current for all forward voltages.
Compute series resistor (500 Ω) to convert adjustable power supply (the digital tattoo box, a lesson in itself) into reasonable current source; roughly 10 V → 20 mA. Find suitable resistor (560 Ω) in SqWr
junk box parts assortment, digression into color band reading.
Wire circuit with meters to measure diode current (series!) and voltage (parallel!), measure same hulking power diode (after discovering insulating washers now in full effect) as before in 1 mA steps to 10 mA, then 15 and 20 mA, tabulate & plot results:
Discover warm resistor, compute power at 20 mA, introduce cautionary tales.
Lesson learned about never returning parts to inventory, with 560 Ω resistor appearing in diode drawer. Cautionary tales about having benchtop can of used parts as front-end cache for inventory backing store.
Another intense day of bench work!
When I rewired the guts of the digital tattoo power supply to eliminate the series foot switch, I kept the original wiring polarity, with the black wire to the sleeve and the red wire to the tip:
It’s the same color code I (strongly) recommend in the Squidwrench Electronics Workshops: use any color for the ground / common wire as long as it’s black, then, if you have a red wire, use it for the positive supply. You can use yellow for the higher supply voltage, but stop being clever.
I put suitably colored Powerpoles on the far end of the cable to replace the standard tattoo machine spring clip connector, so I can attach clip leads, battery test fixtures, and so forth and so on.
We wired the supply into a clip-leaded diode measurement setup with a current limiting resistor and a pair of multimeters to measure the diode current and forward voltage, whereupon we noticed all the meters displayed negative voltages and currents.
After a frenzy of wire-checking verified their setup was all good, I forced the simplest possible test, herein recreated on my bench:
Which produced this display:
After a brief exploration of “Trust, but verify” territory, we swapped the clip leads from the power supply and continued the mission.
Back on my bench, I pulled the supply apart and measured the voltage at the jack terminals:
Still negative. Huh.
The bottom of the power supply PCB shows exactly what you should expect by now:
The red wire near the top of the board is, indeed, soldered to the trace labeled GND and goes to the jack’s tip terminal; the adjacent black wire goes to the front-panel LED. Similarly, the black wire just below it, soldered to the same trace as the yellow wire, goes to the jack’s sleeve terminal; that trace also connects to a resistor leading to the trace labeled LED+ and the LED’s red wire.
Although tattoo machines run from DC supplies, their motors or vibrators don’t depend on any particular polarity and will run fine with a backwards supply.
Resoldering the red and black wires where they should go produces the expected sign at the jack:
Although measuring and plotting diode voltages and currents may seem tedious, actually wiring stuff together and taking data reveals how difficult the real world can be.
I trusted the supply’s internal color code and, although I’m certain I tested the Powerpoles, I obviously didn’t notice the meter’s sign.
Memo to self: Sheesh.
A useful CallerID name that’s not actually spoofed:
I get the distinct impression there’s a disgruntled employee somewhere in their IT department and, apparently, there are more than you’d think.
Ya can’t make this stuff up …
Prompted by RCP’s battery misadventure, I replaced a handful of the Forester’s incandescent bulbs:
Despite what look like “squeeze here” markings, you must push the license plate bulb holders toward the center of the car:
They were both stuck firmly to the trim plate, so I braced a screwdriver against the outboard edge of the trim panel, after which it becomes obvious how pressing inward compresses the (plastic) spring clip so you can pull the outward side of the holder away from the hatch.
Casual searching turned up a bunch of exceedingly helpful advice for anyone DIY-ing through a Forester.
The bulbs with conical ends, known as “festoon” lamps, (unsurprisingly) come in several lengths. The Forester bulbs are about 25 mm long, (unsurprisingly) much shorter than the 31 mm LEDs that seem to be the smallest available replacements, but (surprisingly) the socket tabs have barely enough compliance for the extra half dozen millimeters:
The LEDs are much much much brighter than the incandescents, although I’d prefer warm white to cool white. The cargo compartment lamp in the back is still way too dim; I don’t understand how Subaru decided on a plastic cover tinted tinted dark smoke gray.
All in all, a worthwhile upgrade!
I wonder how long they’ll last? I have one spare of each type …
The QRPme Pocket Pal II produces RF test signals in the 20 meter and 40 meter bands, both square-ish waves derived from its 14.31818 MHz oscillator-in-a-can:
That’s the 20 meter signal, seen through the twisted pair test lead with alligator clips clamped on the scope probe, thusly:
When you’re working with RF signals, the “ground” part of the probe circuit matters:
That’s with the probe and its short spring ground jammed directly into the header:
Well, in this case, signal quality doesn’t matter very much, as you’re using the Pocket Pal II at a hamfest (or your bench) to determine if an HF radio is completely dead.
Here’s the 40 meter output, with the J3 jumper in place and the probe jammed into the header:
Pulling the J3 jumper off doubles the test signal amplitude:
Nothing wrong with those signals! In a pinch, those edges probably produce harmonics up in the UHF bands.
For completeness, here’s the 250 μA DC output driving a contestant chosen from the Box o’ Meters:
Eyeballometrically, the meter wants to see 1 mA for full-scale deflection, which is the whole point of the tester.
Recommended, with some early notes.
The heatsink (surely harvested from a PC, then salvaged from a box o’ goodies) runs about 25 °C above ambient while dropping a 12 V input to 5 V at 180 mA, so it’s good for maybe 2°C/W. It carries a KA278RA05C LDO regulator; you’d probably want something fancier in real life.
The AD9851 DDS requires a 5 V supply to run at 180 MHz from the 30 MHz oscillator on its PCB, with the side effect of putting its minimum Logic 1 Voltage threshold at 3.5 V. Because the Teensy 3.6 runs at 3.3 V from its own on-board linear regulator, the DIP 74AHCT125 level shifter between the two boosts the Teensy’s LVCMOS SPI signals to good old TTL.
The sticker on the CPU reminds me of the jumper cut between the USB +5 V line and the VIN pin, thus putting the Teensy on the better-regulated local supply for the benefit of its ADC reference:
I ran header pins along both sides of the Teensy to simplify attaching scope probes and suchlike; the dangling gray wire brings the scope’s Arbitrary Function generator signal to the Teensy’s A9 input.
The FMDDS Mock 3 firmware lit right up, albeit with the faceplant of sending the SPI bytes in the wrong order and the wrong bit direction, which was easily fixed after a bit of puzzling:
Just a typo, could happen to anyone …
/BMP directory) on a USB flash drive plugged into its front-panel port:
Which produces files like these:
ll --block-size=1 /path-to-USB-stick/BMP/ total 2318336 drwxr-xr-x 2 ed ed 4096 May 23 13:13 ./ drwxr-xr-x 4 ed ed 4096 Dec 31 1969 ../ -rw-r--r-- 1 ed ed 1152054 May 23 13:13 SDS00001.BMP -rw-r--r-- 1 ed ed 1152054 May 23 13:13 SDS00002.BMP
The files are 1152054 bytes long, as specified by the BMP header inside the file:
hexdump -C /path-to-USB-stick/BMP/SDS00001.BMP | head 00000000 42 4d 36 94 11 00 00 00 00 00 36 00 00 00 28 00 |BM6.......6...(.| 00000010 00 00 20 03 00 00 e0 01 00 00 01 00 18 00 00 00 |.. .............| 00000020 00 00 00 94 11 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 |................| 00000040 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| * 00000880 01 01 01 01 01 01 01 01 01 01 01 01 01 01 1e 1e |................| 00000890 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00000990 1e 1e 1e 1e 1e 1e 01 01 01 01 01 01 01 01 01 01 |................|
The first 14 bytes contain the
Bitmap file header, with the file size in Little-Endian order in the four bytes at offset +0x02: 0x00119436 = 1152054.
The four bytes at offset +0x0A give the offset of the pixel data: +0x36. That’s the series of 0x01 bytes in the fourth row. Unlike most images, BMP pixel arrays start at the lower left corner of the image and proceed rightward / upward to the last pixel at the upper right corner.
The data between the
Bitmap file header and the start of the pixel data contains at least a
Device Independent Bitmap header, identified by its length in the first four bytes at offset +0x0E. In this case, the length of 0x28 = 40 bytes makes it a Windows (no surprise) header.
The two bytes at +1C give the bits-per-pixel value: 0x18 = 24 = 3 bytes/pixel, so parse the pixels in RGB order.
The four bytes at +0x12 give the bitmap width in pixels: 0x320 = 800. Each pixel row must be a multiple of 4 bytes long, which works out fine at 2400 bytes.
The tail end of the file shows one dark pixel at the upper right:
hexdump -C /path-to-USB-stick/BMP/SDS00001.BMP | tail 00118330 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 |................| 00118340 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc |................| 00118350 00 00 cc 00 00 cc 00 00 cc 0f 0f 75 1e 1e 1e 1e |...........u....| 00118360 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00118ad0 1e 1e 1e 01 01 01 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| 00118ae0 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00119430 1e 1e 1e 01 01 01 |......|
Which looks like this, expanded by a factor of eight (clicky for more dots to reveal the situation):
The scope can also transfer a screenshot over the network:
lxi screenshot -a 192.168.1.42 /tmp/lxi-shot.bmp Loaded siglent-sds screenshot plugin Saved screenshot image to /tmp/lxi-shot.bmp
Which has the same header:
hexdump -C /tmp/lxi.bmp | head 00000000 42 4d 36 94 11 00 00 00 00 00 36 00 00 00 28 00 |BM6.......6...(.| 00000010 00 00 20 03 00 00 e0 01 00 00 01 00 18 00 00 00 |.. .............| 00000020 00 00 00 94 11 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 |................| 00000040 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| * 00000880 01 01 01 01 01 01 01 01 01 01 01 01 01 01 1e 1e |................| 00000890 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00000990 1e 1e 1e 1e 1e 1e 01 01 01 01 01 01 01 01 01 01 |................|
But the resulting file is three bytes = one pixel (!) too large:
ll --block-size=1 /tmp/lxi.bmp -rw-rw-r-- 1 ed ed 1152057 May 23 19:09 /tmp/lxi.bmp
The tail end of the file:
hexdump -C /tmp/lxi.bmp | tail 00118330 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 |................| 00118340 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc 00 00 cc |................| 00118350 00 00 cc 00 00 cc 00 00 cc 0f 0f 75 1e 1e 1e 1e |...........u....| 00118360 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00118ad0 1e 1e 1e 01 01 01 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| 00118ae0 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e |................| * 00119430 1e 1e 1e 01 01 01 01 01 0a |.........|
Because the file header doesn’t include those three bytes, they don’t go into the image and the resulting screenshot is visually the same.
Which looks like a picket-fence error, doesn’t it? I’d lay long odds the erroneous loop runs from 0 to NUMPIXELS, rather than 0 to NUMPIXELS-1. Raise your hand if you’ve ever made that exact mistake.
I have no practical way to determine whether the error is inside the scope or the LXI network code, but given Siglent’s overall attention to software fit-and-finish, I suspect the former.
One can convert BMP files to the much more compact PNG format:
convert /tmp/lxi.bmp /tmp/lxi.png convert: length and filesize do not match `/tmp/lxi.bmp' @ warning/bmp.c/ReadBMPImage/829.
Yes. Yes, there is a mismatch.
The space savings is impressive, particularly in light of PNG being a lossless format:
ll /tmp/lxi.* -rw-rw-r-- 1 ed ed 1.1M May 23 19:09 /tmp/lxi.bmp -rw-rw-r-- 1 ed ed 14K May 23 19:17 /tmp/lxi.png
You can eliminate the nag by truncating the file:
truncate --size=1152054 /tmp/lxi.bmp
One could wrap it all up in a script:
#!/bin/bash lxi screenshot -a 192.168.1.42 /tmp/"$1".bmp truncate --size=1152054 /tmp/"$1".bmp convert /tmp/"$1".bmp "$1".png echo Screenshot: "$1".png
And then It Just Works:
getsds2304x.sh "Test Shot Starfish" Loaded siglent-sds screenshot plugin Saved screenshot image to /tmp/Test Shot Starfish.bmp Screenshot: Test Shot Starfish.png