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

Making the world a better place, one piece at a time

  • Frank-O-Squid Configuration

    My old Thing-O-Matic has new life as the Frank-O-Squid at Squidwrench Galactic HQ, with all the original Makerbot electronics replaced by an Azteeg X3 controller. Over the last several weeks I’ve coaxed it into doing most of the right things at the proper speeds & feeds, so we can now move on to actually making stuff:

    Frank-o-Squid in action
    Frank-o-Squid in action

    The warping on that little digital caliper thumbwheel holder show that I don’t have the tiny-object slowdown settings quite correct, but it’s getting close.

    The Marlin firmware is on GitHub. I intended to set it up so that pulling changes from upstream Marlin would be easy, but totally blundered something along the way. I’ll eventually plug the changes from Configuration.h, Configuration_adv.h, and pins.h into a clean branch and start over, but, for now, we’re slowly diverging from consensus reality.

    Although the platform still has the Z-min switch over on the right edge, neither the firmware nor Slic3r pay any attention to it. A stub in the startup G-Code sequence does a head fake toward the switch, but doesn’t actually probe it.

    I scrapped the original craptastic Makerbot ATX power supply and replaced it with Makergear’s huge 12 V laptop brick that powered the original M2 platform, so the thermal switches on the extruder no longer do anything useful; it’s running bare, pretty much like all other 3D printers.

    The Slic3r configuration exports thusly:

    # generated by Slic3r 1.0.0RC1 on Mon Mar  3 07:48:29 2014
    avoid_crossing_perimeters = 0
    bed_size = 105,120
    bed_temperature = 100
    bottom_solid_layers = 3
    bridge_acceleration = 0
    bridge_fan_speed = 100
    bridge_flow_ratio = 1
    bridge_speed = 40
    brim_width = 1.0
    complete_objects = 0
    cooling = 1
    default_acceleration = 0
    disable_fan_first_layers = 1000
    duplicate = 1
    duplicate_distance = 6
    duplicate_grid = 1,1
    end_gcode = ;---- end.gcode starts ----\n; TOM 286 - Al plates + Geared extruder\n; Ed Nisley - KE4ZNU - January 2014\n; Marlin with tweaks for Azteeg X3 with thermocouple\n;- inhale filament blob\nG91\nG1 E-5 F900\nG90\n;- turn off heaters\nM104 S0         ; extruder head\nM140 S0         ; HBP\n;- move to eject position\nG0 Z115 F1000   ; home Z to get nozzle away from object\n;G92 Z115      ; reset Z\nG1 X0 F6000     ; center X axis\nG1 Y35          ; move Y stage forward\n;---- end.gcode ends ----
    external_perimeter_speed = 50%
    external_perimeters_first = 0
    extra_perimeters = 1
    extruder_clearance_height = 20
    extruder_clearance_radius = 20
    extruder_offset = 0x0
    extrusion_axis = E
    extrusion_multiplier = 0.95
    extrusion_width = 0.50
    fan_always_on = 0
    fan_below_layer_time = 1
    filament_diameter = 2.95
    fill_angle = 45
    fill_density = 0.15
    fill_pattern = honeycomb
    first_layer_acceleration = 0
    first_layer_bed_temperature = 100
    first_layer_extrusion_width = 0.50
    first_layer_height = 0.25
    first_layer_speed = 10
    first_layer_temperature = 210
    g0 = 0
    gap_fill_speed = 30
    gcode_arcs = 0
    gcode_comments = 0
    gcode_flavor = reprap
    infill_acceleration = 0
    infill_every_layers = 2
    infill_extruder = 1
    infill_extrusion_width = 0.50
    infill_first = 1
    infill_only_where_needed = 1
    infill_speed = 50
    layer_gcode =
    layer_height = 0.25
    max_fan_speed = 100
    min_fan_speed = 35
    min_print_speed = 10
    min_skirt_length = 3
    notes =
    nozzle_diameter = 0.4
    only_retract_when_crossing_perimeters = 1
    ooze_prevention = 0
    output_filename_format = [input_filename_base].gcode
    overhangs = 1
    perimeter_acceleration = 0
    perimeter_extruder = 1
    perimeter_extrusion_width = 0.50
    perimeter_speed = 30
    perimeters = 1
    post_process =
    print_center = 0,0
    raft_layers = 0
    randomize_start = 1
    resolution = 0.05
    retract_before_travel = 0.0
    retract_layer_change = 0
    retract_length = 0.75
    retract_length_toolchange = 10
    retract_lift = 0
    retract_restart_extra = 0
    retract_restart_extra_toolchange = 0
    retract_speed = 30
    rotate = 0
    scale = 1
    skirt_distance = 2
    skirt_height = 1
    skirts = 1
    slowdown_below_layer_time = 30
    small_perimeter_speed = 50%
    solid_fill_pattern = rectilinear
    solid_infill_below_area = 5
    solid_infill_every_layers = 0
    solid_infill_extrusion_width = 0.50
    solid_infill_speed = 150%
    spiral_vase = 0
    standby_temperature_delta = -5
    start_gcode = ;---- start.gcode begins ----\n; TOM 286 - Al plates + Geared extruder + Zmin platform sense\n; Ed Nisley - KE4ZNU - January 2014\n; Marlin with tweaks for Azteeg X3 with thermocouple\n;\n; Set initial conditions\nG21                 ; set units to mm\nG90                 ; set positioning to absolute\n;----------\n; Begin heating\nM104 S[first_layer_temperature]         ; extruder head\nM140 S[first_layer_bed_temperature]	; start bed heating\n;----------\n; Home axes\nG28 X0 Y0 Z0\nG92 X-53.5 Y-58.5 Z114.5\n;----------\n; Initial nozzle wipe to clear snot for Z touchoff\nG1 X0 Y0 Z3.0 F1000     ; pause at center to build confidence\nG4 P1000\nG1 Z10                  ; ensure clearance\nG1 X39 Y-58.0 F1000    ; move to front, avoid wiper blade\nG1 X55                  ; to wipe station\nG1 Z6.0                 ; to wipe level\nM116                    ; wait for temperature settling\nG1 Y-45 F500            ; slowly wipe nozzle\n;-----------------------------------------------\n; Z platform height touchoff\n; Make sure the XY position is actually over the switch!\n; Home Z downward to platform switch\n; Compensate for 0.05 mm backlash in G92: make it 0.05 too low\nG1 X56.0 Y8.2 F5000\nG1 Z4.0 F1000     ; get over build platform switch\n;G1 Z0 F50                    ; home downward very slowly\n;G92 Z1.45                    ; set Z-min switch height\nG1 Z6.0 F1000                ; back off switch to wipe level\n;-----------------------------------------------\n; Prime extruder to stabilize initial pressure\nG1 X55 Y-45 F5000   ; set up for wipe from rear\nG1 Y-58.0 F500      ; wipe to front\nG91                 ; use incremental motion for extrusion\nG1 F100               ; set decent rate\nG1 E10              ; extrude enough to get good pressure\nG1 F2000            ; set for fast retract\nG1 E-1.0            ; retract\nG90                 ; back to absolute motion\nG1 Y-45 F1000       ; wipe nozzle to rear\n;----------\n; Set up for Skirt start in right front corner\n; Compensate for Z backlash: move upward from zero point\nG1 X40 Y-40 F5000\nG1 Z0.0 F1000     ; kiss platform\nG1 Z0.2 F1000       ; take up Z backlash to less than thread height\n;G92 E1.0            ; preset to avoid huge un-Reversal blob\n;G1 X0 Y0\n;---- start.gcode ends ----
    start_perimeters_at_concave_points = 1
    start_perimeters_at_non_overhang = 1
    support_material = 0
    support_material_angle = 0
    support_material_enforce_layers = 0
    support_material_extruder = 1
    support_material_extrusion_width = 0.50
    support_material_interface_extruder = 1
    support_material_interface_layers = 3
    support_material_interface_spacing = 0
    support_material_pattern = honeycomb
    support_material_spacing = 2.5
    support_material_speed = 60
    support_material_threshold = 0
    temperature = 210
    thin_walls = 1
    threads = 2
    toolchange_gcode =
    top_infill_extrusion_width = 0.50
    top_solid_infill_speed = 50%
    top_solid_layers = 3
    travel_speed = 150
    use_firmware_retraction = 0
    use_relative_e_distances = 0
    vibration_limit = 0
    wipe = 0
    z_offset = 0
    

    All of that should become three TOM286 - Default sub-profiles.

    The Pronterface configuration looks like this:

    set port /dev/ttyUSB0
    set monitor True
    set last_bed_temperature 100.0
    set last_temperature 210.0
    set baudrate 115200
    set temperature_abs 210
    set xy_feedrate 5000
    set z_feedrate 1000
    set build_dimensions 110.00x120.00x117.00+0.00+0.00+0.00+0.00+0.00+0.00
    set extruders 1
    set slic3rintegration True
    set tempgauges True
    set preview_extrusion_width 0.4
    set e_feedrate 100
    set last_extrusion 3
    set last_file_path /home/ed/Documents/Thing-O-Matic/Calibration/Thread Thickness
    set recentfiles ["/home/ed/Documents/Thing-O-Matic/Calibration/Thread Thickness/Caliper Thumbwheel Holder.gcode", "/home/ed/Documents/Thing-O-Matic/Calibration/Thread Thickness/Thinwall Open Box.gcode", "/home/ed/Documents/Thing-O-Matic/Calibration/Thread Thickness/Platform Level.gcode", "/home/ed/Documents/Thing-O-Matic/Calibration/Circle Diameter Calibration/Small Circle Cal - M2 0.2 mm.gcode", "/home/ed/Documents/Thing-O-Matic/Calibration/Circle Diameter Calibration/Small Circle Cal - TOM.gcode"]
    

    As you can see, it’s all running from a directory on my old laptop. The next step involves migrating everything to a dedicated PC next to the printer, so nobody else need worry about this stuff…

  • Sewing Machine Lights: LED Strips

    Mary wants more light on her free-motion quilting, right where the needle meets the fabric. I proposed LED strip lights on the machine arm, in addition to rebooting the end cap lamp into the current millennium, which requires:

    • No snagging on a bulky quilt shoved through the machine
    • Not completely butt-ugly
    • Reasonably durable

    I picked up reels of cool-white and warm-white waterproof LED strips (12 V, 3528-size chips, 5 m, 600 LED, 25 mm segments) from the usual eBay supplier, who promptly charged for both and shipped only the warm-white reel. Cool-white LEDs will be a better color match to daylight from the window and the little Ottlite she uses for detail work, but I ran some prototypes while we wait for the replacement.

    The Chinese New Year really comes in handy as an excuse for screwing things up and not responding for a week or two. ‘Nuff said.

    They’re similar to the RGB LEDs from a while ago, with even gummier “waterproof” encapsulation. I got double-density 600 LED strips to put more light emitters across the arm:

    Various LED strip lights
    Various LED strip lights

    The smaller 3528 SMD LEDs (vs. 5050 chips in the others) allow a narrower strip and the double-density layout means each three-LED segment is half as long long. The as-measured dimensions work out to:

    • 25.0 mm segment length
    • 8.2 mm strip width
    • 2.5 mm thickness

    The sealant thickness varies considerably, so I’d allow 3.0 mm for that in case it mattered. It slobbers over the edge of the strip here and there; allowing at least 9.0 mm would be wise.

    The SMD resistor in each segment is 150 Ω. A 5 segment length drew 85 mA @ 12 V = 17 mA/segment. Boosting the voltage to 12.8 V got the current to the expected 100 mA = 20 mA/segment.

    The LEDs are noticeably less bright than the 5050 LEDs, even at 20 mA/segment, but I think they’ll suffice for the task.

  • Casio EX-Z850 Backup Battery Replacement

    When our Larval Engineer repaired the Casio EX-Z850 camera’s buttons, we noticed that the memory backup battery was on its last legs:

    EX-Z850 internal battery corrosion
    EX-Z850 internal battery corrosion

    The camera has returned home, where I’ll put it to good use on the microscope, but I’m the type of guy who swaps batteries every now and again, soooo that needs fixing. Wikipedia says the battery isn’t replaceable, but you can’t believe everything you read on Wikipedia, right?

    Removing the camera’s front cover (stick the screws to a length of masking tape!) reveals the backup battery hasn’t magically healed itself:

    Casio EX-Z850 backup battery - corrosion
    Casio EX-Z850 backup battery – corrosion

    The main battery applies 3.2 V with the top terminal negative; it’s marked to help me remember that fact.

    I snipped both legs of the top contact bracket, which promptly fell off, and then pushed the battery off its bottom contact. The condition of those two pads suggests a pair of cold solder joints (clicky for more dots):

    Casio EX-Z850 backup battery - contact pads
    Casio EX-Z850 backup battery – contact pads

    I wanted to replace it with a polyacene supercap, but there’s just not enough room in there. The biggest cap that fit was a 33 μF 16 V SMD electrolytic cap, so I soldered one in place:

    Casio EX-Z850 backup battery - capacitor replacement
    Casio EX-Z850 backup battery – capacitor replacement

    I had to flip the camera around to get the soldering iron in between the cap and what looks to be an intrusion monitoring switch just to its left. No lie, that shiny metal thing seems to be a tab that presses against the front cover; it could be a static discharge / grounding point, but the base looks more complex than that.

    Now, a capacitor isn’t a battery, but memory backup doesn’t require much of a battery, either. I guesstimated the memory (or whatever) would draw a few microamps, at most, giving me a few seconds, at least, to swap batteries. A quick measurement shows that I’ll have plenty of time:

    Casio EX-X850 backup capacitor - voltage vs time
    Casio EX-X850 backup capacitor – voltage vs time

    The camera started up fine after that adventure, so the memory stays valid with the backup voltage down around 1 V.

    The cap measured 34 μF, so a voltage decline of 24 mV/s works out to:

    IC = C (dV/dT) = 34 μF x 24 mV/s = 820 nA

    So, at least at room temperature, the memory draws less than a microamp.

    I love it when a plan comes together!

    With any luck, that capacitor should outlast the rest of the camera. It’ll definitely outlast a lithium battery, even if I could find one to fit in that spot.

    I did those measurements by sampling the capacitor, rather than holding the meter probes in place, because the 300 nA of current drawn by a 10 MΩ input resistance would cause a pretty large measurement error…

  • Can Opener Gear Rebuild

    Cleaning up the wrecked gears on the can opener made it painfully obvious that I had to conjure at least one gear to get the poor thing working again:

    Can opener - gears and cutters
    Can opener – gears and cutters

    Fortunately, those are more in the line of cogs, rather than real gears, so I decided a crude hack would suffice: drill a pattern of holes to define the openings between the teeth, file / grind the teeth reasonably smooth, and then tweak the shape to suit.

    Fitting some small number-size drills between the remains of the teeth showed:

    • A #52 = 52.0 mil = 1.32 mm drill matched the root curvature
    • A #28 = 140.5 mil = 3.57 mm drill was tangent to the small drill and the tooth walls

    Neither of those count as precision measurements, particularly given the ruined teeth, but they’re close enough for a first pass.

    The OEM drive gear (on the right) has the teeth bent upward to mate with the cutter gear (on the left), but under normal gripping force, the teeth don’t mesh securely and tend to slide over / under / past each other. However, if I were to cut the drive gear from a metal sheet that’s thick enough to engage both the root and the crest of the cutter gear, that should prevent all the slipping & sliding. Some eyeballometric guesstimation suggested 2.5 mm would be about right and the Basement Laboratory Stockpile produced a small slab of 100 mil = 2.54 mm aluminum sheet.

    However, the center part of the gear must have the same thickness as the OEM gear to keep the drive wheel at the same position relative to the cutter blade, which means a bit of pocket milling. I have some small ball burrs that seemed like they might come in handy.

    A recent thread on the LinuxCNC mailing list announced Bertho Stultien’s gcmc, the G-Code Meta Compiler, and this looked like a golden opportunity to try it out. Basically, gcmc lets you write G-Code programs in a C-like language that eliminates nearly all the horrendous syntactic noise of raw G-Code. I like it a lot and you’ll be seeing more of it around here…

    The gcmc source code, down below, include a function that handles automatic tool height probing, using that simple white-goods switch. The literal() function emits whatever you hand it as text for the G-Code file, which is how you mechanize esoteric commands that gcmc doesn’t include in its repertoire. It’s basically the same as my bare G-Code probe routine, but now maintains a state variable that eliminates the need for separate first-probe and subsequent-probe entry points.

    One point that tripped me up, even though I should know better: because gcmc is a compiler, it can’t read G-Code parameters that exist only when LinuxCNC (or whatever) is interpreting the G-Code. You can write parameters with values computed at compile time, but you can’t read and process them in the gcmc program.

    Anyhow, the first pass produced an array of holes that, as I fully expected, weren’t quite right:

    Can opener gear - first hole pattern
    Can opener gear – first hole pattern

    The second pass got the root and middle holes tangent to each other:

    Can opener gear - second hole pattern
    Can opener gear – second hole pattern

    It also ran a center drill pass for those tiny little holes to prevent their drill from wandering about. The other drills are about the same size as the center drill, so they’re on their own.

    The rosette around the central hole comes from sweeping the burr in a dozen overlapping circles tangent to the outer diameter, then making a cleanup pass around the OD:

    Can opener gear - 12 leaf rosette
    Can opener gear – 12 leaf rosette

    Incidentally, that stray hole between the two patterns came from the aluminum sheet’s previous life, whatever it may have been. There are three other holes, two of which had flat washers taped to them, so your guess is as good as mine. That’s my story and I’m sticking with it.

    Introducing the sheet to Mr Bandsaw and cutting through the outer ring produced a bizarre snowflake:

    Can opener gear - cut out
    Can opener gear – cut out

    Cutting off the outer ring of holes turned the incipient gear body into a ragged shuriken:

    Can opener gear - isolated
    Can opener gear – isolated

    A few minutes of increasingly deft Dremel cutoff wheel work, poised on the bench vise over the shopvac nozzle to capture the dust, produced a credible gear shape:

    Can opener gear - first pass
    Can opener gear – first pass

    Iterating through some trial fits, re-grinds, and general fiddling showed that the center pocket was too shallow. The cutter wheel should slightly clear the drive wheel, but it’s an interference fit:

    Can opener gear - trial fit
    Can opener gear – trial fit

    Which, of course, meant that I had to clamp the [mumble] thing back in the Sherline and re-mill the pocket. The trick is to impale it on the wrong end of a suitable drill, clamp it down, and touch off that spot as the origin:

    Can opener gear - re-centering
    Can opener gear – re-centering

    I took the opportunity to switch to a smaller ball and make 16 little circles to clear the pocket:

    Can Opener Gear - 16 leaf rosette
    Can Opener Gear – 16 leaf rosette

    Now that’s better:

    Can opener gear - deeper pocket
    Can opener gear – deeper pocket

    Another trial fit showed that everything ended up in the right place:

    Can opener gear - final fit
    Can opener gear – final fit

    I gave it a few cranks, touched up any cogs that clashed with the (still misshapen) cutter gear, applied it to a randomly chosen can, and it worked perfectly:

    • Squeeze the levers to easily punch through the lid
    • Crankety crank on the handle, while experiencing none of the previous drama
    • The severed lid falls into the can

    Which is exactly how it’s supposed to work. What’s so hard about that?

    What you can’t see in that picture is the crest of the lowest cutter gear tooth fitting just above the bottom of the drive gear root. Similarly, the crest of the highest drive gear tooth remains slightly above the cutter root. That means the cutter gear teeth always engage the drive gear, there’s no slipping & sliding, and it’s all good.

    Aluminum isn’t the right material for a gear-like object meshed with a steel counterpart, but it’s easy to machine on a Sherline. I’ll run off a few more for show-n-tell and, if when this one fails, I’ll have backup.

    The gcmc source code:

    // Can opener drive gears
    //	Ed Nisley KE4ZNU - February 2014
    //	Sherline CNC mill with tool height probe
    //	XYZ touchoff origin at center on fixture surface
    
    DO_DRILLCENTER	= 1;
    DO_MILLCENTER	= 1;
    DO_DRILLINNER	= 1;
    DO_DRILLOUTER	= 1;
    DO_DRILLTIPS	= 1;
    
    //----------
    // Overall dimensions
    
    GearThick = 2.54;			// overall gear thickness
    GearCenterThick = 1.75;		// thickness of gear center
    
    GearTeeth = 12;				// number of teeth!
    ToothAngle = 360deg/GearTeeth;
    GearOD = 22.0;				// tooth tip
    GearID = 13.25;				// tooth root
    
    SafeZ = 20.0;				// guaranteed to clear clamps
    TravelZ = GearThick + 1.0;	// guaranteed to clear plate
    
    //----------
    // Tool height probe
    //	Sets G43.1 tool offset in G-Code, so our Z=0 coordinate always indicates the touchoff position
    
    ProbeInit = 0;					// 0 = not initialized, 1 = initialized
    ProbeSpeed = 400.0mm;
    ProbeRetract = 1.0mm;
    
    PROBE_STAY = 0;					// remain at probe station
    PROBE_RESTORE = 1;				// return to previous location after probe
    
    function ProbeTool(RestorePos) {
    
    local WhereWasI;
    
    	WhereWasI = position();
    
    	if (ProbeInit == 0) {		// probe with existing tool to set Z=0 as touched off
    		ProbeInit++;
    		literal("#<_Probe_Speed> = ",to_none(ProbeSpeed),"\n");
    		literal("#<_Probe_Retract> = ",to_none(ProbeRetract),"\n");
    		literal("#<_ToolRefZ> = 0.0 \t; prepare for first probe\n");
    		ProbeTool(PROBE_STAY);
    		literal("#<_ToolRefZ> = #5063 \t; save touchoff probe point\n");
    		literal("G43.1 Z0.0 \t; set zero offset = initial touchoff\n");
    	}
    	elif (ProbeInit == 1) {		// probe with new tool, adjust offset accordingly
    		literal("G49 \t; clear tool length comp\n");
    		literal("G30 \t; move over probe switch\n");
    		literal("G59.3 \t; use coord system 9\n");
    		literal("G38.2 Z0 F#<_Probe_Speed> \t; trip switch on the way down\n");
    		literal("G0 Z[#5063 + #<_Probe_Retract>] \t; back off the switch\n");
    		literal("G38.2 Z0 F[#<_Probe_Speed> / 10] \t; trip switch slowly\n");
    		literal("#<_ToolZ> = #5063 \t; save new tool length\n");
    		literal("G43.1 Z[#<_ToolZ> - #<_ToolRefZ>] \t; set new length\n");
    		literal("G54 \t; return to coord system 0\n");
    		literal("G30 \t; return to safe level\n");
    	}
    	else {
    		error("*** ProbeTool sees invalid ProbeInit: ",ProbeInit);
    		comment("debug,*** ProbeTool sees invalid ProbeInit: ",ProbeInit);
    		ProbeInit = 0;
    	}
    
    	if (RestorePos == PROBE_RESTORE) {
    		goto(WhereWasI);
    	}
    
    }
    
    //----------
    // Utility functions
    
    function WaitForContinue(MsgStr) {
    	comment(MsgStr);
    	pause();
    }
    
    function CueToolChange(MsgStr) {
    	literal("G0 Z" + SafeZ + "\n");
    	literal("G30\n");
    	WaitForContinue(MsgStr);
    }
    
    function ToolChange(Info,Name) {
    	CueToolChange("msg,Insert " + to_mm(Info[TOOL_DIA]) + " = " + to_in(Info[TOOL_DIA]) + " " + Name);
    	ProbeTool(PROBE_STAY);
    
    	WaitForContinue("msg,Set spindle to " + Info[TOOL_SPEED] + " rpm");
    	feedrate(Info[TOOL_FEED]);
    }
    
    function GetAir() {
    	goto([-,-,SafeZ]);
    }
    
    //-- compute drill speeds & feeds based on diameter
    //		rule of thumb is 100 x diameter at 3000 rpm for real milling machines
    //		my little Sherline's Z axis can't produce enough thrust for that!
    
    MaxZFeed = 600.0mm;				// fastest possible Z feed
    
    TOOL_DIA = 0;					// Indexes into DrillParam() result
    TOOL_SPEED = 1;					//  spindle RPM
    TOOL_FEED = 2;					//	linear feed
    TOOL_TIP = 3;					//	length of 118 degreee drill tip
    
    function DrillParam(Dia) {
    local RPM,Feed,Tip,Data,Derating;
    
    	Derating = 0.25;			// derate from (100 x diameter) max feed
    
    	RPM = 3000.0;				// default 3 k rpm
    
    	Feed = Derating * (100.0 * Dia);
    	if (Feed > MaxZFeed) {
    		RPM *= (MaxZFeed / Feed);	//  scale speed downward to fit
    		Feed = MaxZFeed;
    	}
    
    	Tip = (Dia/2) * tan(90deg - 118deg/2);
    	Data = [Dia,RPM,Feed,Tip];
    
    	message("DrillParam: ",Data);
    	return Data;
    }
    
    //-- peck drilling cycle
    
    function PeckDrill(Endpt,Retract,Peck) {
    	literal("G83 X",to_none(Endpt[0])," Y",to_none(Endpt[1])," Z",to_none(Endpt[2]),
    			" R",to_none(Retract)," Q",to_none(Peck),"\n");
    }
    
    //----------
    // Make it happen
    
    literal("G99\t;  retract to R level, not previous Z\n");
    
    WaitForContinue("msg,Verify: G30 position in G54 above tool change switch?");
    
    WaitForContinue("msg,Verify: fixture origin XY touched off at center of gear?");
    
    WaitForContinue("msg,Verify: Z touched off on top surface at " + GearThick + "?");
    ProbeTool(PROBE_STAY);
    
    //-- Drill center hole
    
    if (DO_DRILLCENTER) {
    
    	DrillData = DrillParam(5.0mm);
    	ToolChange(DrillData,"drill");
    
    	goto([0,0,-]);
    	goto([-,-,TravelZ]);
    
    	drill([0,0,-1.5*DrillData[TOOL_TIP]],TravelZ,DrillData[TOOL_DIA]);
    	GetAir();
    
    }
    
    //-- Drill inner ring
    
    if (DO_DRILLINNER) {
    
    	DrillData = DrillParam(1.32mm);
    
    	RingRadius = GearID/2.0 + DrillData[TOOL_DIA]/2.0;		// center of inner ring holes
    	HolePosition = [RingRadius,0mm,-1.5*DrillData[TOOL_TIP]];
    
    //	but first, center-drill to prevent drifting
    
    	CDData = DrillParam(1.00mm);			// pretend it's a little drill
    	CDData[TOOL_FEED] = 100mm;				//  ... use faster feed
    
    	CDPosition = HolePosition;				// use center drill coordinates
    	CDPosition[2] = GearThick - 0.25mm;		//  ... just below surface
    
    	ToolChange(CDData,"center drill");
    
    	goto([0,0,-]);
    	goto([-,-,TravelZ]);
    
    	for (Tooth = 0 ; Tooth < GearTeeth ; Tooth++) {
    		drill(CDPosition,TravelZ,2*TravelZ);		// large increment ensures one stroke
    		CDPosition = rotate_xy(CDPosition,ToothAngle);
    	}
    
    //	now drill the holes
    
    	ToolChange(DrillData,"drill");
    
    	goto([0,0,-]);
    	goto([-,-,TravelZ]);
    
    	for (Tooth = 0 ; Tooth < GearTeeth ; Tooth++) {
    		PeckDrill(HolePosition,TravelZ,DrillData[TOOL_DIA]);
    		HolePosition = rotate_xy(HolePosition,ToothAngle);
    	}
    
    	GetAir();
    
    }
    
    //-- Mill center recess
    
    if (DO_MILLCENTER) {
    
    	MillData = [4.50mm,3000,250.0mm,0.0mm];			// spherical ball burr
    
    	Delta = GearThick - GearCenterThick;							// depth to be milled away
    	Inset = sqrt(2.0*Delta*(MillData[TOOL_DIA]/2) - pow(Delta,2));	// toll axis to milled edge
    
    	ToolChange(MillData,"ball burr");
    
    	goto([0,0,-]);							// above central hole
    	goto([0,0,GearThick]);					// vertically down to flush with surface
    	move([0,0,GearCenterThick]);			// into gear blank
    
    	for (Angle = 0.0deg; Angle < 360.0deg; Angle+=360.0deg/16) {	// clear interior
    		circle_cw((GearID/2 - Inset)/2,Angle);
    	}
    
    	move_r([(GearID/2 - Inset),0.0,0.0]);							// clean rim
    	circle_ccw([0.0,0.0,GearCenterThick],2);
    
    	GetAir();
    
    }
    
    //-- Drill outer ring
    
    if (DO_DRILLOUTER) {
    
    	RingRadius += DrillData[TOOL_DIA]/2;		// at OD of inner ring holes
    
    	DrillData = DrillParam(3.18mm);
    	RingRadius += DrillData[TOOL_DIA]/2.0;		// center of outer ring holes
    	HolePosition = [RingRadius,0mm,-1.5*DrillData[TOOL_TIP]];
    
    	ToolChange(DrillData,"drill");
    
    	for (Tooth = 0 ; Tooth < GearTeeth ; Tooth++) {
    		PeckDrill(HolePosition,TravelZ,DrillData[TOOL_DIA]);
    		HolePosition = rotate_xy(HolePosition,ToothAngle);
    	}
    
    	GetAir();
    
    }
    
    //-- Drill to locate gear tooth tip end
    
    if (DO_DRILLTIPS) {
    
    	DrillData = DrillParam(4.22mm);
    
    	RingRadius = GearOD/2.0 + DrillData[TOOL_DIA]/2.0;		// tangent to gear tooth tip
    	HolePosition = [RingRadius,0mm,-1.5*DrillData[TOOL_TIP]];
    	HolePosition = rotate_xy(HolePosition,ToothAngle/2);	// align to tooth
    
    	ToolChange(DrillData,"drill");
    
    	for (Tooth = 0 ; Tooth < GearTeeth ; Tooth++) {
    		PeckDrill(HolePosition,TravelZ,DrillData[TOOL_DIA]);
    		HolePosition = rotate_xy(HolePosition,ToothAngle);
    	}
    
    	GetAir();
    
    }
    
    literal("G30\n");
    comment("msg,Done!");
    

    The original doodle that suggested the possibility:

    Can Opener Gears - Doodle 1
    Can Opener Gears – Doodle 1

    The chord equation at the bottom shows how to calculate the offset for the ball burr, although it turns out there’s no good way to measure the cutting diameter of the burr and it’s not really spherical anyway.

    A more detailed doodle with the key line at a totally bogus angle:

    Can Opener Gears - Doodle 2
    Can Opener Gears – Doodle 2

    The diagram in the lower right corner shows how you figure the length of the tip on a 118° drill point, which you add to the thickness of the plate in order to get a clean hole.

  • Sewing Machine Bulb: LED Replacement Doodle

    Mary wants more light directly around the needle of her Kenmore Model 158 sewing machine, as the existing light (a 120 V 15 W incandescent bulb tucked inside the end housing) casts more of a diffuse glow than a directed beam:

    Kenmore Model 158 Sewing Machine - lamp
    Kenmore Model 158 Sewing Machine – lamp

    The end cap fits snugly around the bulb, but I thought a pair of 10 mm white LEDs, mounted side-by-side and aimed downward at the cover plate, would work. Of course, plugging a pair of white LEDs into a 120 VAC socket won’t work, but some judicious rewiring and a new 12 V DC wall wart will take care of that.

    The bulb has a dual-contact bayonet base, with both pins isolated from the shell and connected to the non-polarized (!) line cord through the power switch. I didn’t know it was called a BA15d base, but now I do.

    A 12 V automotive brake/taillight bulb (type 1157, I think) pulled from the Big Box o’ Bulbs has a slightly different pin arrangement that keys the filaments (which are not isolated from the shell) to the surrounding reflector:

    BA15d Bayonet Bulb Bases - 120V vs. 12V pins
    BA15d Bayonet Bulb Bases – 120V vs. 12V pins

    So I conjured a mockup to see if it would fit, using 2-56 screws to mimic whatever hardware might be practical:

    BA15d Bulb - LED Adapter
    BA15d Bulb – LED Adapter

    The solid model shows how it all fits together:

    Sears Lamp LED Adapter - Show view
    Sears Lamp LED Adapter – Show view

    The two tiny ruby-red pins represent filament snippets in alignment holes, barely visible in real life:

    LED holder parts
    LED holder parts

    I glued those pieces together, using a tiny machinist’s square as a jig to keep them perpendicular:

    LED holder clamping
    LED holder clamping

    Some random 10 mm LEDs served for testing:

    BA15d Bulb - 10 mm LEDs
    BA15d Bulb – 10 mm LEDs

    It actually fit pretty well, ignoring the fact that the LEDs point 90° from the intended direction (so I could see how the holes came out inside the pivot, honest), and lit up the area quite well, but it’s such a delicate affair that removing the entire socket and replacing it with a dedicated metal bracket / heatsink for two high-power SMD LEDs will be better.

    The OpenSCAD source code:

    // Adapter for LEDs in Sears sewing machine lamp socket
    // Ed Nisley - KE4ZNU - January 2014
    
    Layout = "Show";		// Build Show LEDTab LEDPlate ShellMount
    
    //- Extrusion parameters must match reality!
    //  Print with 2 shells and 3 solid layers
    
    ThreadThick = 0.20;
    ThreadWidth = 0.40;
    
    HoleWindage = 0.2;			// extra clearance
    
    Protrusion = 0.1;			// make holes end cleanly
    Gap = 2.0;					// spacing between Show parts
    
    AlignPinOD = 1.70;			// assembly alignment pins: filament dia
    
    inch = 25.4;
    
    //----------------------
    // Dimensions
    
    //-- LED mounting plate
    
    LEDDia = 10.0;				// LED case OD
    LEDFlangeOD = 10.7;
    
    LEDPlateThick = 2.0;		// mounting plate thickness
    LEDMargin = 2.0;
    
    LEDSpaceOC = LEDDia + LEDMargin;		// LED center-to-center distance (single margin between!)
    
    LEDTabLength = 15.0;		// base to screw hole center
    
    LEDTabThick = 4.0;			// tab with hole for mounting screw
    LEDTabScrewOD = 2.0;
    LEDTabWidth = (3.0*2) + LEDTabScrewOD;
    
    LEDMountHeight = 25.0;		// estimated mounting screw centerline to bottom of LEDs
    
    //-- Lamp base adapter
    //		hard inch dimensions!
    
    ShellOD = 0.600 * inch;				// dia of metallic shell
    ShellOAL = 0.66 * inch;				//  ... total length
    ShellInsert = 7/16 * inch;			//  ... length engaging socket
    
    ShellSides = 4*4;
    
    BulbOD = 0.75 * inch;				// glass bulb
    BulbLength = 1.14 * inch;
    
    InsulOD = 0.485 * inch;				// insulating stub around contact pins
    InsulThick = 0.070 * inch;			//  ... beyond end of shell
    
    ContactOD = 2.0;					// contact holes through base (not heads)
    ContactOC = 0.300 * inch;			//  ... center-to-center spacing
    
    BayonetOD = 0.080 * inch;			// bayonet pin diameter
    BayonetOffset = 0.125 * inch;		// from end of metal base
    
    LampOAL = InsulThick + ShellOAL + BulbLength;
    echo(str("Overall Length: ",LampOAL));
    
    //-- Miscellany
    
    //----------------------
    // 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);
    }
    
    module ShowPegGrid(Space = 10.0,Size = 1.0) {
    
      Range = floor(50 / Space);
    
    	for (x=[-Range:Range])
    	  for (y=[-Range:Range])
    		translate([x*Space,y*Space,Size/2])
    		  %cube(Size,center=true);
    }
    
    //-- Tab for screw mounting LED holder
    //		AddLength remains below Z=0 for good union
    
    module LEDTab() {
    
    	difference() {
    		linear_extrude(height=LEDTabThick)
    			hull() {
    				circle(d=LEDTabWidth);
    				translate([LEDTabLength/2,0,0])
    					square([LEDTabLength,LEDTabWidth],center=true);
    			}
    		translate([0,0,-Protrusion])
    			rotate(180/6)
    				PolyCyl(LEDTabScrewOD,(LEDTabThick + 2*Protrusion),6);
    		for (i=[-1,1])
    			translate([LEDTabLength/2,i*LEDTabWidth/4,LEDTabThick/2])
    				rotate([0,90,0]) rotate(180/4)
    					PolyCyl(AlignPinOD,(LEDTabLength/2 + Protrusion),4);
    	}
    }
    
    //-- Plate holding LEDs
    
    module LEDPlate() {
    
    	difference() {
    		union() {
    			linear_extrude(height=LEDPlateThick)
    				hull() {
    					for (i=[-1,1])
    						translate([i*LEDSpaceOC/2,0,0])
    							circle(d=(LEDDia + 2*LEDMargin));
    					translate([0,(LEDFlangeOD/2 + LEDTabWidth/2),0])
    						square([LEDTabThick,LEDTabWidth],center=true);
    				}
    		}
    		for (i=[-1,1])
    			translate([i*LEDSpaceOC/2,0,-Protrusion])
    				rotate(180/12)
    					PolyCyl(LEDDia,(LEDPlateThick + 2*Protrusion),12);
    		for (i=[-1,1])
    			translate([0,(i*LEDTabWidth/4 + LEDFlangeOD/2 + LEDTabWidth/2),3*ThreadThick]) rotate(180/4)
    				PolyCyl(AlignPinOD,(LEDTabLength/2 + Protrusion),4);
    
    	}
    }
    
    //-- Bulb shell mounting adapter
    
    module ShellMount() {
    
    	difference() {
    		union() {
    			cylinder(r1=InsulOD/2,r2=ShellOD/2,h=(InsulThick + Protrusion),$fn=ShellSides);
    			translate([0,0,InsulThick])
    				cylinder(r=ShellOD/2,h=(LampOAL - LEDMountHeight + LEDTabWidth/2),$fn=ShellSides);
    		}
    
    		translate([0,ShellOD,(InsulThick + BayonetOffset)])		// bayonet pin hole
    			rotate([90,0,0]) rotate(180/4)
    				PolyCyl(BayonetOD,2*ShellOD,4);
    
    		translate([0,ShellOD,(InsulThick + LampOAL - LEDMountHeight)])		// LED mount screw hole
    			rotate([90,0,0])
    				PolyCyl(LEDTabScrewOD,2*BulbOD,6);
    
    		translate([0,0,(InsulThick + ShellOAL + LampOAL/2)])		// slot for LEDTab mount
    			cube([2*ShellOD,(LEDTabThick + 2*Protrusion),LampOAL],center=true);
    
    		for (i=[-1,1])											// contact pin holes
    			translate([i*ContactOC/2,0,-Protrusion])
    				rotate(180/6)
    					PolyCyl(ContactOD,2*LampOAL,6);
    	}
    
    }
    
    //- Build it
    
    ShowPegGrid();
    
    if (Layout == "LEDTab")
    	LEDTab();
    
    if (Layout == "LEDPlate")
    	LEDPlate();
    
    if (Layout == "ShellMount")
    	ShellMount();
    
    if (Layout == "Show") {
    	LEDPlate();
    	translate([-LEDTabThick/2,(LEDFlangeOD/2 + LEDTabWidth/2),(LEDTabLength + LEDPlateThick + Gap)])
    		rotate([0,90,0])
    			LEDTab();
    	for (i=[-1,1])
    #	translate([0,(i*LEDTabWidth/4 + LEDFlangeOD/2 + LEDTabWidth/2),(LEDPlateThick + Gap/4)])
    		rotate(180/4)
    		cylinder(r=AlignPinOD/2,h=Gap/1,$fn=4);		// fake the pins
    
    	translate([0,(LEDFlangeOD/2 + LEDTabWidth/2),(LampOAL - LEDTabWidth/2)])
    		rotate([0,180,0]) rotate(90)
    			ShellMount();
    }
    
    if (Layout == "Build") {
    	translate([0,LEDDia,0])
    		LEDPlate();
    
    	translate([-10,-(LEDMargin + LEDTabWidth),0])
    		rotate(-90)
    			LEDTab();
    
    	translate([10,-(LEDMargin + LEDTabWidth),0])
    		ShellMount();
    }
    

    The original doodles for the bulb dimensions and adapter layout:

    Bulb dimensions - adapter doodles
    Bulb dimensions – adapter doodles
  • Modified Quilting Foot: Speed Wrench Knob

    The Nyloc nut atop that modified quilting foot requires more grip than fingers can provide:

    Modified Darning Foot - in action
    Modified Darning Foot – in action

    The “precision” wrench I adapted to that nut works for small adjustments, but for larger ones it’s easier to take the foot off and spin this knob:

    Quilting Foot Knob - knurling
    Quilting Foot Knob – knurling

    It has a hex opening in each end that fits the nut, with a through hole for the bolt. The top looks exactly like you’d expect:

    Quilting Foot Knob - top
    Quilting Foot Knob – top

    The bottom needs a bit of support:

    Quilting Foot Knob - bottom support
    Quilting Foot Knob – bottom support

    The solid model shows off the support in color:

    Quilting Foot Knob
    Quilting Foot Knob

    The OpenSCAD source code doesn’t have many surprises:

    // Quilting foot knob
    // Ed Nisley KE4ZNU January 2013
    
    use <knurledFinishLib_v2.scad>
    
    //- Extrusion parameters must match reality!
    //  Print with +1 shells and 3 solid layers
    
    ThreadThick = 0.20;
    ThreadWidth = 0.40;
    
    HoleWindage = 0.2;
    
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    
    Protrusion = 0.1;			// make holes end cleanly
    
    //----------------------
    // Dimensions
    
    KnobOD = 20.0;
    KnobLength = 25.0;
    KnobSides = 12;
    
    DiamondLength = KnobLength/3;
    DiamondWidth = DiamondLength/2;
    DiamondDepth = 1.0;
    
    NutOD = 7.0;				// across flats!
    NutLength = 6.0;
    ScrewOD = 4.0;
    
    DoSupport = true;
    
    //----------------------
    // 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);
    }
    
    module ShowPegGrid(Space = 10.0,Size = 1.0) {
    
      RangeX = floor(100 / Space);
      RangeY = floor(125 / Space);
    
    	for (x=[-RangeX:RangeX])
    	  for (y=[-RangeY:RangeY])
    		translate([x*Space,y*Space,Size/2])
    		  %cube(Size,center=true);
    
    }
    
    module Knob() {
    	rotate(180/Sides) {
    		difference() {
    //			cylinder(r=KnobOD/2,h=KnobLength,$fn=KnobSides);
    			render(convexity=10)
    			knurl(k_cyl_hg=KnobLength,
    				  k_cyl_od=KnobOD,
    				  knurl_wd=DiamondWidth,
    				  knurl_hg=DiamondLength,
    				  knurl_dp=DiamondDepth,
    				  e_smooth=DiamondLength/2);
    			translate([0,0,-Protrusion])
    				PolyCyl(ScrewOD,(KnobLength + 2*Protrusion),6);
    			translate([0,0,(KnobLength - NutLength)])
    				PolyCyl(NutOD,(NutLength + Protrusion),6);
    			translate([0,0,-Protrusion])
    				PolyCyl(NutOD,(NutLength + Protrusion),6);
    		}
    	}
    }
    
    module Support() {
    	color("Yellow")
    		for (Seg=[0:5]) {
    			rotate(360*Seg/6)
    			translate([0,0,(NutLength - ThreadThick)/2])
    				cube([(NutOD - 1*ThreadWidth),
    						2*ThreadWidth,
    						(NutLength - ThreadThick)],
    						center=true);
    			}
    }
    
    //----------------------
    // Build them!
    
    ShowPegGrid();
    
    Knob();
    
    if (DoSupport)
    	Support();
    

    Mary likes it… and thinks I’m being silly. She’s right, of course.

  • Forcing Pulseaudio DisplayPort Volume Initialization

    It turns out that the audio-over-HDMI/DisplayPort channel which, for whatever reason, is the only way to get audio out of the Optiplex 980 with the big Dell U2711 monitor starts up AT MAXIMUM VOLUME! regardless of the GUI’s Pulseaudio mixer setting that’s diligently saved-and-restored across sessions. That makes a certain perverse sense, as the digital-to-analog converter & power amp live inside the monitor.

    Manually adjusting the GUI mixer by one click, either up or down, forces the new setting out over the digital link to the monitor, after which the audio output corresponds to the mixer; I never remember that until just after some dipshit auto-play video lights up with a fanfare.

    Setting the mixer to the same value doesn’t force an update, so the obvious solution (at least to me) of sending a fixed initial value doesn’t work; it’s optimized away. I think that’s why the initial update doesn’t happen: the stored volume is the same as the, ah, stored volume, so there’s no need to tell the monitor.

    The automatic solution involves putting two more commands in my ever-growing ~/.config/startup.sh:

    amixer -D pulse sset Master 26%
    amixer -D pulse sset Master 1%-
    

    That sets a rational level (which might be the same as the existing one from the previous session), then changing it by one tiny click to force the new value out to the monitor.

    And then It Just Works…