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: CNC

Making parts with mathematics

  • Sherline vs. LinuxCNC 2.9.8

    Sherline vs. LinuxCNC 2.9.8

    Notes on finally getting the Sherline CNC mill operating in its new home, with a suitable Axis startup image:

    Sherline setup 2026-06
    Sherline setup 2026-06

    The gray countertop from its former home sits on foam strips soaking up a slight warp with enough isolation to keep things quiet.

    The gantry required the usual fiddling to make the cable hoist the Z axis directly upward, with the orange flag on the counterweight barely visible below the monitor.

    I recently touched the box of precision XYZ positioners and there might be something useful, albeit grossly overqualified, in there to simplify dropping the laser pointer beam directly through the spindle bore.

    A clean installation of LinuxCNC 2.9.8 on an ancient Dell Optiplex 9020 proceeded smoothly. Installing x11vnc let the rest of the proceedings happen from upstairs in the Comfy Chair. For unknown reasons, vinagre works better than Reminna as a VNC client, after recalling F11 enters / exits fullscreen mode.

    The mesaflash utility accompanying LinuxCNC 2.9.8 did not recognize the Mesa 6i25 card. Fetching & compiling the most recent version (3.5.17) cleared that hump and flashed the bitmap:

    sudo mesaflash --verbose --device 5i25 --write 5i25/configs/hostmot2/5i25_prob_rfx2.bit
    

    The 6i25 wants to be known as a 5i25, with its jumpers in their default positions:

    Mesa 6i25 - jumper locations
    Mesa 6i25 – jumper locations

    For unknown reasons, the button originally known as btn-trigger became btn-joystick for a while and has now reverted to btn-trigger. It’s labeled 1 in the four-button cluster:

    Logitech Dual-Action Gamepad - relabeled
    Logitech Dual-Action Gamepad – relabeled

    Which required changing the pin name in the Kicad library component:

    Sherline HAL schematic - Logitech button 1 name
    Sherline HAL schematic – Logitech button 1 name

    Which required converting the old Kicad library format into the new Kicad library format, a completely automatic process without, AFAICT, any unpleasant side effects.

    The new name fed into the schematic as expected, after minor fumbling while re-adding the modified component and setting its annotation number:

    Sherline HAL schematic - Logitech AZ button logic
    Sherline HAL schematic – Logitech AZ button logic

    The X axis home microswitch has (apparently) become more bouncy while it was idle, so I increased the number of samples before HAL sees a change in that GPIO input:

    Sherline HAL schematic - home switch debounce
    Sherline HAL schematic – home switch debounce

    The dbounce block runs in the servo thread at 1 m per tick, so those 20 samples take all of 20 ms while the X axis moves 0.15 mm. At some point I should apply a scope to that switch, but for now It Just Works™.

    Considerably to my surprise, compiling the modified Kicad schematic into a HAL file proceeded without incident, despite various Python updates in the last five years.

    Kicad produces an “intermediate XML file” containing the netlist data intended for a conversion / export program, which is basically what my Kicad-to-HAL lashup does. I told Kicad to use Bash’s true command as a converter:

    Sherline HAL schematic - netlist export
    Sherline HAL schematic – netlist export

    So I can run the Kicad-to-HAL converter manually:

    python ../Kicad\ Conversion/Kicad-to-HAL.py Sherline\ HAL\ -\ Logitech\ Gamepad\ jogging.xml Sherline.hal
    

    You could tell Kicad to run it and it would probably Just Work™, but I’m used to peering at the results and dinking with my program.

    Which produced a new Sherline.hal file that Just Worked™ with the existing Sherline.ini file containing the configuration constants.

    The Sherline has cut only air so far, but, as the man said, “E pur si muove.”

  • Laser-marked Hole Drilling Spots

    Laser-marked Hole Drilling Spots

    While setting up to drill holes in the aluminum base for the running light buck converter, I wondered if laser-marking the spots directly from the solid model would work better than my usual fumbling around.

    The solid model:

    Running Light - power box - bottom view
    Running Light – power box – bottom view

    Export projections of the pieces from OpenSCAD as an SVG file:

    Running Light - power box - Projection view
    Running Light – power box – Projection view

    Import into LightBurn, set up for a very fast, very light cut and Fire The Laser:

    Laser-marked hole spots - masking tape
    Laser-marked hole spots – masking tape

    That’s in ordinary masking tape on a hard-anodized sheet of aluminum from the pile, which looked better than I expected.

    The same aluminum covered with blue tape:

    Laser-marked hole spots - blue tape - hard anodize
    Laser-marked hole spots – blue tape – hard anodize

    Which looks much better in person than it does in the photo.

    On a soft aluminum sheet from the Basement Warehouse Zone:

    Laser-marked hole spots - blue tape - sheet aluminum
    Laser-marked hole spots – blue tape – sheet aluminum

    The dark outline is a comfort mark hand-drawn around a chipboard test piece to verify the layout fit between random holes drilled in the sheet during its previous life.

    A closer look at a corner hole:

    Laser-marked hole spots - blue tape - hard anodize - detail 1
    Laser-marked hole spots – blue tape – hard anodize – detail 1

    And the center hole:

    Laser-marked hole spots - blue tape - hard anodize - detail 2
    Laser-marked hole spots – blue tape – hard anodize – detail 2

    The holes appeared in the right places after center-punching by eye, but the fragility of those four little tape leaves around the center point must be experienced to be believed.

    And, yes, those are deliberately low-polygon approximations to a circle, because I’m a low-poly kind of guy.

    I really need an optical center punch if I do more such silliness. The box with those HP plotter digitizing sights recently came to hand, so I suppose I should make something.

  • Guilloche Generator: Now With Layers & Colors

    Guilloche Generator: Now With Layers & Colors

    Tweaking the GCMC Guilloche generator to define colors for the SVG layers produces a pattern ready for LightBurn:

    Guilloche - SVG layer colors
    Guilloche – SVG layer colors

    The blue layer runs at 300 mm/s at 10% PWM to carve trenches all over the CD / DVD surface, which should render it unreadable:

    Laser cut CDs - Guilloche patterns
    Laser cut CDs – Guilloche patterns

    The laser runs much faster than a drag knife or a diamond engraving tool!

    The reddish layer uses Dot mode to draw the legend around the hub:

    Laser-engraved CD - legend detail
    Laser-engraved CD – legend detail

    The characters are 1.5 mm top-to-bottom, with dots just under 0.2 mm diameter on 0.2 mm centers.

    Stipulated: there’s no real point to annotating a CD that you’re wrecking, but the code was already there, so why not?

    So the overall workflow involves generating an SVG image, importing it into LightBurn with those layers set up with the appropriate cut parameters, using the Three-Point Circle Center Finder tool to align the pattern with the CD, then Fire The Laser. Alignment stops on the laser platform eliminate the need to realign every pattern, so it boils down to running the generator script enough times, importing a batch of patterns, then snapping each one into place and cutting it.

    They’re kinda pretty, in the usual techie way:

    Laser cut CDs - Guilloche patterns
    Laser cut CDs – Guilloche patterns

    I have a lot of scrap discs, some ideas of optimizing the process, and a general notion what to do with the prettier results.

    The GCMC source code and Bash driver script as a GitHub Gist:

  • Mini-Lathe Chuck Stops: Better Next Time

    Mini-Lathe Chuck Stops: Better Next Time

    The story so far:

    Daubing urethane adhesive into each pocket, sliding a tiny magnet atop the goo, and flipping them over onto a sheet of plastic atop the surface plate to let them cure went about the way you’d expect. Given the state of my fingertips, however, I was not about to fiddle with the phone / camera / anything, but it really did happen.

    The final result:

    Lathe Chuck Stops - on-lathe storage
    Lathe Chuck Stops – on-lathe storage

    The alert reader will notice the slight gap under the left leg of the first orange stop, which provides a good introduction for a few things that should happen differently the next time I do something like this.

    To my credit, I got all but one of the 54=3×6×3 magnets into their pockets in the same orientation. That’s gotta count for something and, hey, that orange stop sticks to the chuck just fine.

    That one also suffered from my failure to switch the Axis UI to metric units before touching off the Z axis at 0.1 mm, thereby putting the Z=0.0 level 2.53 mm below the surface. Fortunately, the 3 mm MDF baseplate prevented that error from creating three pockets in the tooling plate, although it did produce holes instead of pockets in the stop.

    I dropped the magnets into the thru-cut stop on the surface plate and dabbed some adhesive atop the magnets to bond them into their holes. This worked fine and led me to suspect the easiest way to make these stops would be to just laser-cut the holes and skip the whole CNC thing.

    The disadvantage of cutting the holes through is that adhesive will inevitably ooze out around the magnet and mess up the bottom surface of the stop. Sticking both the stop and the magnets onto kapton tape seems like it should seal well, but liquid always finds a way.

    In any event, the two-part urethane adhesive (JB Plastic Bonder) expands slightly as it cures, which is great for gap filling and not so good for precision bonding. With the pockets in the other 17 stops arranged open-side down, the magnets held themselves firmly to the plastic sheet atop the surface plate and the expanding urethane pushed the acrylic stop upward, leaving the magnets standing slightly proud of the stop’s surface:

    Lathe Chuck Stops - protruding magnet
    Lathe Chuck Stops – protruding magnet

    Not by much, mind you, but not what I wanted, having painstakingly cut the pockets 2.2 mm deep for a 2.0 mm magnet.

    Next time, dot some slow-cure clear pouring epoxy in each pocket, put the stop on the surface plate with the pocket facing up, then drop the magnet in place. The magnet pulls itself into the pocket, the epoxy doesn’t expand, any overflow will fill in over the magnet, and anything sticking out can be sanded off.

    The fixtures worked well and aligned perfectly on the Sherline’s tooling plate. The 0.1 mm outset around the stops in the chipboard probably wasn’t needed, although the total repeatability seemed to be around 0.2 mm and pocket position errors are visible only on the smallest (red) stops:

    Lathe Chuck Stops - misaligned pocket
    Lathe Chuck Stops – misaligned pocket

    All in all, this turned out pretty well. Next time will be even better!

    And, perhaps, making the stops with 3D printing would be even better than that, at the cost of the usual gnarly surface finish.

  • Tube Turning Adapters

    Tube Turning Adapters

    Finishing the PVC tubes reinforcing the vacuum cleaner adapters required fixtures on each end:

    Dirt Devil adapter - pipe turning
    Dirt Devil adapter – pipe turning

    Because the tubes get epoxied into the adapters, there’s no particular need for a smooth surface finish and, in fact, some surface roughness makes for a good epoxy bond. The interior of a 3D printed adapter is nothing if not rough; the epoxy in between will be perfectly happy.

    Turning the tubes started by just grabbing the conduit in the chuck and peeling the end that stuck out down to the finished diameter, because the conduit was thick-walled enough to let that work.

    The remaining wall was so thin that the chuck would crunch it into a three-lobed shape, so the white ring in the chuck is a scrap of PVC pipe turned to fit the tube ID and provide enough reinforcement to keep the tube round.

    The conduit ID isn’t a controlled dimension and was, in point of fact, not particularly round. It was, however, smooth, which counts for more than anything inside a tube carrying airborne fuzzy debris; polishing the interior of a lathe-bored pipe simply wasn’t going to happen.

    The fixture on the other end started as a scrap of polycarbonate bandsawed into a disk with a hole center-drilled in the middle:

    Pipe end lathe fixture - center drilling
    Pipe end lathe fixture – center drilling

    Stick it onto a disk turning fixture and sissy-cut the OD down a little smaller than the eventual tube OD:

    Pipe end lathe fixture - turning OD
    Pipe end lathe fixture – turning OD

    Turn the end down to fit the tube ID, flip it around to center-drill the other side, stick it into the tube, and finally finish the job:

    Dirt Devil adapter - pipe fixture
    Dirt Devil adapter – pipe fixture

    The nice layering effect along the tube probably comes from molding the conduit from recycled PVC with no particular concern for color matching.

    A family portrait of the fixtures with a finished adapter:

    Dirt Devil adapter - fixtures
    Dirt Devil adapter – fixtures

    A fine chunk of Quality Shop Time: solid modeling, 3D printing, mini-lathe turning, and even some coordinate drilling on the Sherline.

  • Bafang BBS02: Terry Symmetry Shift Sensor & Cable Guides

    Bafang BBS02: Terry Symmetry Shift Sensor & Cable Guides

    The Bafang BBS02 came with (because I added it to the order) what looks like a genuine shift (“gear”) sensor made by the original company in the Czech Republic:

    Terry Bafang - shift sensor - installed
    Terry Bafang – shift sensor – installed

    On a typical bike, it mounts against a cable stop with the cable housing holding it in place against its other end:

    Tour Easy Bafang BBS02 - shift sensor - installed
    Tour Easy Bafang BBS02 – shift sensor – installed

    The Terry Symmetry has only two lengths of housing: in front of the adjuster on the downtube and behind the stop brazed to the chainstay. In either position, the sensor would move as the shift cable flexed and (IMO) put unreasonable stress on the electrical cable running to the motor.

    Yes, the Tour Easy has those same two lengths of housing, but the forward one joins a sheaf of wires & cables that barely moves.

    Fortunately, the sensor fits neatly between stations 1 and 2 along the downtube, with a snippet of PTFE lIned housing holding it firmly in place, with the 3D printed battery mounting blocks including paths for both cables:

    Terry - Bafang battery - all stations - solid model
    Terry – Bafang battery – all stations – solid model

    The shift cable originally ran from the adjuster in the front to the guide under the bottom bracket along a slightly diagonal path I could not possibly match. Instead, the path is now parallel to the downtube from the front adjuster:

    Terry Bafang - OEM shift stop
    Terry Bafang – OEM shift stop

    .. to the rear block, where it angles downward over the motor to the bottom bracket:

    Terry Bafang - shift cable clearance
    Terry Bafang – shift cable clearance

    The front block at station 1 has a Delrin / acetal bushing to align the cable with the rest of the blocks:

    Terry shift guide - acetal installed
    Terry shift guide – acetal installed

    Yes, it’s a round peg jammed in a hexagonal hole:

    Terry shift guide - acetal hole
    Terry shift guide – acetal hole

    Turning it from stock is well within the capabilities of Tiny Lathe™:

    Terry shift guide - acetal cutoff
    Terry shift guide – acetal cutoff

    For great slippery, a similar UHMW PE bushing supports the cable bend at the rear of the station 4 block:

    Terry shift guide - UHMWPE installed
    Terry shift guide – UHMWPE installed

    The Basement Laboratory Warehouse Wing disgorged an overly large rod taxing Tiny Lathe™ to its limit:

    Terry shift guide - UHMWPE turning
    Terry shift guide – UHMWPE turning

    Memo to Self: next time, just saw off a stub and move on.

  • Bafang BBS02: Motor Reaction Spacer

    Bafang BBS02: Motor Reaction Spacer

    The Terry Symmetry’s rear shift cable passes along the side of the downtube and through a plastic guide channel under the bottom bracket shell. The Bafang BBS02 motor must press against the bottom of the downtube, so the shift cable rubs against the top of the motor.

    The solution is a small block shaped around the point of contact to cradle the downtube, the bottom bracket shell lug, and the motor case:

    Terry - Bafang motor spacer - solid model
    Terry – Bafang motor spacer – solid model

    A strip of double-sided foam tape holds the block to the motor and the reaction force from the motor’s torque presses the block against the downtube:

    Terry Bafang - motor reaction block
    Terry Bafang – motor reaction block

    Seen from the other side, looking parallel to the shift cable, you can see the tight clearance:

    Terry Bafang - shift cable clearance
    Terry Bafang – shift cable clearance

    The block holds the motor 8 mm from the downtube, just enough to give the cable some breathing room.

    The block is slightly taller on its front end, because the motor doesn’t meet the downtube at a right angle:

    Terry - Bafang motor spacer - tube angle - solid model
    Terry – Bafang motor spacer – tube angle – solid model

    I determined the proper angle by taping waxed paper to the top of the motor, sticking a trial (non-angled) block to the downtube, coating its bottom surface with hot-melt glue, then squishing the motor against the block. The cooled glue was flush with the block on the rear and 1.8 mm thick on the front, a 5° angle over the 20 mm block.

    Definitely easier than correctly figuring the geometry from first principles: tweak the model to include the measured thickness, compute the angle, tilt the tube, and print another block that fits like it grew there.

    With the block in place and the motor held against the downtube, tighten the retaining nut against the “fixing plate” by giving it a few gentle whacks with a hammer, then tighten the jam nut.

    The OpenSCAD source code snippet:

    // Motor Reaction Block
    // Holds motor away from downtube enough to miss rear shift wire
    
    MotorOD = 111;              // motor frame dia
    MotorMountRad = 85;         // BB spindle center to motor center
    Space = 8.0;                // motor to frame space
    
    Spacer = [20.0,DownTube[ID]/2,4*Space];
    SpaceAngle = atan(1.8/Spacer.x);            // tilt due to non-right-angle meeting
    echo(str("Spacer angle: ",SpaceAngle));
    
    module MotorSpacer() {
    
        difference() {
            cube(Spacer,center=true);
            translate([0,0,DownTube[ID]/2])
                rotate([0,90 + SpaceAngle,0]) rotate(180/FrameSides)
                    cylinder(d=DownTube[ID],h=DownTube[LENGTH],$fn=FrameSides,center=true);
            translate([DownTube[LENGTH]/2,0,DownTube[ID]/2 - DownTube[LENGTH]*sin(SpaceAngle)/2])       // concentric with ID
                rotate([0,90 + SpaceAngle,0]) rotate(180/FrameSides)
                    cylinder(d=DownTube[OD],h=DownTube[LENGTH],$fn=FrameSides,center=true);
            translate([0,0,-(MotorOD/2 + Space)])
                rotate([90,0,0]) rotate(180/48)
                    cylinder(d=MotorOD,h=2*Spacer.y,$fn=48,center=true);
        }
    
    }
    

    Mary’s Tour Easy didn’t need this block, because all the cables run elsewhere, but I did capture a piece of closed-cell foam between its vestigial downtube and the motor to prevent chafing.