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.

Category: Software

General-purpose computers doing something specific

  • CNC 3018-Pro: Diamond Drag Engraving Test Disk

    The smaller and more rigid CNC 3018-Pro should be able to engrave text faster than the larger and rather springy MPCNC, which could engrave text at about 50 mm/min. This test pattern pushes both cutting depth and engraving speed to absurd values:

    Engraving Test Pattern - 2019-09-18
    Engraving Test Pattern – 2019-09-18

    Compile the GCMC source to generate G-Code, lash a CD / DVD to the platform (masking tape works fine), touch off the XY coordinates in the center, touch off Z=0 on the surface, then see what happens:

    CNC 3018-Pro - Engraving test pattern - curved text
    CNC 3018-Pro – Engraving test pattern – curved text

    The “engraving depth” translates directly into the force applied to the diamond point, because the spring converts displacement into force. Knowing the Z depth, you can calculate or guesstimate the force.

    Early results from the 3018 suggest it can engrave good-looking text about 20 times faster than the MPCNC:

    CNC 3018-Pro - Engraving - speeds
    CNC 3018-Pro – Engraving – speeds

    You must trade off speed with accuracy on your very own machine, as your mileage will certainly differ!

    The GCMC source code as a GitHub Gist:

    // Engraving test piece
    // Ed Nisley KE4ZNU – 2019-09
    //—–
    // Command line parameters
    // -D OuterDia=number
    if (!isdefined("OuterDia")) {
    OuterDia = 120mm – 2mm; // CD = 120, 3.5 inch drive = 95
    }
    OuterRad = OuterDia / 2.0;
    comment("Outer Diameter: ",OuterDia);
    comment(" Radius: ",OuterRad);
    //—–
    // Library routines
    include("tracepath.inc.gcmc");
    include("engrave.inc.gcmc");
    //—–
    // Bend text around an arc
    function ArcText(TextPath,Center,Radius,BaseAngle,Align) {
    PathLength = TextPath[-1].x;
    Circumf = 2*pi()*Radius;
    TextAngle = to_deg(360 * PathLength / Circumf);
    AlignAngle = BaseAngle + (Align == "Left" ? 0 :
    Align == "Center" ? -TextAngle / 2 :
    Align == "Right" ? -TextAngle :
    0);
    ArcPath = {};
    foreach(TextPath; pt) {
    if (!isundef(pt.x) && !isundef(pt.y) && isundef(pt.z)) { // XY motion, no Z
    r = Radius – pt.y;
    a = 360deg * (pt.x / Circumf) + AlignAngle;
    ArcPath += {[r*cos(a) + Center.x, r*sin(a) + Center.y,-]};
    }
    elif (isundef(pt.x) && isundef(pt.y) && !isundef(pt.z)) { // no XY, Z up/down
    ArcPath += {pt};
    }
    else {
    error("Point is not pure XY or pure Z: " + to_string(pt));
    }
    }
    return ArcPath;
    }
    //—–
    // Set up for drawing
    SafeZ = 10.0mm; // above clamps and screws
    TravelZ = 1.0mm; // above workpiece
    PlotZ = -0.5mm; // tune for best results
    TextSpeed = 1000mm; // intricate detail
    DrawSpeed = 2000mm; // smooth curves
    TextFont = FONT_HSANS_1_RS;
    TextSize = [2.0mm,2.0mm];
    TextLeading = 2*TextSize.y; // line spacing
    DiskCenter = [0mm,0mm]; // middle of the platter
    InnerDia = 40mm;
    InnerRad = InnerDia / 2.0;
    comment("Inner Diameter: ",InnerDia);
    comment(" Radius: ",InnerRad);
    NumRings = ceil((OuterRad – (InnerRad + TextLeading))/TextLeading); // number of rings to draw
    comment("Numer of rings: ",NumRings);
    if (1) {
    comment("Text Size begins");
    feedrate(TextSpeed);
    ts = "Text size: " + to_string(TextSize);
    tp = scale(typeset(ts,TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,OuterRad,90deg,"Left");
    engrave(tpa,TravelZ,PlotZ);
    }
    if (1) {
    comment("Depth variations begin");
    TextRadius = OuterRad;
    pz = 0.0mm;
    repeat(NumRings ; i) {
    comment(" depth: " + to_string(pz));
    feedrate(TextSpeed);
    ts = "Depth: " + to_string(pz) + " at " + to_string(TextSpeed) + "/min";
    tp = scale(typeset(ts,TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,TextRadius,-5deg,"Right");
    engrave(tpa,TravelZ,pz);
    feedrate(DrawSpeed);
    goto([0,-TextRadius,-]);
    move([-,-,pz]);
    arc_ccw([-TextRadius,0,-],-TextRadius);
    goto([-,-,TravelZ]);
    feedrate(TextSpeed);
    tp = scale(typeset("Rad: " + to_string(TextRadius),TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,TextRadius,180deg,"Right");
    engrave(tpa,TravelZ,PlotZ);
    TextRadius -= TextLeading;
    pz -= 0.10mm;
    }
    }
    if (1) {
    comment("Feedrate variations begin");
    TextRadius = OuterRad;
    ps = 250mm;
    repeat(NumRings ; i) {
    comment(" speed: " + to_string(ps) + "/min");
    feedrate(ps);
    ts = "Speed: " + to_string(ps) + "/min at " + to_string(PlotZ);
    tp = scale(typeset(ts,TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,TextRadius,5deg,"Left");
    engrave(tpa,TravelZ,PlotZ);
    TextRadius -= TextLeading;
    ps += 250mm;
    }
    }
    if (1) {
    comment("Off-center text arcs begin");
    feedrate(TextSpeed);
    tc = [-40mm/sqrt(2),-40mm/sqrt(2)]; // center point
    r = 3mm;
    s = [0.5mm,0.5mm];
    ts = "Radius: " + to_string(r) + " Size: " + to_string(s);
    tp = scale(typeset(ts,TextFont),s);
    tpa = ArcText(tp,tc,r,0deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    r = 5mm;
    s = [1.0mm,1.0mm];
    ts = "Radius: " + to_string(r) + " Size: " + to_string(s);
    tp = scale(typeset(ts,TextFont),s);
    tpa = ArcText(tp,tc,r,0deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    r = 8mm;
    s = [1.5mm,1.5mm];
    ts = "Radius: " + to_string(r) + " Size: " + to_string(s);
    tp = scale(typeset(ts,TextFont),s);
    tpa = ArcText(tp,tc,r,0deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    r = 15mm;
    s = [3.0mm,3.0mm];
    ts = "Radius: " + to_string(r) + " Size: " + to_string(s);
    tp = scale(typeset(ts,FONT_HSCRIPT_2),s);
    tpa = ArcText(tp,tc,r,0deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    }
    if (1) {
    comment("Attribution begins");
    feedrate(TextSpeed);
    tp = scale(typeset("Ed Nisley – KE4ZNU – softsolder.com",TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,15mm,0deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    tp = scale(typeset("Engraving Test Disc",TextFont),TextSize);
    tpa = ArcText(tp,DiskCenter,15mm,180deg,"Center");
    engrave(tpa,TravelZ,PlotZ);
    }
    goto([-,-,SafeZ]);
    goto([0mm,0mm,-]);
    comment("Done!");
    #!/bin/bash
    # Engraving test pattern generator
    # Ed Nisley KE4ZNU – 2019-08
    Diameter='OuterDia=116mm'
    Flags='-P 3 –pedantic'
    # Set these to match your file layout
    LibPath='/opt/gcmc/library'
    Prolog='/mnt/bulkdata/Project Files/CNC 3018-Pro Router/Patterns/gcmc/prolog.gcmc'
    Epilog='/mnt/bulkdata/Project Files/CNC 3018-Pro Router/Patterns/gcmc/epilog.gcmc'
    Script='/mnt/bulkdata/Project Files/CNC 3018-Pro Router/Patterns/Engraving Test.gcmc'
    ts=$(date +%Y%m%d-%H%M%S)
    fn='TestPattern_'${ts}'.ngc'
    echo Output: $fn
    rm -f $fn
    echo "(File: "$fn")" > $fn
    /opt/gcmc/src/gcmc -D $Diameter $Flags \
    –include "$LibPath" –prologue "$Prolog" –epilogue "$Epilog" \
    "$Script" >> $fn

  • CNC 3018-Pro: Tape-Down Platter Fixture

    Diamond drag engraving doesn’t put much sideways force on the platters, so taping the CD in place suffices to hold it:

    CNC 3018-Pro - CD taped to platform
    CNC 3018-Pro – CD taped to platform

    Wrapping a flange around the screw-down platter fixture provides plenty of surface area for tape:

    Platter Fixtures - CD on 3018 - tape flange
    Platter Fixtures – CD on 3018 – tape flange

    Which looks exactly as you think it would in real life:

    CNC 3018-Pro - CD fixture - taped
    CNC 3018-Pro – CD fixture – taped

    Admittedly, masking tape doesn’t look professional, but it’s low-profile, cheap and works perfectly. Blue painter’s tape for the “permanent” hold-down strips on the platform would be a colorful upgrade.

    It’s centered on the platform at the XY=0 origin in the middle of the XY travel limits, with edges aligned parallel to the axes. Homing the 3018 and moving to XY=0 puts the tool point directly over the center of the CD without any fussy alignment.

    The blue-and-red rings around the center hole assist probe camera alignment, whenever that’s necessary.

    The OpenSCAD source code as a GitHub Gist:

    // Machining fixtures for CD and hard drive platters
    // Ed Nisley KE4ZNU February … September 2016
    // 2019-08 split from tube base models
    PlatterName = "CD"; // [3.5inch,CD]
    CNCName = "3018"; // [3018,Sherline]
    TapeFlange = true; // Generate tape attachment
    PlateThick = 5.0; // [3.0,5.0,10.0,15.0]
    RecessDepth = 4.0; // [0.0,2.0,4.0]
    //- Extrusion parameters must match reality!
    /* [Hidden] */
    ThreadThick = 0.25;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    Protrusion = 0.1; // make holes end cleanly
    inch = 25.4;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(d=(FixDia + HoleWindage),h=Height,$fn=Sides);
    }
    ID = 0;
    OD = 1;
    LENGTH = 2;
    //———————-
    // Dimensions
    P_NAME = 0; // platter name
    P_ID = 1; // … inner diameter
    P_OD = 2; // … outer diameter
    P_THICK = 3; // … thickness
    PlatterData = [
    ["3.5inch", 25.0, 95.0, 1.75],
    ["CD", 15.0, 120.0, 1.20],
    ];
    PlatterSides = 3*4*5; // polygon approximation
    B_NAME = 0; // machine name
    B_OC = 1; // … platform screw OC, use small integer for slot
    B_STUD = 2; // … screw OD clearance
    BaseData = [
    ["3018", [5.0, 45.0], 6.0], // slots along X axis
    ["Sherline", [1.16*inch,1.16*inch], 5.0], // tooling plate
    ];
    PlateRound = 10.0; // corner radius
    FlangeSize = [5.0,5.0,3*ThreadThick]; // all-around tape flange
    //– calculate values based on input parameters
    PI = search([PlatterName],PlatterData,1,0)[P_NAME]; // get platter index
    echo(str("Platter: ",PlatterName));
    Platter = [PlatterData[PI][P_ID],
    PlatterData[PI][P_OD],
    PlatterData[PI][P_THICK]];
    BI = search([CNCName],BaseData,1,0)[B_NAME]; // get base index
    echo(str("Machine: ",CNCName));
    AlignOC = IntegerMultiple(Platter[OD],10);
    echo(str("Alignment pip offset: ±",AlignOC/2));
    AlignSlot = [3*ThreadWidth,10.0,3*ThreadThick];
    StudClear = BaseData[BI][B_STUD]; // … clearance
    StudOC = [IntegerMultiple(AlignOC + 2*StudClear,BaseData[BI][B_OC].x), // … screw spacing
    BaseData[BI][B_OC].y];
    echo(str("Stud spacing: ",StudOC));
    NumStuds = [2,1 + 2*floor(Platter[OD] / StudOC.y)]; // holes only along ±X edges
    echo(str("Stud holes: ",NumStuds));
    BasePlate = [(20 + StudOC.x*ceil(Platter[OD] / StudOC.x)),
    (10 + AlignOC),
    PlateThick];
    echo(str("Plate: ",BasePlate));
    Flange = [BasePlate.x + 2*FlangeSize.x,BasePlate.y + 2*FlangeSize.y,FlangeSize.z];
    echo(str("Flange: ",Flange));
    //———————-
    // Drilling fixture for disk platters
    module PlatterFixture() {
    difference() {
    union() {
    hull() // basic plate shape
    for (i=[-1,1], j=[-1,1])
    translate([i*(BasePlate.x/2 – PlateRound),j*(BasePlate.y/2 – PlateRound),0])
    cylinder(r=PlateRound,h=BasePlate.z,$fn=4*4);
    if (TapeFlange)
    hull()
    for (i=[-1,1], j=[-1,1])
    translate([i*(Flange.x/2 – PlateRound),
    j*(Flange.y/2 – PlateRound),
    0])
    cylinder(r=PlateRound,h=FlangeSize.z,$fn=4*4);
    }
    for (i=[-1,0,1], j=[-1,0,1]) // origin pips
    translate([i*AlignOC/2,j*AlignOC/2,BasePlate.z – 2*ThreadThick])
    cylinder(d=4*ThreadWidth,h=1,$fn=6);
    for (i=[-1,1], j=[-1,1]) { // alignment slots
    translate([i*(AlignOC + AlignSlot.x)/2,
    j*Platter[OD]/4,
    (BasePlate.z – AlignSlot.z/2 + Protrusion/2)])
    cube(AlignSlot + [0,0,Protrusion],center=true);
    translate([i*Platter[OD]/4,
    j*(AlignOC + AlignSlot.x)/2,
    (BasePlate.z – AlignSlot.z/2 + Protrusion/2)])
    rotate(90)
    cube(AlignSlot + [0,0,Protrusion],center=true);
    }
    for (i=[-1,1], j=[-floor(NumStuds.y/2):floor(NumStuds.y/2)]) // mounting stud holes
    translate([i*StudOC.x/2,j*StudOC.y/2,-Protrusion])
    rotate(180/6)
    PolyCyl(StudClear,BasePlate.z + 2*Protrusion,6);
    translate([0,0,-Protrusion]) // center clamp hole
    rotate(180/6)
    PolyCyl(StudClear,BasePlate.z + 2*Protrusion,6);
    translate([0,0,BasePlate.z – Platter[LENGTH]]) // disk locating recess
    rotate(180/PlatterSides)
    linear_extrude(height=(Platter[LENGTH] + Protrusion),convexity=2)
    difference() {
    circle(d=(Platter[OD] + 2*HoleWindage),$fn=PlatterSides);
    circle(d=Platter[ID] – HoleWindage,$fn=PlatterSides);
    }
    translate([0,0,BasePlate.z – RecessDepth]) // drilling recess
    rotate(180/PlatterSides)
    linear_extrude(height=(RecessDepth + Protrusion),convexity=2)
    difference() {
    circle(d=(Platter[OD] – 10),$fn=PlatterSides);
    circle(d=(Platter[ID] + 10),$fn=PlatterSides);
    }
    }
    }
    //———————-
    // Build it
    PlatterFixture();

  • CNC 3018-Pro: LM6UU Linear-bearing Diamond Drag Bit Holder

    The CNC 3018-Pro normally holds a small DC motor with a nicely cylindrical housing,so this was an easy adaptation of the MPCNC’s diamond drag bit holder:

    CNC 3018-Pro - Diamond bit - overview
    CNC 3018-Pro – Diamond bit – overview

    The lip around the bottom part rests atop the tool clamp, with the spring reaction plate sized to clear the notch in the Z-axis stage.

    The solid model looks about like you’d expect:

    Diamond Scribe - Mount - solid model
    Diamond Scribe – Mount – solid model

    The New Thing compared to the MPCNC holder is wrapping LM6UU bearings around an actual 6 mm shaft, instead of using LM3UU bearings for the crappy diamond bit shank:

    CNC 3018-Pro - Diamond bit - epoxy curing
    CNC 3018-Pro – Diamond bit – epoxy curing

    I cut the shank in two pieces, epoxied them into 3 mm holes drilled into the 6 mm shaft, then epoxied the knurled stop ring on the end. The ring is curing in the bench block to stay perpendicular to the 6 mm shaft.

    The spring constant is 55 g/mm and it’s now set for 125 g preload:

    CNC 3018-Pro - Diamond bit - force measurement
    CNC 3018-Pro – Diamond bit – force measurement

    A quick test says all the parts have begun flying in formation:

    CNC 3018-Pro - Diamond bit - test CD
    CNC 3018-Pro – Diamond bit – test CD

    It’s definitely more rigid than the MPCNC!

    The OpenSCAD source code as a GitHub Gist:

    // Diamond Scribe in linear bearings for CNC3018
    // Ed Nisley KE4ZNU – 2019-08-9
    Layout = "Build"; // [Build, Show, Base, Mount, Plate]
    /* [Hidden] */
    ThreadThick = 0.25; // [0.20, 0.25]
    ThreadWidth = 0.40; // [0.40, 0.40]
    /* [Hidden] */
    Protrusion = 0.1; // [0.01, 0.1]
    HoleWindage = 0.2;
    inch = 25.4;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    ID = 0;
    OD = 1;
    LENGTH = 2;
    //- Adjust hole diameter to make the size come out right
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(r=(FixDia + HoleWindage)/2,h=Height,$fn=Sides);
    }
    //- Dimensions
    // Knife holder & suchlike
    ScribeOD = 3.0; // diamond scribe shaft
    Bearing = [6.0,12.0,19.0]; // linear bearing body, ID = shaft diameter
    Spring = [4.5,5.5,3*ThreadThick]; // compression spring around shaft, LENGTH = socket depth
    //Spring = [9.5,10.0,3*ThreadThick]; // compression spring around shaft, LENGTH = socket depth
    WallThick = 4.0; // minimum thickness / width
    Screw = [3.0,6.75,25.0]; // holding it all together, OD = washer
    Insert = [3.0,5.0,8.0]; // brass insert
    //Insert = [4.0,6.0,10.0];
    Clamp = [43.2,44.0,34.0]; // tool clamp ring, OD = clearance around top
    LipHeight = IntegerMultiple(2.0,ThreadThick); // above clamp for retaining
    BottomExtension = 25.0; // below clamp to reach workpiece
    MountOAL = LipHeight + Clamp[LENGTH] + BottomExtension; // total mount length
    echo(str("Mount OAL: ",MountOAL));
    Plate = [1.5*ScribeOD,Clamp[ID] – 0*2*WallThick,WallThick]; // spring reaction plate
    NumScrews = 3;
    ScrewBCD = Bearing[OD] + Insert[OD] + 2*WallThick;
    echo(str("Retainer max OD: ",ScrewBCD – Screw[OD]));
    NumSides = 9*4; // cylinder facets (multiple of 3 for lathe trimming)
    // Basic mount shape
    module CNC3018Base() {
    translate([0,0,MountOAL – LipHeight])
    cylinder(d=Clamp[OD],h=LipHeight,$fn=NumSides);
    translate([0,0,MountOAL – LipHeight – Clamp[LENGTH] – Protrusion])
    cylinder(d=Clamp[ID],h=(Clamp[LENGTH] + 2*Protrusion),$fn=NumSides);
    cylinder(d1=Bearing[OD] + 2*WallThick,d2=Clamp[ID],h=BottomExtension + Protrusion,$fn=NumSides);
    }
    // Mount with holes & c
    module Mount() {
    difference() {
    CNC3018Base();
    translate([0,0,-Protrusion]) // bearing
    PolyCyl(Bearing[OD],2*MountOAL,NumSides);
    for (i=[0:NumScrews – 1]) // clamp screws
    rotate(i*360/NumScrews)
    translate([ScrewBCD/2,0,MountOAL – Clamp[LENGTH]])
    rotate(180/8)
    PolyCyl(Insert[OD],Clamp[LENGTH] + Protrusion,8);
    }
    }
    module SpringPlate() {
    difference() {
    cylinder(d=Plate[OD],h=Plate[LENGTH],$fn=NumSides);
    translate([0,0,-Protrusion])
    PolyCyl(Plate[ID],2*MountOAL,NumSides);
    translate([0,0,Plate[LENGTH] – Spring[LENGTH]]) // spring retainer
    PolyCyl(Spring[OD],Spring[LENGTH] + Protrusion,NumSides);
    for (i=[0:NumScrews – 1]) // clamp screws
    rotate(i*360/NumScrews)
    translate([ScrewBCD/2,0,-Protrusion])
    rotate(180/8)
    PolyCyl(Screw[ID],2*MountOAL,8);
    }
    }
    //—–
    // Build it
    if (Layout == "Base")
    CNC3018Base();
    if (Layout == "Mount")
    Mount();
    if (Layout == "Plate")
    SpringPlate();
    if (Layout == "Show") {
    Mount();
    translate([0,0,1.25*MountOAL])
    rotate([180,0,0])
    SpringPlate();
    }
    if (Layout == "Build") {
    translate([0,-0.75*Clamp[OD],MountOAL])
    rotate([180,0,0])
    Mount();
    translate([0,0.75*Plate[OD],0])
    SpringPlate();
    }

  • Ripping Vinyl Records on a Raspberry Pi

    Having already set up a Raspberry Pi streaming radio player for the living room, it seemed reasonable to also use it for recording audio from the long-disused turntable. A pair of RCA cables from the amplifier’s TAPE 2 REC outputs to the Behringer UCA202 USB audio interface got the audio where it needed to be:

    RPi streamer - Behringer UCA202 USB audio box
    RPi streamer – Behringer UCA202 USB audio box

    Fiddle with the amp to select the phonograph, poke the TAPE 2 button to send audio to/from the UCA202, fire up an SSH session, kill the streaming audio program, and figure out what audio hardware is out there:

    $ arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    Not much else to choose from on a Raspberry Pi, so see what the UCA202 can do:

    $ arecord --dump-hw-params 
    Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
    HW Params of device "default":
    --------------------
    ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
    FORMAT:  S8 S16_LE
    SUBFORMAT:  STD
    SAMPLE_BITS: [8 16]
    FRAME_BITS: [8 32]
    CHANNELS: [1 2]
    RATE: [8000 48000]
    PERIOD_TIME: [1000 65536000]
    PERIOD_SIZE: [16 524288]
    PERIOD_BYTES: [64 524288]
    PERIODS: [2 1024]
    BUFFER_TIME: (666 131072000]
    BUFFER_SIZE: [32 1048576]
    BUFFER_BYTES: [64 1048576]
    TICK_TIME: ALL
    --------------------
    arecord: set_params:1233: Sample format non available
    Available formats:
    - S8
    - S16_LE

    Given those limited choices, 16 bit little-endian at 48 kHz seems like a no-brainer.

    Find out all the ALSA device names:

    $ arecord -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    sysdefault:CARD=CODEC
        USB Audio CODEC, USB Audio
        Default Audio Device
    front:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        Front speakers
    surround21:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        4.0 Surround output to Front and Rear speakers
    surround41:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    iec958:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        IEC958 (S/PDIF) Digital Audio Output
    dmix:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        Direct sample mixing device
    dsnoop:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        Direct sample snooping device
    hw:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        Direct hardware device without any conversions
    plughw:CARD=CODEC,DEV=0
        USB Audio CODEC, USB Audio
        Hardware device with all software conversions

    They all point to the same hardware, so AFAICT the default device will work fine.

    Try recording something directly to the RPi’s /tmp directory, using the --format=dat shortcut for “stereo 16 bit 48 kHz” and --mmap to (maybe) avoid useless I/O:

    $ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /tmp/Side\ 1.wav
    Recording WAVE '/tmp/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                      +02%|01%+                                   overrun!!! (at least 1.840 ms long)
                                      +02%|02%+                                   overrun!!! (at least 247.720 ms long)
                                    +# 07%|06%##+                                 overrun!!! (at least 449.849 ms long)
                                     + 03%|02%+                                   overrun!!! (at least 116.850 ms long)

    Huh. Looks like “writing to disk” sometimes takes far too long, which seems to be the default for MicroSD cards.

    The same thing happened over NFS to the file server in the basement:

    $ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /mnt/part/Transfers/Side\ 1.wav
    
    Recording WAVE '/mnt/part/Transfers/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    
                                   +   09%|07%  +                                 overrun!!! (at least 660.372 ms long)
    
                                    +# 08%|06%# +                                 overrun!!! (at least 687.906 ms long)

    So maybe it’s an I/O thing on the RPi’s multiplexed / overloaded USB + Ethernet hardware?

    Trying a USB memory jammed into the RPi, under the assumption it might be better at recording than the MicroSD Card:

    $ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
    Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                      +01%|01%+                                   overrun!!! (at least 236.983 ms long)

    Well, if it’s overrunning the default buffer, obviously it needs Moah Buffah:

    $ arecord --format=dat --mmap --vumeter=stereo --buffer-time=1000000 --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
    Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                   +## 10%|06%# +                                 overrun!!! (at least 359.288 ms long)

    When brute force doesn’t work, you’re just not using enough of it:

    $ arecord --format=dat --mmap --vumeter=stereo --buffer-time=2000000 --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
    Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                      +00%|00%+                                   

    Sampling four bytes at 48 kHz fills 192 kB/s, so a 2 s buffer blots up 384 kB, which seems survivable even on a Raspberry Pi.

    The audio arrives at 11.5 MB/min, so an LP side with 20 min of audio will require about 250 MB of disk space. The USB memory was an ancient 2 GB card, so all four sides filled it halfway:

    $ ll /mnt/part
    total 1.1G
    drwxr-xr-x  2 ed   root 4.0K Dec 31  1969  ./
    drwxr-xr-x 17 root root 4.0K Jun  7 19:15  ../
    -rwxr-xr-x  1 ed   root 281M Sep  1 14:38 'Side 1.wav'*
    -rwxr-xr-x  1 ed   root 242M Sep  1 15:01 'Side 2.wav'*
    -rwxr-xr-x  1 ed   root 265M Sep  1 15:27 'Side 3.wav'*
    -rwxr-xr-x  1 ed   root 330M Sep  1 15:58 'Side 4.wav'*

    Side 4 is a bit longer than the rest, because I was folding laundry and the recording stopped at the 30 minute timeout after 10 minutes of silence.

    Now, to load ’em into Audacity, chop ’em into tracks, and save the lot as MP3 files …

  • CNC 3018-Pro: Probe Camera Case for Logitch QuickCam Pro 5000

    The ball-shaped Logitch QuickCam Pro 5000 has a rectangular PCB, so conjuring a case wasn’t too challenging:

    Probe Camera Case - Logitech QuickCam Pro 5000 - bottom
    Probe Camera Case – Logitech QuickCam Pro 5000 – bottom

    That’s more-or-less matte black duct tape to cut down reflections.

    The top side has a cover made from scuffed acrylic scrap:

    Probe Camera Case - Logitech QuickCam Pro 5000 - top
    Probe Camera Case – Logitech QuickCam Pro 5000 – top

    The corners are slightly rounded to fit under the screw heads holding it in place.

    The solid model shows off the internal ledge positioning the PCB so the camera lens housing rests on the floor:

    3018 Probe Camera Mount - solid model
    3018 Probe Camera Mount – solid model

    The notch lets the cable out, while keeping it in one place and providing some strain relief.

    I though if a camera was recognized by V4L2 and worked with VLC, it was good to go:

    Logitech QuickCam Pro 5000 - short focus
    Logitech QuickCam Pro 5000 – short focus

    Regrettably, it turns out the camera has a pixel format incompatible with the Python opencv interface used by bCNC. This may have something to do with running the code on a Raspberry Pi, rather than an x86 box.

    The camera will surely come in handy for something else, especially with such a cute case.

    The OpenSCAD source code as a GitHub Gist:

    // Probe Camera Mount for CNC 3018-Pro Z Axis
    // Ed Nisley – KE4ZNU – 2019-08
    Layout = "Block"; // [Show,Build,Block]
    Support = false;
    /* [Hidden] */
    ThreadThick = 0.20;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    Protrusion = 0.1; // make holes end cleanly
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    ID = 0;
    OD = 1;
    LENGTH = 2;
    inch = 25.4;
    //———————-
    // Dimensions
    PCB = [45.0,38.0,1.5]; // Logitech QuickCam Pro 5000 ball camera
    PCBLip = 1.0; // max non-component border
    PCBChamfer = 3.0; // cut along XY axes for corner bevel
    PCBClearTop = 15.0; // cables & connectors
    PCBClearSides = [0.5,0.5]; // irregular edges & comfort zone
    PCBClearBelow = 5.0; // lens support bracket rests on floor
    Lens = [11.5,14.2,3.0]; // LENGTH = beyond PCBClearBelow bracket
    LensOffset = [-1.5,0.0,0]; // distance from center of board
    CableOD = 4.5;
    BaseThick = Lens[LENGTH];
    Screw = [
    3.0,6.8,18.0 // M3 OD=washer, LENGTH=below head
    ];
    RoundRadius = IntegerMultiple(Screw[OD]/2,1.0); // corner rounding
    ScrewOC = [PCB.x + 2*sqrt(Screw[OD]),PCB.y + 2*sqrt(Screw[OD])];
    echo(str("Screw OC: ",ScrewOC));
    Lid = [ScrewOC.x,ScrewOC.y,1.0/16.0 * inch]; // top cover plate
    echo(str("Lid: ",Lid));
    BlockSize = [ScrewOC.x + 2*RoundRadius,ScrewOC.y + 2*RoundRadius,
    BaseThick + PCBClearBelow + PCB.z + PCBClearTop + Lid.z];
    echo(str("Block: ",BlockSize));
    NumSides = 2*3*4;
    //———————-
    // Useful routines
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(r=(FixDia + HoleWindage)/2,
    h=Height,
    $fn=Sides);
    }
    // Basic shapes
    // Overall block
    module Block() {
    difference() {
    hull()
    for (i=[-1,1], j=[-1,1])
    translate([i*ScrewOC.x/2,j*ScrewOC.y/2,0])
    cylinder(r=RoundRadius,h=BlockSize.z,$fn=NumSides);
    for (i=[-1,1], j=[-1,1]) // corner screws
    translate([i*ScrewOC.x/2,j*ScrewOC.y/2,BlockSize.z – Screw[LENGTH]])
    cylinder(d=Screw[ID],h=2*Screw[LENGTH],$fn=8); // cylinder = undersized
    translate(LensOffset + [0,0,-Protrusion]) // lens body
    PolyCyl(Lens[OD],2*BlockSize.z,NumSides);
    translate([0,0,BlockSize.z/2 + BaseThick]) // PCB lip on bottom
    cube([PCB.x – 2*PCBLip,PCB.y,BlockSize.z],center=true);
    translate([0,0,BlockSize.z/2 + BaseThick + PCBClearBelow]) // PCB clearance
    cube([PCB.x + 2*PCBClearSides.x,PCB.y + 2*PCBClearSides.y,BlockSize.z],center=true);
    translate([0,0,BlockSize.z – Lid.z/2]) // lid recess
    cube(Lid + [0,0,Protrusion],center=true);
    translate([0,Lid.y/2 – CableOD/2,BaseThick + PCBClearBelow + PCB.z]) // cable exit
    hull()
    for (j=[-1,1])
    translate([0,j*CableOD/4,0])
    rotate(180/8)
    PolyCyl(CableOD,BlockSize.z,8);
    }
    }
    //- Build it
    if (Layout == "Block")
    Block();
    if (Layout == "Show") {
    Block();
    }
    if (Layout == "Build") {
    Block();
    }

  • CNC 3018-Pro: Platter Fixtures

    Up to this point, the Sherline has been drilling 3.5 inch hard drive platters to serve as as reflecting bases for the vacuum tubes:

    LinuxCNC - Sherline Mill - Logitech Gamepad
    LinuxCNC – Sherline Mill – Logitech Gamepad

    The CNC 3018-Pro has a work envelope large enough for CD / DVD platters, so I mashed the Sherline fixture with dimensions from the vacuum tube code, added the 3018’s T-slot spacing, and conjured a pair of fixtures for a pair of machines.

    Because I expect to practice on scrap CDs and DVDs for a while:

    Platter Fixtures - CD on 3018
    Platter Fixtures – CD on 3018

    And a 3.5 inch hard drive platter version:

    Platter Fixtures - hard drive platter on 3018
    Platter Fixtures – hard drive platter on 3018

    The holes sit at half the 3018’s T-slot spacing (45 mm / 2), so you can nudge the fixtures to the front or rear, as you prefer.

    The alignment dots & slots should help touch off the XY coordinate system on the Sherline, although it can’t reach all of a CD. Using bCNC’s video alignment on the hub hole will be much easier on the 3018.

    After fiddling around with the 3018 for a while, however, the CD fixture doesn’t have many advantages over simply taping the disc to a flat platen. Obviously, you’d want a sacrificial layer for drilling, but it’s not clear the OEM motor / ER11 chuck would be up to that task.

    The OpenSCAD source code as a GitHub Gist:

    // Machining fixtures for CD and hard drive platters
    // Ed Nisley KE4ZNU February … September 2016
    // 2019-08 split from tube base models
    PlatterName = "CD"; // [3.5inch,CD]
    CNCName = "3018"; // [3018,Sherline]
    PlateThick = 5.0; // [5.0,10.0,15.0]
    RecessDepth = 4.0; // [0.0,2.0,4.0]
    //- Extrusion parameters must match reality!
    /* [Hidden] */
    ThreadThick = 0.25;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    Protrusion = 0.1; // make holes end cleanly
    inch = 25.4;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(d=(FixDia + HoleWindage),h=Height,$fn=Sides);
    }
    ID = 0;
    OD = 1;
    LENGTH = 2;
    //———————-
    // Dimensions
    P_NAME = 0; // platter name
    P_ID = 1; // … inner diameter
    P_OD = 2; // … outer diameter
    P_THICK = 3; // … thickness
    PlatterData = [
    ["3.5inch", 25.0, 95.0, 1.75],
    ["CD", 15.0, 120.0, 1.20],
    ];
    PlatterSides = 3*4*5; // polygon approximation
    B_NAME = 0; // machine name
    B_OC = 1; // … platform screw OC, use small integer for slot
    B_STUD = 2; // … screw OD clearance
    BaseData = [
    ["3018", [5.0, 45.0], 6.0], // slots along X axis
    ["Sherline", [1.16*inch,1.16*inch], 5.0], // tooling plate
    ];
    //———————-
    // Drilling fixture for disk platters
    module PlatterFixture(Disk,Machine) {
    PI = search([Disk],PlatterData,1,0)[P_NAME]; // get platter index
    echo(str("Platter: ",Disk));
    Platter = [PlatterData[PI][P_ID],
    PlatterData[PI][P_OD],
    PlatterData[PI][P_THICK]];
    BI = search([Machine],BaseData,1,0)[B_NAME]; // get base index
    echo(str("Machine: ",Machine));
    AlignOC = IntegerMultiple(Platter[OD],10);
    echo(str("Align OC: ",AlignOC));
    AlignSlot = [3*ThreadWidth,10.0,3*ThreadThick];
    StudClear = BaseData[BI][B_STUD]; // … clearance
    StudOC = [IntegerMultiple(AlignOC + 2*StudClear,BaseData[BI][B_OC].x), // … screw spacing
    BaseData[BI][B_OC].y];
    echo(str("Stud spacing: ",StudOC));
    NumStuds = [2,1 + 2*floor(Platter[OD] / StudOC.y)]; // holes only along ±X edges
    echo(str("Stud holes: ",NumStuds));
    BasePlate = [(20 + StudOC.x*ceil(Platter[OD] / StudOC.x)),
    (10 + AlignOC),
    PlateThick];
    echo(str("Plate: ",BasePlate));
    PlateRound = 10.0; // corner radius
    difference() {
    hull() // basic plate shape
    for (i=[-1,1], j=[-1,1])
    translate([i*(BasePlate.x/2 – PlateRound),j*(BasePlate.y/2 – PlateRound),0])
    cylinder(r=PlateRound,h=BasePlate.z,$fn=4*4);
    for (i=[-1,0,1], j=[-1,0,1]) // origin pips
    translate([i*AlignOC/2,j*AlignOC/2,BasePlate.z – 2*ThreadThick])
    cylinder(d=4*ThreadWidth,h=1,$fn=6);
    for (i=[-1,1], j=[-1,1]) { // alignment slots
    translate([i*(AlignOC + AlignSlot.x)/2,
    j*Platter[OD]/4,
    (BasePlate.z – AlignSlot.z/2 + Protrusion/2)])
    cube(AlignSlot + [0,0,Protrusion],center=true);
    translate([i*Platter[OD]/4,
    j*(AlignOC + AlignSlot.x)/2,
    (BasePlate.z – AlignSlot.z/2 + Protrusion/2)])
    rotate(90)
    cube(AlignSlot + [0,0,Protrusion],center=true);
    }
    for (i=[-1,1], j=[-floor(NumStuds.y/2):floor(NumStuds.y/2)]) // mounting stud holes
    translate([i*StudOC.x/2,j*StudOC.y/2,-Protrusion])
    rotate(180/6)
    PolyCyl(StudClear,BasePlate.z + 2*Protrusion,6);
    translate([0,0,-Protrusion]) // center clamp hole
    rotate(180/6)
    PolyCyl(StudClear,BasePlate.z + 2*Protrusion,6);
    translate([0,0,BasePlate.z – Platter[LENGTH]]) // disk locating recess
    rotate(180/PlatterSides)
    linear_extrude(height=(Platter[LENGTH] + Protrusion),convexity=2)
    difference() {
    circle(d=(Platter[OD] + HoleWindage),$fn=PlatterSides);
    circle(d=Platter[ID] – HoleWindage,$fn=PlatterSides);
    }
    translate([0,0,BasePlate.z – RecessDepth]) // drilling recess
    rotate(180/PlatterSides)
    linear_extrude(height=(RecessDepth + Protrusion),convexity=2)
    difference() {
    circle(d=(Platter[OD] – 10),$fn=PlatterSides);
    circle(d=(Platter[ID] + 10),$fn=PlatterSides);
    }
    }
    }
    //———————-
    // Build it
    PlatterFixture(PlatterName,CNCName);

  • Tour Easy: Ruggedized Zzipper Fairing Mount

    After nigh onto 18 years, the pipe straps holding the Zzipper fairing struts to the handlebars of our Tour Easy recumbents finally shrugged off their plastic wraps:

    Tour Easy Zzipper Fairing - OEM mount
    Tour Easy Zzipper Fairing – OEM mount

    Although they still worked, riding over broken pavement produced distinct rattles; alas, the roads around here feature plenty of broken pavement.

    The solution is a rugged plastic block capped with aluminum plates to spread the clamping load:

    Tour Easy Zzipper Fairing - block mount
    Tour Easy Zzipper Fairing – block mount

    The solid model is straightforward:

    Zzipper Fairing - Strut Mount - solid model - Show view
    Zzipper Fairing – Strut Mount – solid model – Show view

    A slight bit of tinkering made the stack exactly the right height for 45 mm screws secured with nyloc nuts. No washers on either end, although that’s definitely in the nature of fine tuning.

    The three sections print without support:

    Zzipper Fairing - Strut Mount - solid model
    Zzipper Fairing – Strut Mount – solid model

    I reamed the smaller hole with a 3/8 inch drill to match the fairing strut rod. The as-printed larger hole fit the handlebar perfectly, although the first picture shows the tubing isn’t exactly round on the near side of the block, where it starts the outward bend toward the grips.

    The cap plates cried out for CNC, but I simply traced two outlines of the block on 1/8 inch aluminum sheet, bandsawed near the line, introduced them to Mr Disk Sander for finishing & corner rounding, transfer-punched the holes from the plastic blocks, and drilled to suit:

    Tour Easy Zzipper Fairing - clamp plates
    Tour Easy Zzipper Fairing – clamp plates

    Making two pairs of plates by hand counts as Quality Shop Time around here.

    The first few rides confirm the fix: no rattles!

    The OpenSCAD source code as a GitHub Gist:

    // Fairing strut mount for Tour Easy handlebars
    // Ed Nisley – KE4ZNU – 2019-08
    Layout = "Show"; // [Show,Build,Block]
    Support = false;
    /* [Hidden] */
    ThreadThick = 0.20;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    Protrusion = 0.1; // make holes end cleanly
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    ID = 0;
    OD = 1;
    LENGTH = 2;
    inch = 25.4;
    //———————-
    // Dimensions
    // Handlebar along X axis, strut along Y, Z=0 at handlebar centerline
    HandlebarOD = 0.875 * inch + HoleWindage;
    StrutOD = 0.375 * inch + HoleWindage;
    PlateThick = 1.0 / 16.0 * inch;
    WallThick = 2.0;
    Screw = [3.0,6.8,4.0]; // M3 OD=washer, length=nut + washers
    RoundRadius = IntegerMultiple(Screw[OD]/2,0.5); // corner rounding
    ScrewOC = [IntegerMultiple(StrutOD + 2*WallThick + Screw[ID],0.5),
    IntegerMultiple(HandlebarOD + 2*WallThick + Screw[ID],0.5)];
    echo(str("Screw OC: ",ScrewOC));
    BlockSize = [ScrewOC.x + 2*RoundRadius,ScrewOC.y + 2*RoundRadius,HandlebarOD + StrutOD + 3*WallThick];
    echo(str("Block: ",BlockSize));
    HandleBarOffset = WallThick + HandlebarOD/2; // block bottom to centerline
    StrutOffset = HandlebarOD/2 + WallThick + StrutOD/2; // handlebar centerline to strut centerline
    echo(str("Screw length: ",BlockSize.z + 2*PlateThick + Screw[LENGTH]));
    NumSides = 2*3*4;
    //———————-
    // Useful routines
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(r=(FixDia + HoleWindage)/2,
    h=Height,
    $fn=Sides);
    }
    // Basic shapes
    // Block with handlebar along X axis
    module Block() {
    difference() {
    hull()
    for (i=[-1,1], j=[-1,1])
    translate([i*ScrewOC.x/2,j*ScrewOC.y/2,-HandleBarOffset])
    cylinder(r=RoundRadius,h=BlockSize.z,$fn=NumSides);
    for (i=[-1,1], j=[-1,1])
    translate([i*ScrewOC.x/2,j*ScrewOC.y/2,-(HandleBarOffset + Protrusion)])
    PolyCyl(Screw[ID],BlockSize.z + 2*Protrusion,8);
    translate([-BlockSize.x,0,0])
    rotate([0,90,0])
    cylinder(d=HandlebarOD,h=2*BlockSize.x,$fn=NumSides);
    translate([0,BlockSize.y,StrutOffset])
    rotate([90,0,0])
    cylinder(d=StrutOD,h=2*BlockSize.y,$fn=NumSides);
    }
    if (Support) { // totally ad-hoc
    color("Yellow")
    cube(1,center=true);
    }
    }
    //- Build it
    if (Layout == "Block")
    Block();
    if (Layout == "Show") {
    Block();
    color("Green",0.25)
    translate([-BlockSize.x,0,0])
    rotate([0,90,0])
    cylinder(d=HandlebarOD,h=2*BlockSize.x,$fn=NumSides);
    color("Green",0.25)
    translate([0,BlockSize.y,StrutOffset])
    rotate([90,0,0])
    cylinder(d=StrutOD,h=2*BlockSize.y,$fn=NumSides);
    }
    if (Layout == "Build") {
    translate([-1.2*BlockSize.x,0,HandleBarOffset])
    difference() {
    Block();
    translate([0,0,BlockSize.z])
    cube(2*BlockSize,center=true);
    }
    translate([1.2*BlockSize.x,0,StrutOD/2 + WallThick])
    difference() {
    rotate([180,0,0])
    translate([0,0,-StrutOffset])
    Block();
    translate([0,0,BlockSize.z])
    cube(2*BlockSize,center=true);
    }
    translate([0,0,StrutOffset])
    rotate([180,0,0])
    intersection() {
    Block();
    translate([0,0,StrutOffset/2])
    cube([2*BlockSize.x,2*BlockSize.y,StrutOffset],center=true);
    }
    }