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

  • AD8310 Log Amp Module: Video Bandwidth Rolloff

    The part I didn’t understand turned out to be the bandwidth of the final output stage = “video bandwidth”, which defaults to 25 MHz. After fixing the input circuitry, a 25 MHz VBW let the output track a 60 kHz input signal just fine:

    AD8310 - modified - 60 kHz 1Vpp
    AD8310 – modified – 60 kHz 1Vpp

    Adding a 56 nF cap across the C6 terminals (just above the AD8310) lowered the VBW to about 1 kHz:

    AD8310 Log Amp module - VBW rolloff cap
    AD8310 Log Amp module – VBW rolloff cap

    Which flattened that sucker right out:

    AD8310 - 1 kHz VBW cap - 60 kHz 1.394 V
    AD8310 – 1 kHz VBW cap – 60 kHz 1.394 V

    The ripple for an absurdly high amplitude 32 kHz signal amounts to 36 mV:

    AD8310 - 1 kHz VBW cap - 32 kHz - VBW ripple
    AD8310 – 1 kHz VBW cap – 32 kHz – VBW ripple

    Firing the tracking generator into the input with a frequency sweep from 100 kHz to 250 MHz shows the low end looks much better:

    AD8310 - 1 kHz VBW cap - 100 kHz 250 MHz - 0 dB atten
    AD8310 – 1 kHz VBW cap – 100 kHz 250 MHz – 0 dB atten

    There’s a slight droop across the sweep that might amount to 50 mV = 2 dB, which I’m inclined to not worry about in this context.

    Applying the attenuators once again produces a scale factor of 23.5 mV/dB across 30 dB of RF, but this time the 60 kHz output makes sense, too.

    Using the typical output curve from AN-691, that 2.0 V output corresponds to -13 dBm, which sounds about right for the tracking generator (which might really be -10 dBm).

    I must calibrate the log amp output to find the actual intercept point (nominally -95 dBm, but could range from -86 to -102) at 60 kHz. The intercept is the extrapolated RF input producing 0 V out, which then acts as an offset for the voltage-to-dBm calculation; you start by finding the slope of the voltage vs. dBm line at some convenient power levels, then solve for dBm with V=0.

    So a cheap AD8310 Log Amp module from eBay can work in the LF band, after you rearrange the input circuitry and tweak the chip’s filters. At least now I have a better understanding of what’s going on …

  • AD8310 Log Amp Module: Corrected Input Circuit

    After puzzling over the AD8310 Log Amp module’s peculiar frequency response, I hacked up the front end circuitry to match the data sheet’s recommended layout:

    AD8310 Log Amp module - revised
    AD8310 Log Amp module – revised

    Given the intended LF crystal-measurement application, a hulking 51 Ω metal film resistor sprawled across the ground plane will work just fine. All three ceramic caps measure a bit under 1 µF; I intended to solder the input caps atop the existing 10 nF caps, but that didn’t work out well at all.

    I should harvest the InLo SMA connector to prevent anyone from mistaking it for an actual input.

    With that in place, the log amp output makes more sense:

    AD8310 - modified - 100 kHz 150 MHz - 0 dB atten
    AD8310 – modified – 100 kHz 150 MHz – 0 dB atten

    That trace tops out at 150 MHz, not the previous 500 MHz, but now the response is flat all the way out. The log amp generates plenty of hash when the tracking generator isn’t producing a valid signal.

    The 60 kHz response looks different:

    AD8310 - modified - 60 kHz 1Vpp
    AD8310 – modified – 60 kHz 1Vpp

    So it’s really the log amp response to the absolute value of the sine wave (or, more accurately, to the sine wave re-zeroed around Vcc/2), with minimum output at the input’s zero crossings. At 500 mV/div, the log amp says the input varies by 42 dB = 1000 mV/(24 mV/dB), which might actually be about right for a zero-crossing (or zero-approaching absolute value of a) signal; logarithms don’t deal well with zeros.

    The AD8310 datasheet  and AN-691 suggest the 2.5 V output corresponds to +10 dBm = 12.5 Vrms input, which flat-out isn’t the case. However, the actual 500 mVpeak = 350 mVrms input is 2.5 mW = +4 dBm, so maybe it’s within spitting distance of being right.

    AN-691 recommends 10 µF input caps for “low frequency” use, showing results down to 20 Hz; 1 µF seems to get the circuit close enough to the goal for use near 60 kHz.

    It also recommends a cap on the BFIN pin (pin 6) to reduce the output stage bandwidth = “video bandwidth” and improve the overall accuracy, which remains to be done. The datasheet suggests rolling VBW off at 1/10 the minimum input frequency, which would be around 3 kHz for use with 32.768 kHz crystals. The equation, with reference to the internal 3 kΩ bias resistor:

    CFILT = 1/(2π 3 kΩ VBW) – 2.1 pF = 18 nF

    For a bit more margin, 1 kHz would require 56-ish nF.

    The PCB has a convenient pair of pads labeled C6 for that capacitor. This may require protracted rummaging in the SMD capacitor stash.

    Rolling off the VBW should reduce the hash on the 100 kHz end of the frequency sweep and filter the 60 kHz response down to pretty much a DC level.

    Applying the 10 dB and 20 dB SMA attenuators to the input from the tracking generator and recording the log amp output voltage produces this useful table:

    AD8310 Log Amp - mods and log response
    AD8310 Log Amp – mods and log response

    With the terminating resistor on the correct side of the input caps, the log amp seems to be working the way it should, with an output varying a bit under the nominal 24-ish mV/dB over a 30 dB range.

    We need caps! Lots of caps!

    A quick search with the obvious keywords suggests nobody else has noticed how these modules work over a reasonable bandwidth. Maybe I’m the first person to use them in the LF band?

  • Zire 71 Protector: Some Things Last

    This ABS slab emerged from the Thing-O-Matic in early 2012:

    Zire 71 protector in place
    Zire 71 protector in place

    The Zire would power on whenever the switches clicked or that little joystick moved, which happened regularly enough to be annoying.

    Mary made a small case that matched the other pouches I carry around:

    Belt pack - camera case - PDA case
    Belt pack – camera case – PDA case

    She made the case to fit an HP48 calculator, but it was close enough for the Zire.

    Time passed, the Zire died, I started carrying a Kindle Fire in another pocket, but the ABS slab provided a convenient stiffener between some Geek Scratch Paper and the various pencils / pens / markers / screwdrivers / flashlight filling the available space.

    Unfortunately, minus the backup of an electronic slab, the protector finally failed along an obvious stress riser:

    Zire 71 protector - cracked
    Zire 71 protector – cracked

    I cut a similar rectangle from a sheet of unknown flexy plastic, rounded the corners, clipped the pencils & whatnot to it, and maybe it’ll survive for a while.

  • XTC-3D Epoxy Coating: Results

    Having figured the mixing ratios, found the mixing trays, and donned my shop apron, I buttered up several iterations of the badge reel case to see how XTC-3D epoxy works on the little things around here.

    In all cases, I haven’t done any sanding, buffing, or primping, mostly because I’m not that interested in the final surface finish.

    A single coat produces a glossy finish with ripples from the printed threads:

    XTC-3D - Hilbert - reflective
    XTC-3D – Hilbert – reflective

    Seen straight on, without the glare, a little speck toward the lower right corner shows that cleanliness is next to impossible around here:

    XTC-3D - lines - direct
    XTC-3D – lines – direct

    An additional coat atop a Hilbert-curve upper surface comes out somewhat smoother:

    XTC-3D - Hilbert - reflective 2
    XTC-3D – Hilbert – reflective 2

    Another view, with less glare, shows the pattern a bit better:

    XTC-3D - Hilbert - reflective 1
    XTC-3D – Hilbert – reflective 1

    With no glare, the 3D Honeycomb infill shows through the surface:

    XTC-3D - Hilbert - direct
    XTC-3D – Hilbert – direct

    Coating the surface with epoxy definitely makes it more transparent / less translucent by filling in the air gaps.

    The sides of that part have only one coat and still show typical 3D printed striations.

    Three coats wipe out the striations, along with all other surface detail:

    XTC-3D - Bezel - front oblique
    XTC-3D – Bezel – front oblique

    The bolt head recesses collected enough epoxy to require reaming / milling, which certainly isn’t what you want in that situation. The bolt holes also shrank, although my usual hand-twisted drill would probably suffice to clear the epoxy.

    Another view shows a glint from the smooth surface filling the upper-right recess:

    XTC-3D - Bezel - front
    XTC-3D – Bezel – front

    Three coats definitely hides the 3D printed threads, although you can see some ridges and edges:

    XTC-3D - heavy - oblique
    XTC-3D – heavy – oblique

    The epoxy isn’t perfectly self-leveling, probably due to my (lack of) technique:

    XTC-3D - heavy - reflection
    XTC-3D – heavy – reflection

    Blowing out the contrast shows the surface finish:

    XTC-3D - heavy - direct - boost
    XTC-3D – heavy – direct – boost

    Those scratches come from fingernails, after the overnight curing time. The surface is hard, but not impervious to scratching, which is about what you’d expect for a clear epoxy.

    Slightly over-thinning the XTC-3D with denatured alcohol in a 0.7 : 0.3 : 0.3 by weight ratio produced a watery liquid that penetrated directly into the surface:

    XTC-3D - thinned - oblique
    XTC-3D – thinned – oblique

    The finish depends critically on what’s below the surface and how much epoxy you apply. I tried to spread it uniformly with a foam brush, but the center came out somewhat rougher than the outer edge:

    XTC-3D - thinned - oblique
    XTC-3D – thinned – oblique

    The striations along the sides filled in a bit, but surely not enough to satisfy anybody who worries about such things.

    A specular reflection shows the changing surface smoothness:

    XTC-3D - thinned - oblique reflective
    XTC-3D – thinned – oblique reflective

    Perhaps two coats of thinned epoxy would produce a watertight / airtight part, without changing the overall dimensions by very much. The mechanical properties depend almost entirely on the plastic-to-plastic bond, so I doubt a thin epoxy layer would improve its pressure-handling capabilities.

    Few of the parts I make will benefit from an epoxy coating and I definitely don’t want to get into post-processing the parts just to improve their looks!

  • Wearable LED vs. Astable Multivibrator vs. Dead Lithium Cells

    Mashing the wearable LED from the completely dead CR2032 cell with a classic astable multivibrator circuit and a not-dead-yet CR123 cell produced a pure-analog desktop blinky:

    CR123A Astable - front
    CR123A Astable – front

    Of course, I managed to swap the base resistors, which meant the LED stayed on most of the time, which accounts for the slightly off-kilter brown resistor just under the LED.

    It doesn’t look like much with the LED off:

    CR123A Astable - top - off
    CR123A Astable – top – off

    Running from a 2.8 V (= dead) lithium cell, the LED lights a dark room at 3 mA:

    CR123A Astable - top - on
    CR123A Astable – top – on

    The LTSpice schematic gives the details:

    Astable Multivibrator - CR2032 - schematic
    Astable Multivibrator – CR2032 – schematic

    The LED definitely didn’t come from Nichia and the 2N3704 transistors aren’t the 2N3904s found in the LTSpice library, but, by and large, this is the kind of circuit where nearly anything will work.

    The actual LED current obviously depends critically on the particular LED and the cell voltage, so this represents more of a serving suggestion than an actual prediction:

    Astable Multivibrator - CR2032 - waveform
    Astable Multivibrator – CR2032 – waveform

    Indeed, a Tek current probe clamped around one of those 10 AWG copper wires shows a much more enthusiastic LED current (1 mA/div):

    Astable - CR123A 2.8 V - 1 mA -green
    Astable – CR123A 2.8 V – 1 mA -green

    I don’t trust the baseline very much. The simulation & back of the envelope agree: the LED-off current should be around 400 µA (which doesn’t depend on the LED at all), so it’s in the right ballpark.

    Your mileage will definitely differ.

    It runs without a trace of software, which everybody at Squidwrench thought was wonderful …

  • XTC-3D Epoxy Coating

    The striations inherent in the DIY-grade 3D printing process don’t bother me all that much, but I got some XTC-3D epoxy to see what I’ve been missing. The impressive scrap pile from the badge reel holder provided test pieces:

    XTC-3D Epoxy - test pieces - holders
    XTC-3D Epoxy – test pieces – holders

    If I were serious, I’d figure out a better way to hold the parts. For now, I jammed a watch crab into the back and trapped the bezel on a watch holder, but … ick.

    Weighing the components seems the least-awful way to get the small quantities I need. The instructions recommend 100:43 by weight of resin (A) : hardener (B):

    XTC-3D Epoxy - weighing pan
    XTC-3D Epoxy – weighing pan

    For these tiny parts, 2 g + 0.9 g was way too much and 1 g + 0.4 g seemed entirely adequate. If you slowly drool resin into the pan, drool slightly less than half that much hardener, and it’ll be about as close as you can get. The hardener is much less viscous than the resin: drool carefully.

    The stuff might be self-leveling on larger parts, but on these small surfaces it’s better (IMO) to dry-brush multiple layers: you can see thicker and thinner sections in the first picture. The recoat time runs about 1-½ h.

    The instructions recommend acetone or denatured alcohol as a thinning agent, at 10 to 25% of the resin volume, with curing times up to 24 h. Alcohol seems less likely to produce Bad Results, because it won’t evaporate instantly. Neither will affect PETG, but if you’re using another plastic, keep its solvent list in mind.

    I tried alcohol with a by-weight amounts around 0.7 : 0.3 : 0.3 g, obviously overshooting both the hardener and the alcohol by a few drops. The end result resembled thick water, brushed on easily, and penetrated the surface easily.

    A first coat of thinned epoxy should fill voids and unify the surface without changing the dimensions very much, with subsequent coats leveling the striations.

    More pix after more layers and more curing …

  • Badge Lanyard Reel Mount

    A certain young engineer of my acquaintance now carries an ID badge and, so I hear, works in a PCB design & test venue. Seeing as how her favorite color is purple, this seemed appropriate:

    Badge Lanyard Reel - front - overall
    Badge Lanyard Reel – front – overall

    The guts came from Circuit Breaker Labs in the form of a recycled PCB trapped in acrylic resin atop a plastic housing with a spring-loaded reel inside.

    It arrived with a plastic bullet at the end of the lanyard:

    Badge Lanyard Reel - plastic bullet link
    Badge Lanyard Reel – plastic bullet link

    Which I immediately replaced with brass, because Steampunk:

    Badge Lanyard Reel - bullet cross-drill
    Badge Lanyard Reel – bullet cross-drill

    That made the plastic housing look weak, so, in a series of stepwise refinements, I conjured a much better case from the vasty digital deep:

    Badge Lanyard Reel - iterations
    Badge Lanyard Reel – iterations

    All of the many, many critical dimensions lie inside the case, where they can’t be measured accurately, so each of those iterations could improve only one or two features. The absolutely wonderful thing about OpenSCAD is having it regenerate the whole model after loosening, say, the carabiner slot by two thread thicknesses; you can do that with a full-on relational CAD drawing, but CAD drawings always seems like a lot of unnecessary work if I must figure out the equations anyway.

    The back sports my favorite Hilbert Curve infill with a nicely textured finish:

    Badge Lanyard Reel - rear - oblique
    Badge Lanyard Reel – rear – oblique

    It’d surely look better in solid brass with Hilbert curve etching.

    Black PETG doesn’t photograph well, but at least you can see the M2 brass inserts:

    Badge Lanyard Reel - lower interior
    Badge Lanyard Reel – lower interior

    The first prototype showed the inserts needed far more traction than the usual reamed holes could provide, so I added internal epoxy grooves in each hole:

    Badge Lanyard Reel Mount - show
    Badge Lanyard Reel Mount – show

    Recessing the screw heads into the top plate made them more decorative and smoother to the touch. Button-head screws would be even smoother, but IMO didn’t look quite as bold.

    After seeing how well the grooves worked, I must conjure a module tabulating all the inserts on hand and automagically generating the grooves.

    The yellow star holds up the roof of the reel recess in the build layout:

    Badge Lanyard Reel Mount - build layout - bottom
    Badge Lanyard Reel Mount – build layout – bottom

    Slic3r produced the rest of the support material for the carabiner exit slot:

    Badge Lanyard Reel Mount - bottom - Slic3r support
    Badge Lanyard Reel Mount – bottom – Slic3r support

    Those two support lumps on the right don’t actually support anything, but tweaking the support settings to disable them also killed the useful support on the left; come to find out Slic3r’s modifier meshes don’t let you disable support generation.

    The top plate required support all the way around the inside of the bezel:

    Badge Lanyard Reel Mount - top - Slic3r support
    Badge Lanyard Reel Mount – top – Slic3r support

    I carved the original plastic housing in half, roughly along its midline, and discarded the bottom section with the belt clip (it’s on the far left of the scrap pile). The top section, with PCB firmly affixed, holds the lanyard reel and anchors the retracting spring in a central slotted peg. No pictures of that, as it’s either a loose assembly of parts or a spring-loaded bomb and I am not taking it apart again.

    The lanyard passes through an eyelet that pays it out to the rotating reel. I’d definitely do that differently, were I building it from scratch, because mounting the eyelet in exactly the proper position to prevent the lanyard from stacking up on the reel and jamming against the inside of the housing turned out to be absolutely critical and nearly impossible.

    The top plate presses the original housing against the carabiner, with the cut-off section inside the carabiner’s circular embrace, which just barely worked: the PCB bezel is a millimeter smaller than the shoulder of the housing.

    All in all, I think it came out really well for a 3D printed object made by a guy who usually builds brackets:

    Badge Lanyard Reel - front - oblique
    Badge Lanyard Reel – front – oblique

    I hope she likes it …

    The OpenSCAD source code as a GitHub Gist:

    // Badge Lanyard Reel Mount
    // Ed Nisley KE4ZNU April 2017
    // Reel center at origin, lanyard exit toward +X
    Layout = "Show";
    Support = true;
    //- Extrusion parameters must match reality!
    ThreadThick = 0.20;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    Protrusion = 0.05; // make holes end cleanly
    inch = 25.4;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    //———————-
    // Dimensions
    ID = 0; // for round things
    OD = 1;
    LENGTH = 2;
    Carabiner = [30.7,35.3,3.5]; // metal carabiner around original reel
    Latch = [6.0,-15,8.0]; // wire spring latch: offset from OD + thickness
    LatchAngle = 60; // max deflection angle to center from -X direction
    LatchPoints = [[0,0],
    [Latch[1]/tan(LatchAngle),0],
    [Latch[1]/tan(LatchAngle),-Latch[1]]]; // polygon in as-cut orientation
    echo(str("Latch polygon: ",LatchPoints));
    Screw = [2.0,3.8 + 0*ThreadWidth,10.0]; // M2 screw: ID = clear, OD = head
    ScrewHeadLength = 2.0;
    ScrewSides = 8;
    ScrewRecess = 5*ThreadThick;
    MountSides = ScrewSides; // suitably gritty corners
    MountThick = Screw[LENGTH] / cos(180/MountSides) + ScrewRecess + 2.0;
    Insert = [Screw[ID],3.4,4.0]; // brass insert for screws
    BCD = Carabiner[OD] + 2.5*Insert[OD];
    BoltAngles = [20,110]; // ± angles to bolt holes
    Reel = [5.3,25.5 + 2*ThreadWidth,6.0 + 2*ThreadThick]; // lanyard cord reel
    ShimThick = 2*ThreadThick; // covers open side of reel for better sliding
    Bezel = [31.0,32.0,7.5]; // PCB holder + shell, LENGTH = post + shell
    BezelSides = 6*4;
    BezelBlock = [5.5,7.5,3.6] + [ThreadWidth,ThreadWidth,ThreadThick]; // block around lanyard eyelet
    Eyelet = [3.5,4.5,3.0];
    Bullet = [2.0,6.5,2.0]; // brass badge holder, LENGTH = recess into mount
    //———————-
    // 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);
    }
    //– Lanyard reel mockup
    module Reel() {
    cylinder(d=Reel[OD],h=Reel[LENGTH],center=true,$fn=6*4);
    }
    // Carabiner metal mockup
    // Some magic numbers lie in wait
    module Beener() {
    difference() {
    hull() {
    cylinder(d=Carabiner[OD],
    h=Carabiner[LENGTH] + 2*ThreadThick,
    center=true,$fn=BezelSides);
    translate([-Carabiner[OD]/2,0,0])
    cylinder(d=Carabiner[OD] – 2.0,
    h=Carabiner[LENGTH] + 2*ThreadThick,
    center=true,$fn=6*4);
    }
    cylinder(d=Carabiner[ID],
    h=2*Carabiner[LENGTH],
    center=true,$fn=BezelSides);
    translate([Carabiner[ID]/4,0,0])
    cube([Carabiner[ID],7.0,2*Carabiner[LENGTH]],center=true);
    }
    }
    // mockup of PCB holder atop remains of old mount with reel post
    // Z = 0 at midline of case
    module BezelMount() {
    rotate(180/BezelSides) {
    PolyCyl(Bezel[ID] + HoleWindage,MountThick,BezelSides); // PCB punches through mount
    PolyCyl(Bezel[OD] + HoleWindage,Bezel[LENGTH] – Reel[LENGTH]/2,BezelSides);
    }
    translate([Reel[OD]/2,0,BezelBlock[2]/2])
    scale([2,1,1])
    cube(BezelBlock,center=true);
    }
    // Main mount around holder & carabiner
    module Mount(Section="All") {
    render()
    difference() {
    hull() {
    for (a = BoltAngles) // spheres defining corners
    for (i=[-1,1])
    rotate(i*a)
    translate([BCD/2,0,0])
    sphere(d=MountThick,$fn=MountSides);
    cylinder(d=Carabiner[OD] + 4*ThreadWidth,
    h=MountThick,center=true); // capture carabiner ring
    }
    for (a = BoltAngles) // screw & insert holes, head recess
    for (i=[-1,1])
    rotate(i*a)
    translate([BCD/2,0,0])
    rotate(0*i*180/ScrewSides) {
    translate([0,0,-(Insert[LENGTH] + 2*ThreadThick)])
    PolyCyl(Insert[OD],
    Insert[LENGTH] + 2*ThreadThick + Protrusion,ScrewSides);
    for (k = [-2:2]) // epoxy retaining grooves
    translate([0,0,-(k*3*ThreadThick + Insert[LENGTH]/2)])
    PolyCyl(Insert[OD] + 1*ThreadWidth,
    2*ThreadThick,ScrewSides);
    PolyCyl(Screw[ID],Screw[LENGTH],ScrewSides);
    translate([0,0,MountThick/2 – ScrewRecess]) // recess screw heads
    PolyCyl(Screw[OD],Screw[LENGTH],ScrewSides);
    }
    translate([0,0,-1*ThreadThick]) // Minkowski Z extends only top surface!
    minkowski() { // space for metal carabiner
    Beener();
    // cube([ThreadWidth,ThreadWidth,2*ThreadThick]);
    cylinder(d=ThreadWidth,h=2*ThreadThick,$fn=6);
    }
    rotate([0,90,0]) rotate(180/6) // cord channel = brass tube clearance
    PolyCyl(Bullet[ID],Carabiner[ID],6);
    translate([Eyelet[LENGTH] + 2.0,0,0]) // eyelet, large end inward
    rotate([0,90,0]) rotate(180/6)
    PolyCyl(Eyelet[OD] + HoleWindage, Reel[OD]/2,6);
    if (false)
    translate([Reel[OD]/2 + Eyelet[LENGTH]/2,0,0]) // eyelet, small end outward
    rotate([0,90,0]) rotate(180/6)
    PolyCyl(Eyelet[ID],Eyelet[LENGTH],6);
    translate([(BCD/2 + MountThick/2)*cos(BoltAngles[0]) – Bullet[LENGTH],0,0]) // bullet recess
    rotate([0,90,0]) rotate(180/6)
    PolyCyl(Bullet[OD],Carabiner[ID],6);
    BezelMount(); // PCB holder clearance
    Reel(); // reel clearance
    translate([0,0,-(Reel[LENGTH] + ShimThick)/2]) // sliding plate on open side of reel
    cylinder(d=Reel[OD],h=ShimThick,center=true,$fn=6*4);
    translate([-Carabiner[OD]/2 + Latch[0],Latch[1],0])
    linear_extrude(height=Latch[2],center=true)
    polygon(LatchPoints);
    if (Section == "Upper") // display & build section cutting
    translate([0,0,-2*Carabiner[LENGTH]])
    cube(4*Carabiner,center=true);
    else if (Section == "Lower")
    translate([0,0,2*Carabiner[LENGTH]])
    cube(4*Carabiner,center=true);
    }
    if (Support) { // Completely ad-hoc support structures
    color("Yellow", Layout == "Show" ? 0.3 : 1.0) {
    if (false && Section == "Upper") {
    Spokes = BezelSides;
    Offset = 6*ThreadWidth;
    for (i = [2:Spokes – 2])
    rotate(i * 360/Spokes)
    translate([Offset,-ThreadWidth,0*(Carabiner[LENGTH]/2)/2])
    cube([Carabiner[OD]/2 – Offset – 0*ThreadWidth,
    2*ThreadWidth,
    Carabiner[LENGTH]/2],center=false);
    for (i = [0:Spokes – 1])
    rotate(i * 360/Spokes)
    translate([Offset,-ThreadWidth,0])
    cube([Bezel[OD]/2 – Offset,
    2*ThreadWidth,
    Bezel[LENGTH] – Reel[LENGTH]/2 – 2*ThreadThick],center=false);
    Bars = 7;
    render()
    difference() {
    union() {
    for (i = [-floor(Bars/2) : floor(Bars/2)])
    translate([-Carabiner[ID]/2,i*Carabiner[OD]/Bars,Carabiner[LENGTH]/4])
    cube([Carabiner[ID]/3,2*ThreadWidth,Carabiner[LENGTH]/2],center=true);
    translate([-Carabiner[ID]/2,0,ThreadThick/2])
    cube([Carabiner[ID]/3,Carabiner[ID],ThreadThick],center=true);
    }
    cylinder(d=Carabiner[ID] + 2*ThreadWidth,h=Carabiner[LENGTH]);
    }
    }
    if (Section == "Lower") {
    translate([0,0,-(Reel[LENGTH]/4 + ShimThick/2 – ThreadThick/2)])
    for (i = [0:8])
    rotate(i * 360/8)
    cube([Reel[OD] – 2*ThreadWidth,
    2*ThreadWidth,
    Reel[LENGTH]/2 + ShimThick – ThreadThick],center=true);
    if (false) {
    Bars = 7;
    render()
    difference() {
    union() {
    for (i = [-floor(Bars/2) : floor(Bars/2)])
    translate([-Carabiner[ID]/2,i*Carabiner[OD]/Bars,-Carabiner[LENGTH]/4])
    cube([Carabiner[ID]/3,2*ThreadWidth,Carabiner[LENGTH]/2],center=true);
    translate([-Carabiner[ID]/2,0,-ThreadThick/2])
    cube([Carabiner[ID]/3,Carabiner[ID],ThreadThick],center=true);
    }
    translate([0,0,-Carabiner[LENGTH]])
    cylinder(d=Carabiner[ID] + 0*ThreadWidth,h=Carabiner[LENGTH]);
    }
    }
    }
    }
    }
    }
    //———————-
    // Build it
    if (Layout == "Beener")
    Beener();
    if (Layout == "Mount")
    Mount();
    if (Layout == "Reel")
    Reel();
    if (Layout == "BezelMount")
    BezelMount();
    Gap = 25;
    if (Layout == "Show") {
    translate([0,0,Gap/2])
    Mount("Upper");
    translate([0,0,-Gap/2])
    Mount("Lower");
    color("Green",0.3)
    Beener();
    color("Brown",0.3)
    Reel();
    color("Red",0.3)
    translate([0,0,-(Reel[LENGTH] + ShimThick)/2])
    cylinder(d=Reel[OD],h=ShimThick,center=true,$fn=6*4);
    }
    if (Layout == "Build") {
    translate([(BCD + MountThick)/2,0,0])
    rotate(180)
    Mount("Upper");
    rotate([180,0,0])
    translate([-(BCD + MountThick)/2,0,0])
    Mount("Lower");
    }
    if (Layout == "BuildUpper")
    Mount("Upper");
    if (Layout == "BuildLower")
    rotate([180,0,0])
    Mount("Lower");