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.

Author: Ed

  • Amazon Unit Price Anomalies

    Backstory: we get Kirkland almond butter from Amazon, because it has consistently good quality at a reasonable price. Kirkland being the Costco house brand, we’re obviously buying it from someone arbitraging the Costco price. The nearest Costco is over an hour away, so spending $60 for a membership (*) just to get almond butter doesn’t make sense.

    However, I’ve discovered Amazon’s “buy it again” prompting generally doesn’t offer the best deal, so I start each purchase cycle with a general search. The current results proved interesting (clicky for more dots):

    Amazon - unit pricing FAIL
    Amazon – unit pricing FAIL

    Let’s go through this slowly.

    The first result shows the “unit pricing” isn’t done automatically, because it’s completely wrong:

    Amazon - unit pricing puzzle
    Amazon – unit pricing puzzle

    I can figure half of $27.52 isn’t $9.17, but dividing $27.52 by three really is. Dividing by two, the actual size, says the correct “unit price” is $13.76 each. Oddly, searching a day later showed the price went up to $28.69, with the same incorrect divide-by-three unit pricing error.

    The “Amazon’s Choice” result simply means a bunch of people bought from that listing, not that Amazon has an actual involvement apart from raking in their take. There’s no unit pricing, but each jar works out to $13.59.

    The last result confirms Amazon’s unit pricing bogosity by (correctly!) dividing $26.23 by two, but then claiming the unit price is “per ounce”.

    Weirdly, everybody selling the two-pack prices it that way:

    Amazon - unit pricing consistent FAIL
    Amazon – unit pricing consistent FAIL

    We’re surely not looking at half a dozen heads of the same hydra, so this bogosity derives from the commingled UPC (ASIN, whatever) warehouse stock technique giving Amazon a way to avoid responsibility for counterfeits. Somebody (presumably at Amazon) selected the calculation to produce the unit price, but fat-fingered “per ounce” rather than “per each”, and now vendors just bid for that UPC without sweating the details.

    You’d (well, I’d) think a bit of Amazon’s much-vaunted machine learning would go a long way toward sorting this out, but it doesn’t.

    Word: any sufficiently advanced stupidity is indistinguishable from malice.

    (*) Right now, it’s $8.79 direct from Costco online and their 5% non-member surcharge seems survivable.

  • American Standard Kitchen Faucet: Ceramic Valve Cores

    The  ceramic valve core from our kitchen faucet certainly qualifies for a spot on the bottom flange of the I-beam across our basement serving as a display case / collection area for shop curiosities, mementos, and the like. I am, if nothing else, a creature of fixed habits, because the spot where the core belonged already had one:

    American Standard Ceramic Faucet Valve Cores - old vs new
    American Standard Ceramic Faucet Valve Cores – old vs new

    The core on the left dates back to the 2016 replacement, so they’ve apparently decided plastic will work fine for the handle socket.

    Having the ceramic core fail after two years suggests the manufacturing process needs attention, though. I can still wring the slabs together, though, and they’d need a drop of oil to serve as bearing surfaces.

     

     

  • MPCNC: Acrylic Engraving First Light

    Just to see what happened, I chucked a drag knife in the collet pen holder:

    MPCNC Collet Pen Holder - drag knife
    MPCNC Collet Pen Holder – drag knife

    The blade, being fixed in the collet and lashed to the adapter, doesn’t rotate: it’s not behaving as a true drag knife.

    Twiddling the cut depth to about 0.2 mm produced a credible Guilloché pattern in some scrap acrylic:

    MPCNC Collet Pen Holder - drag engraved acrylic - 0.2 mm depth
    MPCNC Collet Pen Holder – drag engraved acrylic – 0.2 mm depth

    The sidelight comes from an LED flashlight off to the side, with a bit of contrast tweaking to suppress the workbench clutter.

    The MPCNC’s lack of rigidity produces visible jitters in the Guilloché pattern and backlash makes the characters somewhat wobbly, but it’s OK for a large and inexpensive CNC gantry machine.

    A brace of diamond-point engraving bits are making their way around the planet even as I type. A symmetric 60° point may reduce the swarf thrown out by the drag knife, although it surely won’t improve the overall jitter and backlash.

     

  • GCMC Guilloche Plot Generator

    It turns out the Spirograph patterns I’d been using to wring out the MPCNC are also known as Guilloché, perhaps after the guy who invented a lathe-turning machine to engrave them. Sounds pretentious, but they still look nice:

    Guilloche 591991062 - scanned
    Guilloche 591991062 – scanned

    With the ballpoint pen / knife collet holder in mind, I stripped the tool changes out of the Spirograph generator GCMC source code, set the “paper size” to a convenient 100 mm square, and tidied up the code a bit.

    As with Spirograph patterns, changing the random number seed produces entirely different results. A collection differing in the last digit, previewed online:

    Seed = 213478836:

    Guilloche 213478836
    Guilloche 213478836

    Seed = 213478837:

    Guilloche 213478837
    Guilloche 213478837

    Seed = 213478838:

    Guilloche 213478838
    Guilloche 213478838

    Seed = 213478839:

    Guilloche 213478839
    Guilloche 213478839

    They’re such unique snowflakes …

    The Bash script now accepts a single parameter to force the PRNG seed to a value you presumably want to plot again, rather than just accept whatever the Gods of Cosmic Jest will pick for you.

    The GCMC source code and Bash (or whatever) script feeding it as a GitHub Gist:

    // Spirograph simulator for MPCNC used as plotter
    // Ed Nisley KE4ZNU – 2017-12-23
    // Adapted for Guillioche plots with ball point pens – 2018-09-25
    // Spirograph equations:
    // https://en.wikipedia.org/wiki/Spirograph
    // Loosely based on GCMC cycloids.gcmc demo:
    // https://gitlab.com/gcmc/gcmc/tree/master/example/cycloids.gcmc
    // Required command line parameters:
    // -D Pen=n pen selection, 0 = no legend, 1 = current pen
    // -D PaperSize=[x,y] overall sheet size: [17in,11in]
    // -D PRNG_Seed=i non-zero random number seed
    include("tracepath.inc.gcmc");
    include("engrave.inc.gcmc");
    //—–
    // Greatest Common Divisor
    // https://en.wikipedia.org/wiki/Greatest_common_divisor#Using_Euclid's_algorithm
    // Inputs = integers without units
    function gcd(a,b) {
    if (!isnone(a) || isfloat(a) || !isnone(b) || isfloat(b)) {
    warning("GCD params must be dimensionless integers:",a,b);
    }
    local d = 0; // power-of-two counter
    while (!((a | b) & 1)) { // remove and tally common factors of two
    a >>= 1;
    b >>= 1;
    d++;
    }
    while (a != b) {
    if (!(a & 1)) {a >>= 1;} // discard non-common factor of 2
    elif (!(b & 1)) {b >>= 1;} // … likewise
    elif (a > b) {a = (a – b) >> 1;} // gcd(a,b) also divides a-b
    else {b = (b – a) >> 1;} // … likewise
    }
    local GCD = a*(1 << d); // form gcd
    // message("GCD: ",GCD);
    return GCD;
    }
    //—–
    // Max and min functions
    function max(x,y) {
    return (x > y) ? x : y;
    }
    function min(x,y) {
    return (x < y) ? x : y;
    }
    //—–
    // Pseudo-random number generator
    // Based on xorshift:
    // https://en.wikipedia.org/wiki/Xorshift
    // http://www.jstatsoft.org/v08/i14/paper
    // Requires initial state from calling script
    // -D "PRNG_Seed=whatever"
    // You can get nine reasonably random digits from $(date +%N)
    function XORshift() {
    local x = PRNG_State;
    x ^= x << 13;
    x ^= x >> 17;
    x ^= x << 5;
    PRNG_State = x;
    return x;
    }
    //—–
    // Spirograph tooth counts mooched from:
    // http://nathanfriend.io/inspirograph/
    // Stators includes both inside and outside counts, because we're not fussy
    Stators = [96, 105, 144, 150];
    Rotors = [24, 30, 32, 36, 40, 45, 48, 50, 52, 56, 60, 63, 64, 72, 75, 80, 84];
    //—–
    // Start drawing things
    // Set initial parameters from command line!
    comment("PRNG seed: ",PRNG_Seed);
    PRNG_State = PRNG_Seed;
    // Define some useful constants
    AngleStep = 2.0deg;
    Margins = [12mm,12mm] * 2;
    comment("Paper size: ",PaperSize);
    PlotSize = PaperSize – Margins;
    comment("PlotSize: ",PlotSize);
    //—–
    // Set up gearing
    s = (XORshift() & 0xffff) % count(Stators);
    StatorTeeth = Stators[s];
    comment("Stator ",s,": ",StatorTeeth);
    r = (XORshift() & 0xffff) % count(Rotors);
    RotorTeeth = Rotors[r];
    comment("Rotor ",r,": ",RotorTeeth);
    GCD = gcd(StatorTeeth,RotorTeeth); // reduce teeth to ratio of least integers
    comment("GCD: ",GCD);
    StatorN = StatorTeeth / GCD;
    RotorM = RotorTeeth / GCD;
    L = to_float((XORshift() & 0x3ff) – 512) / 100.0; // normalized pen offset in rotor
    comment("Offset: ", L);
    sgn = sign((XORshift() & 0xff) – 128);
    K = sgn*to_float(RotorM) / to_float(StatorN); // normalized rotor dia
    comment("Dia ratio: ",K);
    Lobes = StatorN; // having removed all common factors
    Turns = RotorM;
    comment("Lobes: ", Lobes);
    comment("Turns: ", Turns);
    //—–
    // Crank out a list of points in normalized coordinates
    Path = {};
    Xmax = 0.0;
    Xmin = 0.0;
    Ymax = 0.0;
    Ymin = 0.0;
    for (a = 0.0deg ; a <= Turns*360deg ; a += AngleStep) {
    x = (1 – K)*cos(a) + L*K*cos(a*(1 – K)/K);
    if (x > Xmax) {Xmax = x;}
    elif (x < Xmin) {Xmin = x;}
    y = (1 – K)*sin(a) – L*K*sin(a*(1 – K)/K);
    if (y > Ymax) {Ymax = y;}
    elif (y < Ymin) {Ymin = y;}
    Path += {[x,y]};
    }
    //message("Max X: ", Xmax, " Y: ", Ymax);
    //message("Min X: ", Xmin, " Y: ", Ymin); // min will always be negative
    Xmax = max(Xmax,-Xmin); // odd lobes can cause min != max
    Ymax = max(Ymax,-Ymin); // … need really truly absolute maximum
    //—–
    // Scale points to actual plot size
    PlotScale = [PlotSize.x / (2*Xmax), PlotSize.y / (2*Ymax)];
    comment("Plot scale: ", PlotScale);
    Points = scale(Path,PlotScale); // fill page, origin at center
    //—–
    // Start drawing lines
    feedrate(1500.0mm);
    TravelZ = 1.5mm;
    PlotZ = -1.0mm;
    //—–
    // Box the outline for camera alignment
    goto([-,-,TravelZ]);
    goto([-PaperSize.x/2,-PaperSize.y/2,-]);
    goto([-,-,PlotZ]);
    foreach ( {[-1,1], [1,1], [1,-1], [-1,-1]} ; pt) {
    move([pt.x*PaperSize.x/2,pt.y*PaperSize.y/2,-]);
    }
    goto([-,-,TravelZ]);
    //—–
    // Draw the plot
    tracepath(Points, PlotZ);
    //—–
    // Add legends
    // … only for nonzero Pen
    if (Pen) {
    feedrate(250mm);
    TextFont = FONT_HSANS_1_RS;
    TextSize = [2.5mm,2.5mm];
    TextLeading = 1.5; // line spacing as multiple of nominal text height
    line1 = typeset("Seed: " + PRNG_Seed + " Stator: " + StatorTeeth + " Rotor: " + RotorTeeth,TextFont);
    line2 = typeset("Offset: " + L + " GCD: " + GCD + " Lobes: " + Lobes + " Turns: " + Turns,TextFont);
    maxlength = TextSize.x * max(line1[-1].x,line2[-1].x);
    textpath = line1 + (line2 – [-, TextLeading, -]); // undef – n -> undef to preserve coordinates
    textorg = [-maxlength/2,PaperSize.y/2 – 0*Margins.y/2 – 2*TextLeading*TextSize.y/2];
    placepath = scale(textpath,TextSize) + textorg;
    comment("Legend begins");
    engrave(placepath,TravelZ,PlotZ);
    attrpath = typeset("Ed Nisley – KE4ZNU – softsolder.com",TextFont);
    attrorg = [-(TextSize.x * attrpath[-1].x)/2,-(PaperSize.y/2 – Margins.y/2 + 2*TextLeading*TextSize.y)];
    placepath = scale(attrpath,TextSize) + attrorg;
    comment("Attribution begins");
    engrave(placepath,TravelZ,PlotZ);
    }
    goto([PaperSize.x/2,PaperSize.y/2,25.0mm]); // done, so get out of the way
    view raw Guilloche.gcmc hosted with ❤ by GitHub
    # Guilloche G-Code Generator
    # Ed Nisley KE4ZNU – September 2018
    Paper='PaperSize=[100mm,100mm]'
    Flags="-P 2"
    LibPath="-I /opt/gcmc/library"
    Spirograph='/mnt/bulkdata/Project Files/Mostly Printed CNC/Patterns/Guilloche.gcmc'
    Prolog="/home/ed/.config/gcmc/prolog.gcmc"
    Epilog="/home/ed/.config/gcmc/epilog.gcmc"
    ts=$(date +%Y%m%d-%H%M%S)
    if [ -n "$1" ] # if parameter
    then
    rnd=$1 # .. use it
    else
    rnd=$(date +%N) # .. otherwise use nanoseconds
    fi
    fn='Guilloche_'${ts}_$rnd'.ngc'
    echo Output: $fn
    p=1
    rm -f $fn
    echo "(File: "$fn")" > $fn
    #cat $Prolog >> $fn
    gcmc -D Pen=$p -D $Paper -D PRNG_Seed=$rnd $Flags $LibPath -G $Prolog -g $Epilog "$Spirograph" >> $fn
    #cat $Epilog >> $fn
    view raw guilloche.sh hosted with ❤ by GitHub
  • MPCNC: Modified Drag Knife Adapter Spring Constant

    The bars on the original MPCNC drag knife / plotter pen adapter had a 100 g/mm spring constant:

    MPCNC - Plotter pen force test
    MPCNC – Plotter pen force test

    Making the bars slightly thicker improved their print-ability:

    MPCNC knife adapter mods - OpenSCAD model
    MPCNC knife adapter mods – OpenSCAD model

    The reddish tint marks the new bars, with their location carefully tweaked to be coincident with the stock STL.

    Shoving the pen into the scale with 0.1 mm steps produces another unnervingly linear plot:

    Modified MPCNC pen adapter - Spring Constant data
    Modified MPCNC pen adapter – Spring Constant data

    Real plotter pens want about 20 g of force, so this isn’t the holder you’re looking for.

    A bunch of plots at Z=-1.0 mm turned out well with the ballpoint pen insert, though:

    MPCNC Modifed pen adapter - first plots
    MPCNC Modifed pen adapter – first plots

    The globs apparently come from plotting too fast for conditions; reducing the speed to 1500 mm/min works better.

  • MPCNC: Modified Drag Knife Adapter

    A trio of Cutter Cutting Plotter Blade Holders arrived:

    Collet pen holder
    Collet pen holder

    Despite the name, they’re not well-suited for drag knife blades, because they’re collets gripping a 2 mm shaft. The blade doesn’t rotate unless the plotter / cutter rotates the entire holder, which is actually a thing.

    I got ’em because the snout of a common ball-point pen refill measures about 2 mm:

    Collet pen holder - detail
    Collet pen holder – detail

    The glob around the tip comes from plotting too fast for conditions; about 1500 mm/min works better for continuous lines and 250 mm/min improves text.

    The stock MPCNC adapter has a single recess suited for Genuine Plotter Pens, but the knurled lock ring on these cheapies sticks out far enough to make them wobbly. This being an inconvenience up with which I need not put, a few lines of OpenSCAD tweak the stock STL:

    MPCNC knife adapter mods - OpenSCAD model
    MPCNC knife adapter mods – OpenSCAD model

    The original STL is ivory, new cuts are cyan, and additions are reddish.

    The two support beams are now 1.6 mm = four thread widths, for improved slicing with a 0.35 mm nozzle and a higher spring constant.

    It’s by-and-large indistinguishable from the old adapter:

    MPCNC - Pen Holder Detail
    MPCNC – Pen Holder Detail

    Which I was using upside-down, because the flange fit better.

    The MPCNC works reasonably well as a pen plotter with a genuine ballpoint pen:

    MPCNC Ballpoint pen plots
    MPCNC Ballpoint pen plots

    The OpenSCAD source code as a GitHub Gist:

    // Adding clearance for eBay collet pen holder
    MPCNC_OD = 12.0; // pen holder OD (matches STL curvature)
    MPCNC_Z = 8.9; // Z offset of pen axis
    Pen_OD = 11.5; // actual pen body OD
    ID = 0;
    OD = 1;
    LENGTH = 2;
    Flange = [11.5,15.7,2.2]; // actual pen body flange
    Locknut = [16.0,16.0,2.8]; // knurled locknut
    Locknut_Offset = 4.5; // flange center to locknut
    Wall = [41.0,4 * 0.4,9.0]; // thicker walls for more spring and better fill
    $fn = 32; // default cylinder sides
    difference() {
    translate([-(101.3 + MPCNC_OD/2),-111.9,0]) // put pen axis above Y axis, flange centered on X axis
    import("/mnt/bulkdata/Project Files/Mostly Printed CNC/Accessories/Tool Holders/MPCNC_525_Drag_Knife-1860310.STL",
    convexity=5);
    if (true) // improve holder-to-mount fit if needed
    translate([0,60/2,8.90])
    rotate([90,0,0])
    cylinder(d=MPCNC_OD,h=60);
    translate([0,0,MPCNC_Z]) // improve flange slot clearance
    rotate([90,0,0])
    cylinder(d=Flange[OD] + 1.0,h=Flange[LENGTH] + 0.5,center=true);
    translate([0,Locknut_Offset – 0.5,MPCNC_Z]) // add locknut clearance
    rotate([-90,0,0])
    cylinder(d=Locknut[OD] + 1.5,h=Locknut[LENGTH] + 1.5,center=false);
    }
    # translate([-(27.0 + Wall.x/2),0,0]) { // embiggen walls for higher spring constant
    translate([0,-24.4,0])
    cube(Wall);
    translate([0,20.6 – Wall.y,0])
    cube(Wall);
    }
  • Long-lived CFL Bulb

    This compact fluorescent lamp seems to have survived nearly two decades of use in a desk lamp:

    Desk Lamp - long lived CFL
    Desk Lamp – long lived CFL

    It had plenty of starts, although maybe not so many total hours, as the other CFLs you’ll find mentioned around here.

    I swapped in a similar CFL and we’ll see what happens.