Mini-lathe Metric Threading: Stackable Change Gear Generator

Although OpenSCAD’s MCAD library includes a gear generator, I don’t profess to understand the relations between reality and its myriad parameters, plus I vaguely recall it has a peculiar definition for Diametral Pitch (or some such). Rather than fiddle with all that, I start with an SVG outline from Inkscape’s Gears extension and go all 3D on it.

So, the “gear blank” looks like this after extruding the SVG:

Mini-lathe change gear - 42 tooth - SVG import
Mini-lathe change gear – 42 tooth – SVG import

Producing this is a lot easier in OpenSCAD than in real life:

Mini-lathe change gear - 42 tooth - solid model
Mini-lathe change gear – 42 tooth – solid model

OpenSCAD centers the blank’s bounding box at XY=0, which won’t be exactly on the bore centerline for gears with an odd number of teeth. One tooth sits at 0° and two teeth bracket 180°, so the bounding box will be a little short on one side

A reference for gear nomenclature & calculations will come in handy.

For a 21 tooth module 1 gear, which should be pretty close to the worst case in terms of offset:

  • Pitch dia = d = 21 × 1 = 21 mm
  • Tip dia = da = d + 2m = 23 mm
  • Tip radius = da/2 = 11.5 mm
  • Tooth-to-tooth angle = 360/21 = 17.143°
  • Radius to tangent across adjacent teeth = 11.5 × cos 17.143°/2 = 11.372 mm

An actual metal 21 tooth gear measures 22.87 mm across a diameter, dead on what those numbers predict: 11.5 + 11.372 = 22.872 mm.

So the bounding box will be 11.5 mm toward the tooth at 0° and 11.372 mm toward the gap at 180°. The offset will be half that, with the tooth at 0° sitting 0.063 mm too close to the origin. Gears with more teeth will have smaller errors.

Given that we’re dealing with a gear “machined” from plastic goo, that’s definitely close enough:

Mini-Lathe change gears - 1 mm - 45-50-45-60
Mini-Lathe change gears – 1 mm – 45-50-45-60

That’s an earlier version with the debossed legend.

The code can also generate stacked gears for the BC shaft in the middle:

Mini-lathe change gear - 42-55 tooth stacked - solid model
Mini-lathe change gear – 42-55 tooth stacked – solid model

In principle, the key locking the gears together isn’t needed and the bore could fit the inner shaft, rather than the keyed bushing, but then you’d (well, I’d) be at risk of losing the bushing + key in one easy operation.

So it’s better to go with the bushing:

Mini-Lathe change gears - stacked 50-42 - installed
Mini-Lathe change gears – stacked 50-42 – installed

Now, to cut some threads!

The OpenSCAD source code as a GitHub Gist:

Mini-Lathe Metric Threading: 42 Tooth Gear

Going from a 21 tooth gear to a 42 tooth gear means you must reduce the remaining train ratio by a factor of two for a given thread pitch. Here’s a 42-50-45-60 train, with the same -125 ppm error as the 21-50-60-40 train and no screw / washer clearance issues between the A screw and the C gear:

Mini-Lathe change gears - 1 mm - 45-50-45-60
Mini-Lathe change gears – 1 mm – 45-50-45-60

The original 60-40 CD pair has a 3:2 ratio, the 45-60 CD pair is 3:4, so that’s where the factor-of-two reduction happens.

The first pass at the solid model included a debossed legend:

Mini-lathe 42 tooth change gear - Slic3r
Mini-lathe 42 tooth change gear – Slic3r

With a printed gear in hand, I realized the legend must be embossed below the surface, so as not to rub against an adjacent gear; better modeling is in order.

The general idea is to set Inkscape’s (known-good) gear generator to the correct gear parameters (module 1 → 3.14 mm circular pitch, 20° pressure angle):

Inkscape Gear Generator dialog
Inkscape Gear Generator dialog

Save the outline as an SVG:

Inkscape Gear Generator result
Inkscape Gear Generator result

If you do like I did and neatly position the gear at the bottom-left origin, all SVG viewers will show only the Quadrant I arc, probably because Inkscape sets the SVG file to display it that way. I’ve made that mistake before and maybe, someday, I’ll remember.

Load the SVG into OpenSCAD, which will find the entire gear, no matter where it falls in the coordinate space, and spike it at the origin:

linear_extrude(8.0,center=false,convexity=5) 
 import(file="/the-source-directory/Mini-Lathe/Change Gear - 42 teeth.svg",center=true);

The linear_extrude( … center=false … ) keeps the bottom of the blank at Z=0. The import( … center=true … ) puts the 2D shape at the XY origin. Because OpenSCAD centers the bounding box, gears with an odd number of teeth will be ever so slightly off-center, which would matter a whole lot more in a fancier machine tool than a mini-lathe.

All of which produces a tidy 3D gear blank:

Mini-lathe change gear - 42 tooth - SVG import
Mini-lathe change gear – 42 tooth – SVG import

OpenSCAD ignores SVG holes, which isn’t a problem for me, because I’d rather punch the bore, keyway, and so forth programatically.

But that’s another story …

Nissan Fog Lamp: Arduino Firmware

The upcycled Nissan fog lamp now has a desk stand:

Nissan Fog Lamp - table mount
Nissan Fog Lamp – table mount

A knockoff Arduino Pro Mini atop a strip of foam tape drives the WS2812 RGB LEDs:

Nissan Fog Lamp - table mount interior
Nissan Fog Lamp – table mount interior

Next time, I’ll cut the wires another inch longer.

The firmware is a tidied-up version of the vacuum tube code, minus cruft, plus fixes, and generally better at doing what it does. The Pro Mini lacks a USB output, so this came from the same code running on a Nano:

14:44:04.169 -> Algorithmic Art
14:44:04.169 ->  RGB WS2812
14:44:04.169 -> Ed Nisley - KE4ZNU - April 2020
14:44:04.169 -> Lamp test: flash full-on colors
14:44:04.169 ->  color: 00ff0000
14:44:05.165 ->  color: 0000ff00
14:44:06.160 ->  color: 000000ff
14:44:07.155 ->  color: 00ffffff
14:44:08.151 ->  color: 00000000
14:44:09.180 -> Random seed: da98f7f6
14:44:09.180 -> Primes: 7 19 3
14:44:09.180 ->  Super cycle length: 199500 steps
14:44:09.180 -> Inter-pixel phase: 1 deg = 26 steps
14:44:09.180 ->  c: 0 Steps:  3500 Init:  1538 Phase:   2 deg PWM: 255
14:44:09.180 ->  c: 1 Steps:  9500 Init:  7623 Phase:   0 deg PWM: 255
14:44:09.213 ->  c: 2 Steps:  1500 Init:  1299 Phase:   6 deg PWM: 255
14:44:19.265 -> Color 2     steps 1500  at 15101    ms 50       TS 201     
14:45:34.293 -> Color 2     steps 1500  at 90136    ms 50       TS 1701    
14:45:43.085 -> Color 1     steps 9500  at 98940    ms 50       TS 1877    
14:45:47.332 -> Color 0     steps 3500  at 103192   ms 50       TS 1962    
14:46:49.324 -> Color 2     steps 1500  at 165170   ms 50       TS 3201  
… much snippage …
17:26:52.896 -> Color 2     steps 1500  at 9769584  ms 50       TS 195201  
17:28:07.926 -> Color 2     steps 1500  at 9844618  ms 50       TS 196701  
17:29:11.000 -> Color 0     steps 3500  at 9907697  ms 50       TS 197962  
17:29:22.974 -> Color 2     steps 1500  at 9919653  ms 50       TS 198201  
17:30:27.941 -> Supercycle end, setting new color values
17:30:27.941 -> Primes: 17 7 3
17:30:27.941 ->  Super cycle length: 178500 steps
17:30:27.941 -> Inter-pixel phase: 1 deg = 23 steps
17:30:27.941 ->  c: 0 Steps:  8500 Init:  5415 Phase:   0 deg PWM: 255
17:30:27.974 ->  c: 1 Steps:  3500 Init:  3131 Phase:   2 deg PWM: 255
17:30:27.974 ->  c: 2 Steps:  1500 Init:   420 Phase:   5 deg PWM: 255
17:30:46.394 -> Color 1     steps 3500  at 10003091 ms 50       TS 369     
17:31:21.964 -> Color 2     steps 1500  at 10038658 ms 50       TS 1080  

The “Super cycle length” is the number of 50 ms steps until the colors start repeating, something over an hour in that sample. When the code reaches the end of the supercycle, it picks another set of three prime numbers, reinitializes the color settings, and away it goes.

The fog light looks pretty in action:

Nissan Fog Lamp - blue phase
Nissan Fog Lamp – blue phase

The four LEDs don’t produce the same light pattern as the halogen filament and they’re distinctly visible when you squint against the glare:

Nissan Fog Lamp - reflector LED detail
Nissan Fog Lamp – reflector LED detail

The shadow on the right comes from the larger hood support strut, the shadow on the left is the narrower strut, and the two other gaps show the beam angle gaps between the LEDs.

You’ll see plenty of residual sandpaper scratches on the lens: my surface (re)finishing hand is weak.

The LED beamwidth is so broad the “bulb” position inside the reflector doesn’t make much difference, particularly as it must, at most, wash a wall and ceiling at close range:

Nissan Fog Lamp - wall wash light
Nissan Fog Lamp – wall wash light

All in all, a much-needed dose of Quality Shop Time.

The Arduino source code as a GitHub Gist:

Nissan Fog Lamp: Desk Stand

The Nissan fog lamp looks pretty good pointing at the ceiling:

Nissan Fog Lamp - table mount
Nissan Fog Lamp – table mount

I briefly considered sandblasting the shell to knock back the corrosion, but came to my senses: this is art!

The shell has a bayonet mount intended for the cable connector, but a bout of solid modeling produced a matching twist-lock desk stand:

Nissan Fog Light Base - Slic3r preview
Nissan Fog Light Base – Slic3r preview

The locking dogs overhang little enough, relative to their diameter, to let the thing build without internal supports. Took about three hours without any intervention at all.

The little hole matches up with the slot on the bottom holding a USB cable bringing power from a wall charger:

Nissan Fog Lamp - table mount interior
Nissan Fog Lamp – table mount interior

It’s a knockoff Arduino Pro Mini without the USB interface found on a Nano, so the USB data wires don’t connect to anything.

The base might look better under a layer of (black?) epoxy, although I’m definitely a fan of those brutalist 3D printed striations.

The OpenSCAD source code as a GitHub Gist:

Pickett 110-ES Circular Slide Rule Manual: Scanning Thereof

Having mostly finished futzing with the Homage Tektronix Circuit Computer, my Pickett 110-ES Circular Slide Rule once again came to mind:

Homage Tek CC vs Pickett 110ES colors
Homage Tek CC vs Pickett 110ES colors

Casual searching didn’t reveal an online copy of its manual, so here ya go:

After a cluestick whack, here’s a better-looking version made with ScanTailor, as installed from the normal Ubuntu repo:

There’s some backstory, of course …

I gimmicked a scanner fixture to align a pair of pages:

Pickett 110-ES Scanning Fixture
Pickett 110-ES Scanning Fixture

Yes, I destroyed the collectible value of my manual by removing two slightly rusted staples.

The black paper taped to the scanner lid prevents the type on the upper surface of the paper from producing dark blurs.

Set up XSane for batch scanning (one selection over each two-page spread), get a pipeline going (disassembly → face up → face down → reassembly), and eventually create 34 images named Scan-??.jpg. They’re in color, although it matters only for the rust stains around the staple holes, with the contrast stretched enough to make them mostly B&W.

Somehow, Pickett printed / cut half the sheets slightly off-kilter, so I rotated them -1° rotation to re-align the text. To simplify plucking the rotated pages out of the image, composite the spread atop a blank white background:

for i in $(seq -w 3 2 33) ; do composite -compose atop Scan-$i.jpg -size 2200x1400 -geometry +100+100 canvas:white -rotate -1 Comp-$i.jpg ; done

Rather than thinking too hard, do exactly the same thing to the other pages without rotation:

for i in $(seq -w 2 2 34) ; do composite -compose atop Scan-$i.jpg -size 2200x1400 -geometry +100+100 canvas:white -rotate 0 Comp-$i.jpg ; done

Each scanned image has two pages, so crop it into two files with names corresponding to the actual page numbers:

for i in $(seq 2 2 34) ; do convert -crop 960x1240+1050+110 Comp-$i.jpg Crop-$(( $i - 1 )).jpg ; done
for i in $(seq 3 2 34) ; do convert -crop 960x1240+130+110 Comp-$i.jpg Crop-$(( $i - 1 )).jpg ; done
for i in $(seq 3 2 33) ; do convert -crop 960x1240+1050+110 Comp-$i.jpg Crop-$(( 66 - $i )).jpg ; done
for i in $(seq 2 2 32) ; do convert -crop 960x1240+110+110 Comp-$i.jpg Crop-$(( 66 - $i )).jpg ; done

Fix the single-digit pages to simplify globbing later on:

rename 's/-/-0/' Crop-[1-9].jpg

A bit of tedious fixup for some truly misaligned sheets produced images with slightly different sizes, so composite all of them onto slightly larger backgrounds to avoid screwing up the PDF conversion:

mkdir Final
for f in Crop* ; do composite -compose atop $f -size 1000x1300 -geometry +10+10 canvas:white -Final/$f ; done

Then jam them into a PDF for convenience:

cd Final
convert Crop-C[12].jpg Crop-[0-6]*.jpg Crop-C[34].jpg "Pickett 110-ES Circular Slide Rule Manual.pdf"

You can print it six-up to a sheet to produce text just about the same size as the original manual. If you omit (blank) cover pages 2, 67, and 68, the whole thing fits neatly on 11 sheets of paper.

Someone with better facilities and more attention to detail can surely produce a better-looking result, but this will be better than nothing.

Vectorized Classic Tektronix Logo

The Tektronix Circuit Computer sports the most ancient of many Tektronix logos:

Tek CC Logo - scanned
Tek CC Logo – scanned

It’s a bitty thing, with the CRT about 0.7 inch long, scanned directly from my original Tek CC.

Import the PNG image into FreeCAD at 0.2 mm below the XY plane, resize it upward a smidge so the CRT is maybe 0.8 inch long, then trace “wires” all over it:

Tek Logo - FreeCAD tracing - overlay
Tek Logo – FreeCAD tracing – overlay

Given FreeCAD’s default gradient background, the wires definitely don’t stand out by themselves:

Tek Logo - FreeCAD tracing - vectors
Tek Logo – FreeCAD tracing – vectors

Several iterations later, the vectorized logo sits at the correct angle and distance from the origin at the center:

Tek Logo - FreeCAD tracing - rotated
Tek Logo – FreeCAD tracing – rotated

The cheerful colors correspond to various “groups” and make it easier to find errant vectors.

Rather than figure out how to coerce FreeCAD into converting wires into proper G-Code, export the vectors into a DXF file and slam it into DXF2GCODE:

Tek Logo - DXF2GCODE vectors
Tek Logo – DXF2GCODE vectors

Export as G-Code, iterate around the whole loop a few times to wring out the obvious mistakes, indulge in vigorous yak shaving, eventually decide it’s Good Enough™ for the moment.

Protip: set DFX2GCODE to put “0” digits before the decimal point to eliminate spaces between the coordinate axes and the numeric values which should not matter in the least, but which confuse NCViewer into ignoring the entire file.

Tinker the script running the GCMC source code to prepend the logo G-Code to the main file and it all comes out in one run:

Tek CC - with vectorized logo - cutting
Tek CC – with vectorized logo – cutting

That’s the top deck, laminated in plastic, affixed to a Cricut sticky mat on the MPCNC platform, ready for drag-knife cutting.

Assembled with a snappy red hairline:

Tek CC - Classic Tek Logo vectorized - red hairline
Tek CC – Classic Tek Logo vectorized – red hairline

Isn’t it just the cutest thing you’ve seen in a while?

It needs more work, but it’s pretty close to right.

Fu Mask Cutting Templates

A local hospital contacted Mary’s quilting group to sew up cloth covers to prolong the life of their medical-grade N95 masks. Their recommended pattern, the Fu Face Mask from the FreeSewing group, comes in three sizes:

Freesewing - Fu Mask
Freesewing – Fu Mask

N.B.: Use their original PDF, because a JPG picture probably won’t come out at the right size.

Also N.B.: Used by itself, this is not a medical-grade filter mask.

The patterns do not include the usual 1/4 inch seam allowance around the outside, so I cranked out 3D printed plastic cutting templates.

If you’re not interested in 3D printing, 2D print the PDF file on cardboard, sketch a seam allowance, and cut it out, as quilters have been doing since slightly after home printers happened.

The plan of attack:

  • Convert mask outlines into a bitmap image (GIMP)
  • Create Bezier curves by tracing outlines (Inkscape)
  • Save curves as SVG files
  • Convert SVG into solid model (OpenSCAD)
  • Add stiffening ribs &c
  • Save as STL solid model
  • Slice into G-Code file (Slic3r)
  • Fire the M2!

So, we begin …

Import the PDF into The GIMP, delete the text & suchlike, convert to monochrome, and save the pattern outlines as a PNG file:

Fu Facemask - outlines
Fu Facemask – outlines

It turns out Inkscape can directly import the PDF, but it valiantly tries to convert all the text and the incidental graphic elements, none of which will be useful in this situation. It’s easier to delete them in The GIMP and make a bank shot off a PNG file.

Import the PNG into Inkscape and trace one outline with the Bezier curve tool:

Fu Mask - Inkscape Bezier trace
Fu Mask – Inkscape Bezier trace

If you squint really carefully, you’ll see Bezier control handles sticking out of the nodes. I laid three nodes along the top arc and four along the right side, but do what’cha like; the Insert key or Shift+I inserts and Delete removes nodes. It’s easier to center a node in the middle of the PNG line with snapping turned off: Shift+drag while mousing or globally with #.

You could unleash the bitmap auto-tracer, but it generates a bazillion uselessly tiny Bezier curves.

When you’re happy, select and copy the path with Ctrl+C, paste it into a shiny new Inkscape document (Ctrl+N) with Ctrl-V, save it with a catchy file name like Fu Mask - Small - nominal.svg, and close that document to return to the document with the PNG outlines and the original path.

Select the original path again, create a dynamic offset with Ctrl+J, open the XML editor with Ctrl+Shift+X (which automagically selects the proper SVG element), and change the inkscape:radius value from 0 to 6.35 (mm, which everyone should use) to get a 1/4 inch seam allowance:

Fu Mask - Inkscape XML Editor - Offset radius
Fu Mask – Inkscape XML Editor – Offset radius

The path will puff out with curved corners:

Fu Mask - Inkscape offset
Fu Mask – Inkscape offset

Copy into a new document, save as Fu Mask - Small - seam allowance.svg, and close.

Repeat that process for each of the three mask sizes to create three pairs of SVG files: the nominal mask outline and the corresponding seam allowance outline for each size.

The OpenSCAD program imports the SVG files, removes the nominal outline from within the seam allowance to leave the outline, adds stiffening ribs, and stamps an ID letter on both sides of the central button:

Fu Mask Cutting Template - Small - solid model
Fu Mask Cutting Template – Small – solid model

Choose one of the three sizes with the OpenSCAD customizer, save the resulting model as an STL file, repeat for the three sizes, and you’re done.

This process can convert any outline paths in SVG files into cutting templates, so, should the Fu Mask not suit your fancy, Use The Source.

For convenience, the STL files are on Thingiverse.

From the comments, a Washington hospital uses a similar pattern: their PDF with assembly instructions.

The OpenSCAD source code as a GitHub Gist:

Verily, there’s nothing like a good new problem to take your mind off all your old problems …