JPG Recovery From a Camera FAT Filesystem

You can do it by hand, as I used to, or use recoverjpeg:

dmesg | tail
cd /tmp
sudo dcfldd if=/dev/sde1 of=pix.bin bs=1M count=100
recoverjpeg pix.bin 
ristretto image00*

Nothing prizewinning, but better than no picture at all:

Garage Robin - recovered image
Garage Robin – recovered image

Note that you start by copying a reasonable chunk of the partition from the Memory Stick / (micro)SD Card first, to prevent a bad situation from getting worse.

Now I can remember the easy way the next time around this block …

Solid Modeling: Support Puzzle

I’ve been putting this type of support structure inside screw holes & suchlike for years:

Browning Hi-Power Magazine Block - solid model - Generic 1 - support detail
Browning Hi-Power Magazine Block – solid model – Generic 1 – support detail

It’s basically a group of small rectangles rotated around the hole’s axis and about one thread thickness shorter than the overhanging interior.

I’ve found that incorporating exactly the right support structure eliminates Slic3r’s weird growths, eases removal, and generally works better all around.

So doing this for the baseplate of the Glass Tile frame came naturally:

Glass Tile Frame - octagonal support
Glass Tile Frame – octagonal support

This OpenSCAD snippet plunks one of those asterisks in each of four screw holes:

  if (Support)
    color("Yellow")
      for (i=[-1,1], j=[-1,1])
        translate([i*InsertOC.x/2,j*InsertOC.y/2,0])
          for (a=[0:45:135])
              rotate(a)
                translate([0,0,(Screw[LENGTH] - ThreadThick)/2])
                  cube([Screw[OD] - 2*ThreadWidth,2*ThreadWidth,Screw[LENGTH] - ThreadThick],center=true);

The “cubes” overlap in the middle, with no completely coincident faces or common edges, so it’s 2-manifold. Slic3r, however, produces a weird time estimate whenever the model includes those structures:

Slic3r - NaN time estimate
Slic3r – NaN time estimate

NaN stands for Not A Number and means something horrible has happened in the G-Code generation. Fortunately, the G-Code worked perfectly and produced the desired result, but I’m always uneasy when Something Seems Wrong.

Messing around with the code produced a slightly different support structure:

Glass Tile Frame - quad support
Glass Tile Frame – quad support

The one thread thick square on the bottom helps glue the structure to the platform and four ribs work just as well as eight in the octagonal hole:

  Fin = [Screw[OD]/2 - 1.5*ThreadWidth,2*ThreadWidth,ScrewRecess - ThreadThick];
  if (Inserts && SupportInserts)
    color("Yellow")
      for (i=[-1,1], j=[-1,1])
        translate([i*InsertOC.x/2,j*InsertOC.y/2,0]) {
          rotate(180/8)
            cylinder(d=6*ThreadWidth,h=ThreadThick,$fn=8);
          for (a=[0:90:360])
              rotate(a)
                translate([Fin.x/2 + ThreadWidth/2,0,(ScrewRecess - ThreadThick)/2])
                  cube(Fin,center=true);
        }

Which changed the NaN time estimates into actual numbers.

One key difference may be the small hole in the middle. The four ribs (not two!) now overlap by one thread width around the hole, so they’re not quite coincident and Slic3r produces a tidy model:

Glass Tile Frame - quad support - Slic3r
Glass Tile Frame – quad support – Slic3r

The hole eliminates a smear of infill from the center, which may have something to do with the improvement.

In any event, I have an improved copypasta recipe for the next screw holes in need of support, even if I don’t understand why it’s better.

Glass Tiles: Matrix for SK6812 PCBs

Tweaking the glass tile frame for press-fit SK6812 PCBs in the bottom of the array cells:

Glass Tile Frame - cell array - openscad
Glass Tile Frame – cell array – openscad

Which looks like this with the LEDs and brass inserts installed:

Glass Tile - 2x2 array - interior
Glass Tile – 2×2 array – interior

The base holds an Arduino Nano with room for wiring under the cell array:

Glass Tile Frame - base - openscad
Glass Tile Frame – base – openscad

Which looks like this after it’s all wired up:

Glass Tile - 2x2 array - wiring
Glass Tile – 2×2 array – wiring

The weird colors showing through the inserts are from the LEDs. The red thing in the upper left is a silicone insulation snippet. Yes, that’s hot-melt glue holding the Arduino Nano in place and preventing the PCBs from getting frisky.

Soak a handful of glass tiles overnight in paint stripper:

Glass Tiles - paint stripper soak
Glass Tiles – paint stripper soak

Whereupon the adhesive slides right off with the gentle application of a razor scraper. Rinse carefully, dry thoroughly, and snap into place.

Tighten the four M3 SHCS and it’s all good:

Glass Tile - 2x2 array - operating
Glass Tile – 2×2 array – operating

So far, I’ve had two people tell me they don’t know what it is, but they want one:

Glass Tile - various versions
Glass Tile – various versions

The OpenSCAD Customizer lets you set the array size:

Glass Tile Frame - 3x3 - press-fit SK6812 LEDs
Glass Tile Frame – 3×3 – press-fit SK6812 LEDs

However, just because you can do something doesn’t mean you should:

Glass Tile Frame - 6x6 cell array - openscad
Glass Tile Frame – 6×6 cell array – openscad

Something like this might be interesting:

Glass Tile Frame - 2x6 cell array - openscad
Glass Tile Frame – 2×6 cell array – openscad

In round numbers, printing the frame takes about an hour per cell, so a 2×2 array takes three hours and 3×3 array runs around seven hours. A 6×6 frame is just not happening.

The OpenSCAD source code as a GitHub Gist:

Glass Tiles: Glow vs. Flash Firmware

Although it’s not obvious in a still picture, the firmware now supports both the continuously changing colors of the Nissan fog lamp (mashed with tweaks from the vacuum tube lights) and the randomly changing colors from the LED matrix, both using SK6812 LEDs rather than the failing WS2812 modules:

Glass Tile - glow vs flash
Glass Tile – glow vs flash

Flash is a misnomer, as the tiles simply change from one color to the next, but I’ve never been adept at picking catchy names. In any event, the glass tiles on the left show nice pastel shades, in contrast to the bright primary(-ish) colors appearing on the right.

The colors are random numbers from 1 to 7, because 0 produces a somewhat ugly dark cell. The SK6812 modules have a white LED in addition to the RGB LEDs in the WS2812 modules, so I replace the “additive white” R+G+B color with the more-or-less true white (warm, for these modules) LED.

The new color goes into a cell picked at random (0 through 3, for 2×2 frames), except if the cell already holds the same color, whereupon a simple XOR flips the colors, except if the cell is already full-on white, whereupon it becomes half-on white to avoid going completely dark.

The glass tiles must change colors at a much slower pace than the 8×8 LED matrix, because there are so few cells; a random delay between 500 ms and 6 s seems about right.

They look really great in a dim room!

The Arduino source code as a GitHub Gist:

PiHole with DNS-over-HTTP: Revised

More than a year later, the PiHole continues to work fine, but the process for installing the Cloudflare DoH machinery has evolved.

(And, yes, it’s supposed to be DNS-over-HTTPS. So it goes.)

To forestall link rot, the key points:

cd /tmp ;  wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
tar -xvzf cloudflared-stable-linux-arm.tgz 
sudo cp cloudflared /usr/local/bin
sudo chmod +x /usr/local/bin/cloudflared
sudo cloudflared -v
sudo useradd -s /usr/sbin/nologin -r -M cloudflared
sudo nano /etc/default/cloudflared
----
CLOUDFLARED_OPTS=--port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query 
----
sudo chown cloudflared:cloudflared /etc/default/cloudflared
sudo chown cloudflared:cloudflared /usr/local/bin/cloudflared
sudo nano /etc/systemd/system/cloudflared.service
----
[Unit]
Description=cloudflared DNS over HTTPS proxy
After=syslog.target network-online.target

[Service]
Type=simple
User=cloudflared
EnvironmentFile=/etc/default/cloudflared
ExecStart=/usr/local/bin/cloudflared proxy-dns $CLOUDFLARED_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target
----
sudo systemctl enable cloudflared
sudo systemctl start cloudflared
sudo systemctl status cloudflared

Then aim PiHole’s DNS at 127.0.0.1#5053. It used to be on port #54, for whatever that’s worth.

Verify it at https://1.1.1.1/help, which should tell you DoH is in full effect.

To update the daemon, which I probably won’t remember:

wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
tar -xvzf cloudflared-stable-linux-arm.tgz
sudo systemctl stop cloudflared
sudo cp ./cloudflared /usr/local/bin
sudo chmod +x /usr/local/bin/cloudflared
sudo systemctl start cloudflared
cloudflared -v
sudo systemctl status cloudflared

And then It Just Works … again!

Garden Hose Valve Wrench: Reinforced

After five gardening seasons, my simple 3D printed wrench broke:

Hose Valve Knob - fractured
Hose Valve Knob – fractured

Although Jason’s comment suggesting carbon-fiber reinforcing rods didn’t prompt me to lay in a stock, ordinary music wire should serve the same purpose:

Hose Valve Knob - cut pins
Hose Valve Knob – cut pins

The pins are 1.6 mm diameter and 20 mm long, chopped off with hardened diagonal cutters. Next time, I must (remember to) grind the ends flat.

The solid model needs holes in appropriate spots:

Hose Valve Knob - Reinforced - Slic3r
Hose Valve Knob – Reinforced – Slic3r

Yes, I’m going to put round pins in square holes, without drilling the holes to the proper diameter: no epoxy, no adhesive, just 20 mm of pure friction.

The drill press aligns the pins:

Hose Valve Knob - pin ready
Hose Valve Knob – pin ready

And rams them about halfway down:

Hose Valve Knob - pin midway
Hose Valve Knob – pin midway

Close the chuck jaws and shove them flush with the surface:

Hose Valve Knob - pins installed
Hose Valve Knob – pins installed

You can see the pins and their solid plastic shells through the wrench stem:

Hose Valve Knob - assembled
Hose Valve Knob – assembled

Early testing shows the reinforced wrench works just as well as the previous version, even on some new valves sporting different handles, with an equally sloppy fit for all. No surprise: I just poked holes in the existing model and left all the other dimensions alone.

The OpenSCAD source code as a GitHub Gist:

Soaker Hose End Plug

One of the soaker hoses in Mary’s Vassar Farms garden split lengthwise near one end:

Soaker Hose Plug - hose split
Soaker Hose Plug – hose split

Although the hose is fully depreciated, I thought it’d be worthwhile to cut off the damaged end and conjure an end cap to see if a simple plug can withstand 100 psi water pressure.

A pair of Delrin (because I have it) plugs with serrations fill the hose channels, with the outer clamp squishing the hose against them:

Soaker Hose Plug - channel plugs - side view
Soaker Hose Plug – channel plugs – side view

In real life, they’ll be pushed completely into the hose, with a generous layer of silicone snot caulk improving their griptivity.

I started with 8 mm plugs, but they didn’t quite fill the channels:

Soaker Hose Plug - channel plugs - 8 mm test fit
Soaker Hose Plug – channel plugs – 8 mm test fit

Going to 8.5 mm worked better, although there’s really no way to force the granulated rubber shape into a snug fit around a cylinder:

Soaker Hose Plug - channel plugs test fit
Soaker Hose Plug – channel plugs test fit

Fortunately, they need not be leakproof, because leaking is what the hose does for a living. Well, did for a living, back before it died.

The clamps have a solid endstop, although it’s more to tidy the end than to hold the plugs in place:

Soaker Hose End Plug - Slic3r
Soaker Hose End Plug – Slic3r

The clamps need aluminum backing plates to distribute the stress evenly across their flat sides:

Soaker Hose Plug - installed
Soaker Hose Plug – installed

Those are 8-32 stainless steel screws. The standard 1 inch length worked out exactly right through no fault of my own.

The OpenSCAD source code as a GitHub Gist:

The original doodle, with dimensions vaguely related to the final model:

Soaker Hose End Plug - hose dimensions
Soaker Hose End Plug – hose dimensions

There is, as far as I can tell, no standardization of dimensions or shapes across manufacturers, apart from the threaded hose fittings.