The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Tag: Repairs

If it used to work, it can work again

  • Recovering JPG Images From Damaged Flash Memory

    My DSC-F717 just crashed as I took a picture in the Basement Laboratory; it stalled while writing a picture to the memory stick. This camera is known to have problems with its ribbon cables and I’ve fixed it a few times before, but right now I have other things to do. Who knows? Maybe it’s a different problem altogether.

    Thus, the pertinent question is how to grab the image files from the Memory Stick, even with a damaged filesystem. This trick will work with any memory device, so it’s not just a Memory Stick thing.

    The camera crashed with the Memory Stick activity LED stuck on. Turning the camera off didn’t work: it jammed in the power-down sequence. So I poked the Reset button, which snapped the camera back to 1 January 2002, just after midnight. Alas, it now couldn’t read the Memory Stick, which meant either the filesystem is pooched or the camera’s card socket has gone bad again.

    Mmm, do you know where your camera’s Reset button is? It might not even have one, in which case you just yank the battery. If you can yank the battery, that is.

    Anyhow…

    With the camera turned off: extract the memory card, poke it into a suitable USB card reader, and poke that into your PC (running Linux, of course).

    If the filesystem isn’t too badly damaged, you’ll probably get a popup asking what to do with the new drive (the memory card). Dismiss that, as you don’t want anything writing to the memory without your explicit permission, which you won’t give.

    Figure out which device corresponds to the card and which partition to use:

    dmesg | tail
    [29846.600524] sd 5:0:0:2: [sdd] 1947648 512-byte hardware sectors (997 MB)
    [29846.606022] sd 5:0:0:2: [sdd] Write Protect is off
    [29846.606030] sd 5:0:0:2: [sdd] Mode Sense: 23 00 00 00
    [29846.606033] sd 5:0:0:2: [sdd] Assuming drive cache: write through
    [29846.608748]  sdd: sdd1
    

    In this case, the Memory Stick was intact enough to have a valid partition table, so it could be successfully mounted. However, you don’t want any attempt to write the data, just to keep a bad situation from getting worse. You do that by mounting the device read-only:

    sudo mount -o ro /dev/sdd1 /mnt/part

    You’ll need a suitable mount point; I created /mnt/part early on to hold manually mounted disk partitions.

    The FAT filesystem seemed to point to valid files, but attempting to display them didn’t work. So unmount the device before proceding:

    sudo umount /dev/sdd1

    Switch to /tmp or anywhere you have enough elbow room for a few files the size of the memory card.

    Run dd to make a bit-for-bit copy of the entire drive:

    sudo dd if=/dev/sdd of=memstick.bin bs=1M

    The bs=1M should dramatically speed up the transfer; the default is, IIRC, 512 bytes.

    After this, everything you do uses memstick.bin, not the memory card itself. If you’re paranoid like me, you’ll make a copy of the file before you do anything hazardous. You could even make two copies directly from the memory card and compare them, which might be instructive.

    To find your precious JPG images among the rubble, look for their magic Exif headers:

    strings -t x memstick.bin | grep Exif
      68006 Exif
     258006 Exif
     680006 Exif
     848006 Exif
     a18006 Exif
     bf0006 Exif
     e00006 Exif
     fe8006 Exif
    11e8006 Exif
    1420006 Exif
    ... snippage ...
    

    Because the strings search ignores the (presumably broken) FAT directory structure, you’ll find all the image files on the drive, whether or not they’ve been deleted, partially overwritten, or whatever. This is great for forensics and terrible if you’ve got something to hide. You have been warned.

    The -t x parameter returns the string’s starting offset in hex, which you need to find the actual starting offset of the file: it’s 6 bytes lower! Your mileage may vary, so be prepared to fiddle around a bit.

    You could write a bunch of code to parse the JPG header and extract exactly the number of bytes required, but this is no time for subtle gestures. I just yank out whatever the largest possible image file could be, because image-processing programs only process the valid stuff anyway. So, knowing that this camera produces images in the 2.4 MB range, this extracts the first image:

    dd if=memstick.bin of=image.jpg bs=$((16#1000)) count=1K skip=$((16#68))
    

    The $(( … )) notation evaluates the numeric expression within and the 16#… notation expresses a hexadecimal value.

    Soooo, bs=$((16#1000)) says that the blocksize is 4096 bytes, which you can deduce from the fact that all the Exif headers start 6 bytes from a multiple of 0x1000. Again, your camera may do things differently, but the general notion should get you started.

    If you’re fussy, you’ll note that the headers are actually on multiples of 0x8000 bytes, but using 0x1000 means you can read the high-order digits right off the strings dump. Why make things more complicated than necessary?

    Given a 4K blocksize, count=1K extracts a 4MB chunk: 1024 blocks of 4096 bytes each. That’s larger than the largest possible image file from this camera; adjust it to suit whatever you expect to find. Don’t be stingy, OK?

    The skip=$((16#68)) says to begin extracting data 0x68 blocks into memstick.bin. You read that value directly from the strings output, which is easy enough.

    You could write a tidy Bash script to eat the strings values and spit out the corresponding file chunks. I had few enough images this time to just do it manually, which beats having to debug some code…

    Good luck!

  • Electronic Fluorescent Ballast: Zowie!

    Back in 2000, I replaced the ballast in our bathroom light; the old one failed after a mere 45 years. The casing didn’t sport any PCB-free labels (no surprise there), so I disposed of the carcass at a town hazmat day.

    Under normal circumstances you’d replace the whole fixture, but this is a slender 4-foot chromed steel base with a matching chromed shield over a 4-foot fluorescent tube: charming, in a retro-mid-50s sort of way. We couldn’t find anything suitable at the local big-box home supply stores, so I just cleaned it up and stuck a new ballast inside.

    I indulged in the luxury of a warm-white tube so I didn’t look quite so dead in the morning.

    That ballast just failed, after a mere 9 years, which I confirmed by swapping in a new tube. It seems nothing lasts any more.

    We went through the same “should we get a new fixture?” exercise and, unwilling to drop more than $150 on a really cheesy two-tube fixture that would be way too bright, I bought Yet Another Ballast from, oddly enough, the same manufacturer and possibly even the same Mexican town.

    This time I got an electronic ballast, with an A sound rating which comes mostly for free without that big magnetostrictive iron core. Costs twice what the magnetic ballast does, but I figure you only go around once, right?

    It comes with a scary label telling you to insulate the unused lead (it can drive two tubes) “for 600 V”. That turns out to be the standard wire-nut rating, so I clipped off the exposed copper end and screwed the nut in place over the insulation. Wired the leads up per the diagram and that’s the end of that story.

    Now, I’m here to tell you that going from a nearly dead magnetic ballast to a shiny new electronic ballast is a wonder to behold: the tube pops on at full brilliance, far brighter than it ever was before, and is (no surprise) flicker-free.

    It’s almost enough to make me preemptively re-ballast the kitchen fixtures …

    Update: Which I did, a few months later. The 4-tube kitchen light pops on and is much brighter. However, that may be due to new tubes as much as anything; the ballasts wanted T8 tubes. Alas, I couldn’t find 3000 K warm-whites and had to settle for 3500 K soft-whites. All in all, a good improvement.

    More on electronic ballast adventures there.

  • Clock-radio Backup Battery vs Current Drain

    Clock-radio battery hack
    Clock-radio battery hack

    The little red Battery Sentinel LED on our old Realistic (a.k.a. Tandy a.k.a. Radio Shack) clock radio was on this morning, which means that, once again, the backup battery needs attention.

    It’s supposed to use an ordinary 9V battery, but it ate two or three of those a year. Given the absurd cost of 9V batteries relative to AA cells, that stopped making sense pretty quickly.

    Most devices with backup batteries draw essentially zero power from them during normal operation. This gadget draws 6 µA.

    An alkaline 9V battery has a capacity of about 500 mAh, maybe more with a low-drain load like this. That should last for a few years:

    500e-3 / 6e-6 = 83k hours = 500 weeks = 10 years

    Alas, the clock battery monitor is really fussy and triggers the LED when the voltage drops under about 8.5 V.

    [Update: the clock does a “battery test” every day, which probably accounts for the short battery life. I haven’t measured that current… or the duration of the test.]

    Fortunately, the clock case has a recessed bottom that fits a standard AA cell holder like a glove. I wired up 1-1/2 4-cell holders (yes, I should have used 7 cells, but I wasn’t sure what the upper voltage limit might be) to a standard 9V battery snap connector and screwed the assembly to the case.

    Now all I must put up with are the weak AA cells I got from batteries.com; the most recent order was a disappointment.

    Memo to Self: That snap connector has red = negative / black = positive!

  • Old Kenmore Sewing Machine Foot Control Repair

    Foot control - inside view
    Foot control – inside view

    One of Mary’s first investments when she got out of college was a sewing machine and she’s been using it ever since. Of late, it’s gotten a bit sporadic and the foot control seemed to be at fault.

    The symptoms were that the foot control required too much travel (equivalently: foot pressure) to get up to speed, it started abruptly (poor speed regulation), and sometimes cut out without warning.

    So I took it apart to see what I could do.

    Two pins in the side hold the top cover in place and serve as pivots. Loosen the two visible screws in the center of two of the bottom feet, hold the top half of the case down, and slide the pins out.

    A wedge on the top half presses down on the middle of the steel bar, pressing it into the rheostat. A dab of silicone lube on the wedge greatly improved that action.

    Rheostat graphite wafers and contacts
    Rheostat graphite wafers and contacts

    The speed control itself is brutally simple: a carbon-pile rheostat in series with the 120 VAC 1 A sewing machine motor. The ceramic case and heatsink tab tell you that things get pretty toasty inside that Bakelite case.

    Disassembly is obvious, which is one of the nice things about old electrical gadgets: you can puzzle out how they work and how the parts fit together just by looking. A slew of graphite disks slides out from two cylindrical tunnels in the ceramic case, followed by two graphite contact buttons. The brass fittings on the front have carbon dust on their raised surfaces, but are basically just stamped & machined metal parts.

    No fancy electronics, no firmware, just a high-power (and utterly non-inductive!) carbon variable resistor.

    The rheostat has three modes, in increasing order of pressure:

    • Off — no pressure on the foot control
    • Resistive speed control — resistance varies with foot pressure
    • Full throttle — rheostat resistance shorted by front switch
    Rheostat speed control contacts
    Rheostat speed control contacts

    With no pressure on the foot control, there’s a generous gap between the contact bar on the back surface and the two graphite buttons sticking out of the ceramic case. There’s no way for the contacts to close by shaking or accident.

    A bit more foot pressure connects those two buttons through the shorting bar across the back. Light pressure on the graphite disks means a relatively high resistance, on the order of several hundred ohms, and relatively low current to the motor. Of course, that also means the motor has poor starting torque, but … a sewing machine doesn’t need a lot of torque.

    Increasing foot pressure squeezes the disks together and decreases the resistance. It drops to a few tens of ohms, perhaps lower, but it’s hard to get a stable measurement. The motor averages all that out and trundles along at a reasonably steady pace.

    Rheostat full-speed contacts
    Rheostat full-speed contacts

    Finally, the brass disk in the central case tunnel shorts the tabs on the two brass end contacts and lets the motor run at full speed. Increasing the foot pressure beyond that point doesn’t change anything; the spring-loaded shaft can’t deform the tabs.

    The steel shaft and contact disk can short one or the other of the two piles, but that just decreases the already small resistance by about half. That might give the motor a speed boost instantly before jumping to full speed.

    As nearly as I can tell, the carbon disks evaporated over the decades, as the piles seems quite loose and required a lot of foot motion to reach the first contact point. I lathe-turned a pair of brass disks about three wafers thick, so that they’d take up the empty space in the piles.

    I also filed the brass end fittings flat so that they contact the disks over more of their surface. The first two disks looked like they had hot spots: loose carbon collected in the areas where the contacts didn’t quite touch them. I doubt that actually improved anything, but it’s the thought that counts.

    The spacers worked reasonably well, although I wound up removing one graphite disk from each pile to ensure the full-speed contacts would close properly. They’re in a small plastic bag tucked under the aluminum heatsink tab, where they can’t get lost. With any luck, the bag won’t melt around them.

    Rheostat with brass spacer button
    Rheostat with brass spacer button

    A few days later, the sewing machine stopped working entirely. The foot control itself seemed to be working correctly, but a bit of poking around showed that the cord had a broken conductor just outside the strain relief. I cut the cord off at the strain relief, hacksawed the strain relief apart, then rewired it. The cord is now four inches shorter and everything works fine again.

    I think this would be a nice candidate for a PWM controller, but then I’d have to shoehorn all that circuitry into the base of the sewing machine or add another cord to the foot control. Ptui, this works well enough.

    Memo to Self: Replace the entire cord next time.

  • Storm Door Latch Lube

    Storm door latch parts
    Storm door latch parts

    Our old house has storm doors with brass latch bolts and brass strike plates. Brass-on-brass is nicely self-lubricating, unlike the steel-on-steel contraptions available these days, but of late our back door hasn’t been closing smoothly.

    I fiddled with the door closer’s tension and release point to no avail, then (re)discovered that a dab of PTFE lubricant on the latch and strike plate makes the storm door close exceedingly smoothly. The base grease is clear and doesn’t make a black mess of things.

    Duh.

    Maybe everybody knows that and perhaps I knew it at one time.

    I wrote about rebuilding the strike pull and shaft cam of these latches as CNC projects in my Digital Machinist column. Naturally, the replacement latches available in the local hardware stores didn’t fit the door, so the simplest course of action was some quality shop time.

  • CD V-750 Dosimeter Charger Manual

    V-750 Model 5b Manual Cover
    V-750 Model 5b Manual Cover

    My V-750 dosimeter charger came with two (!) copies of the manual and the modification instructions (stamped JUN–1965) for adding the anti-kick capacitor.

    The paperwork didn’t fare quite as well as the metal-cased charger, sporting far more mildew on the pages than I want on my shelves.

    I cut the worst-looking copy right down the middle, scanned it with some attention to detail, and now there’s a nice version that looks just as bad but lacks the mildew.

    Clicky:

    CD V-750 Model 5b Radiological Dosimeter Charger Operating and Maintenance Manual with Modification Instruction Sheet

    If you’re really clever, you can figure out how to sequence the sheets and print them duplexed so they appear back-to-back, then bind them into a booklet just like the original. There’s a copy of a blank inside cover, too, so you can wrap your booklet in a nice Civil Defense Yellow cover.

    The schematic shows what real engineers could do, back in the days when transistors came individually packaged with a ten-dollar price tag: 1.5 volts in, 200+ volts out, one transistor. Of course, they paid attention to their transformer lessons.

    V-750 Dosimeter Charger Schematic
    V-750 Dosimeter Charger Schematic
  • CD V-750 Dosimeter Charger Switch Cleanup

    So I got a classic Jordan Electronics CD V-750 dosimeter charger (for V-742 dosimeters) from the usual eBay supplier, mostly because I’m writing a Circuit Cellar column and need a MacGuffin to talk about HV transformers and power supplies.

    The charger had some corrosion on the cast aluminum (?) knobs, but seemed largely unscathed by four decades in its original box. The charging circuitry depends on a few electrical contacts and, as you might expect, those were badly intermittent.

    A bit of background…

    Charging contact pedestal
    Charging contact pedestal

    The charging pedestal has two parts visible from the outside: an outer sleeve that’s firmly secured to the case and an inner cylinder that slides within the sleeve, with springs inside the charger pressing it outward. Well, there’s a nut, toothed washer, and the bead-chain cap assembly, but those don’t count.

    The inner cylinder has a transparent plastic insert crimped in place, with a metal rod protruding about 2 mm from the flat top of the plastic. That rod presses against the middle contact of the dosimeter and connects the charging voltage to the electrostatic fiber. The outer body of the dosimeter fits snugly over the cylinder to make the other electrical contact.

    The directions tell you to press the dosimeter down gently to read it. A weak spring holds the cylinder outward with about 1.5 lb of force. After about 1 mm of travel an incandescent bulb (remember those?) turns on, transmits light through the plastic insert, and lights up the dosimeter scale and fiber.

    To charge the dosimeter, you press down firmly and twiddle the adjusting knob to position the fiber. Pressing hard enough to force the dosimeter body down to the sleeve, another 3 mm of travel, compresses the dosimeter’s internal bellows (or plastic seal) enough to complete the circuit to the fiber; a sealed dry air gap normally isolates the fiber from the dosimeter’s external contact. A stout leaf spring holds the cylinder outward with (according to one instruction manual) 7.75 lb of force, so it takes more pressure than you’d expect to hold the dosimeter down.

    Charging contact inside view
    Charging contact inside view

    The internal parts of the charging pedestal makes all that stuff work without any formal switch contacts. That, unfortunately, causes the intermittent operation.

    The gray “wire” inside the large 7-lb leaf spring is both the 1-lb spring and the high-voltage electrical contact. The purple wire soldered to the end of the wire spring carries the HV charging potential from the circuitry.

    The black and red wires connect to the incandescent bulb, which fits into the holder near the top of the circuit board sticking up vertically just to the right of the pedestal base; I removed it to reveal the other parts. For what it’s worth, the bulb holder doesn’t do a good job of securing the bulb; I have some improvements in mind for that, too.

    Note the spare bulb just beyond the center bulb contact near the top of the picture. The rubber grommet securing that has turned into black Gummi-bear substance; that sucker is in there forever.

    The battery’s positive terminal connects to the case; this is a positive-ground circuit!

    The leaf spring hitches over two shoulders on the circuit board and presses it firmly against the other side of the spring. The curved fork fingers pressing against the brown insulating washer are firmly mounted to the circuit board and act as one side of the switch contacts.

    Pedestal removed from charger
    Pedestal removed from charger

    When you push the dosimeter against the sleeve, the base of the cylinder slides through the ID of the fiber washer and contacts the fork fingers. Bingo, that completes the circuit, lights the lamp, and fires up the HV circuitry. The charging voltage doesn’t reach the dosimeter fiber because the leaf spring hasn’t started pressing the cylinder against the dosimeter’s innards: there’s no connection inside the dosimeter.

    With that out of the way, here’s what’s needed to get the pedestal working reliably.

    Get the whole pedestal assembly out of the charger, which requires a bit of wiggly jiggly action. This will be easier if you unsolder the three wires, which I didn’t do until I was sure it was absolutely necessary.

    Grab the leaf spring on both sides of the bulb circuit board, pull up while pushing down on the spring’s base with some other fingers, and lift the tabs off the circuit board shoulders. This requires a surprising amount of force; don’t let the spring get you by the soft parts!

    Leaf spring released
    Leaf spring released

    A small crimped metal connector mates the end of the wire spring to the center contact in the cylinder. Pay attention as you maneuver the pedestal out of the leaf spring: you don’t want to deform that connector too much. Or, much worse, lose it under your workbench.

    There’s a rubber O-ring inside the outer sleeve that’s barely visible in the picture of the parts. The 1-lb wire spring had trouble forcing the cylinder back out through the O-ring, leaving the switch just barely closed even with the dosimeter removed. A touch of silicone gasket lube on the O-ring made it wonderfully slippery again.

    The inner cylinder has wire snap ring in a groove that adds a bit of stability and maybe some contact friction inside the sleeve. You need not remove the snap ring; they’re not called Jesus clips for nothing. It’s outside the O-ring’s protection, exposed to the world.

    Basically, clean everything without yielding to the Siren Call of sandpaper. What you want to do is get the oxidized metal off the base material without scarring it.

    Pedestal contact components
    Pedestal contact components

    I applied a tiny drop of Caig DeoxIT Red to the snap ring, worked it around & around, then wiped off the residue.

    The actual switch “contacts” are the wide base of the inner cylinder (to the right in the picture) and the rounded end of the fork attached to the lamp base circuit board. The contact area is broad, smooth, plated-steel-on-steel, and utterly unsuited to the job. Wipe both of them clean, add DeoxIT, wipe them clean again.

    I applied another minute drop of DeoxIT to the base of the cylinder after putting everything back together, rotated it against the fork, and wiped it off. Most likely that had only psychological benefit, but what the heck.

    The parts go back together in the obvious way, again taking care not to let the leaf spring bite you. I routed the wires a bit differently, but I doubt it makes any difference.

    Now the charger works perfectly again!

    Memo to Self: replace that bulb with nice soldered-in-place LED

    V-742 Dosimeter set to Zero
    V-742 Dosimeter set to Zero

    Update: It seems you can actually buy V-750 dosimeter chargers new from www.securityprousa.com/doch.html. However, eBay is significantly less expensive and you might get some quality shop time out of it. Your choice.