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

  • Laser Cutter: LightBurn Camera Accuracy

    Laser Cutter: LightBurn Camera Accuracy

    After going through the LightBurn camera alignment / calibration process, I thought it would be interesting to see how well the corrected image matches the design grid.

    Burn some holes and draw lines 10 mm in from the physical corners, like this:

    LB Camera Cal - corner target
    LB Camera Cal – corner target

    Burn holes and lay in a 10 mm grid at the center point:

    LB Camera Cal - center grid
    LB Camera Cal – center grid

    The center grid as seen through the camera:

    LB Camera Cal - center grid overlay
    LB Camera Cal – center grid overlay

    That’s after adjusting the X and Y offset to align the center of the imaged grid with the center of the design grid. That’s using the non-faded image to make the target lines more visible.

    The corner markers don’t quite line up with the grid, but they’re not off by much (using the faded image to make the grid more visible):

    • LB platform overlay - adj - rear left
    • LB platform overlay - adj - rear right
    • LB platform overlay - adj - front left
    • LB platform overlay - adj - front right

    You could, of course, split the difference among all five sites, but I think having the middle of the platform be more accurate than the far corners makes more sense.

    In any event, a few millimeters works for most purposes, even if you’d want to verify the alignment for critical operations before firing the laser in earnest.

  • Laser Cutter: LightBurn Camera Calibration

    Laser Cutter: LightBurn Camera Calibration

    Going through the LightBurn lens calibration and camera alignment routine produces an orthographic view of the laser platform from a camera with an ordinary lens perched somewhere above it.

    Early on, I stuck a camera to the lid of my OMTech 60 W laser:

    OMTech Laser - camera mount
    OMTech Laser – camera mount

    The uncorrected view from the camera (through VLC):

    LB Uncorrected Camera View
    LB Uncorrected Camera View

    After calibration and alignment, LightBurn underlays this view of the platform behind the workspace:

    LB Corrected Camera View
    LB Corrected Camera View

    The correction depends critically on the camera maintaining its position / orientation / focus, which turns out to be a bad assumption for the camera I’ve been using, because the (metal) focus locking screw binds directly on the (metal) lens threads. This works, until vibrations slightly loosen the screw and the lens shifts ever so slightly.

    After noticing the focus had shifted again, I tucked a snippet of silicone insulation from some 30 AWG hookup wire into the screw hole to compress against the lens thread, then re-did the entire sequence with some attention to detail.

    Pulsing the laser in each corner produced pinholes exactly 700×500 mm apart. One diagonal is 859.0 mm and the other is 861.5 mm, pretty close to the ideal 860.2 mm.

    Next, to measure the offsets from some known positions …

  • Tree Frog Marquetry: FAIL

    Tree Frog Marquetry: FAIL

    I thought this critter would look great in marquetry:

    Tree frog - on trash can lid
    Tree frog – on trash can lid

    Posterizing the colors to represent a few shades in my Little Box o’ Veneers simplified the problem:

    Tree frog - posterized
    Tree frog – posterized

    Applying LightBurn’s Trace tool to the various shades produced vector outlines, which I then collected together based on the veneer they should come from:

    Tree Frog vector patterns
    Tree Frog vector patterns

    Which seemed similar to my hand-drawn doodles on a larger image:

    Tree frog - sketch vs chipboard
    Tree frog – sketch vs chipboard

    Before committing to actual veneers, though, I cut the shapes from spraypainted chipboard on a small scale, which showed why this wasn’t going to work:

    Tree Frog - auto-trace chipboard
    Tree Frog – auto-trace chipboard

    It’s facing the other way because I cut the chipboard from the back side, so as to keep the colors reasonably clean and bright.

    Contrary to what I initially thought, the automagic tracing routine generates different nodes along a boundary between two colors depending on which side is selected by the color range. Because the nodes (and control points) don’t match exactly, adjacent pieces will have different border shapes and won’t quite match up. The missing pieces at the frog’s rump simply did not fit after the other parts soaked up all the tolerances in between.

    So (I think) a better way to do this requires carefully hand-tracing the borders, then using the same path (all the nodes) for adjoining pieces. This mean duplicating the borders for each of the pieces: tedious bookkeeping and layer manipulation.

    More study is needed …

  • Downgrading Yubikey-Manager

    It seems that Manjaro’s 5.0.0-1 version of the yubikey-manager crashes due to inscrutable errors, with the effect of not letting me use it to sign in at all the sites I’d set up to use TOTP authentication.

    If the previous version (4.0.9-1) were still in the pacman cache, then downgrading would be straightforward:

    sudo pacman -U /var/cache/pacman/pkg/firefox-64.0.2-1-x86_64.pkg.tar.xz

    Regrettably, I had recently cleaned things up and flushed the cache, so I had to fetch the package (and its signature) from the “y” directory of the Arch archive, then install it:

    sudo pacman -U /tmp/yubikey-manager-4.0.9-1-any.pkg.tar.zst
    
    loading packages...
    warning: downgrading package yubikey-manager (5.0.0-1 => 4.0.9-1)
    resolving dependencies...
    looking for conflicting packages...
    
    Packages (1) yubikey-manager-4.0.9-1
    
    Total Installed Size:   1.11 MiB
    Net Upgrade Size:      -0.13 MiB
    
    :: Proceed with installation? [Y/n] Y
    <<< snippage >>>

    Whereupon It Just Worked™ again.

    I expect someone more experienced than I will have long since filed a bug report / sent a pull request / whatever, because I have little idea how to do any of that. The next upgrade should work just fine.

  • LightBurn Grayscale Image Sampling

    LightBurn Grayscale Image Sampling

    Take a sine-wave grayscale pattern with one cycle across 10 pixels at 254 dpi = 10 pixel/mm:

    Sine bars - 10 cycles
    Sine bars – 10 cycles

    Then if you tell LightBurn to engrave the pattern with a line-to-line (vertical) spacing of 127 dpi = 5 pixel/mm, it will sample every other pixel in each row, producing a rather peculiar sine-ish wave:

    Tube Current - analog bandwidth - 10 sine - 25mm-s - beam off - 127dpi
    Tube Current – analog bandwidth – 10 sine – 25mm-s – beam off – 127dpi

    You must engrave at 254 dpi = 10 pixel/mm in order to get all the pixels in the output stream:

    Tube Current - analog bandwidth - 10 sine - 25mm-s - beam off - 254dpi
    Tube Current – analog bandwidth – 10 sine – 25mm-s – beam off – 254dpi

    That still looks gnarly, but it’s more along the lines of what the coarse 10 samples / cycle pattern calls for.

    The risetime for each of those steps is on the order of 2 ms, so the controller’s analog output bandwidth isn’t much better than 150-ish Hz.

    Close examination of the bar pattern shows the end of the first cycle really does hit exactly 0% intensity where the controller raises L-ON (magenta trace) to force the output current to zero. The other minima remain a few percent above zero and cannot be squashed flat.

    Today I Learned: LightBurn enforces square pixels at the line spacing distance for grayscale engraving.

    I think this means you must resize / resample the grayscale image to match the engraving line spacing, because LightBurn could take the nearest adjacent pixel or average two adjacent pixels if its horizontal sampling doesn’t match the image resolution.

  • Lid Box

    Lid Box

    Mary reuses empty sour cream / ricotta cheese / cottage cheese to freeze / store garden produce, which results in a need to store their lids:

    Lid box - filled
    Lid box – filled

    It’s made from 1.5 mm chipboard, which seems both sturdy enough for the purpose and sufficiently stylin’ for life in a middle drawer.

    A bead of Elmer’s yellow wood glue along the tops of meshing fingers (which then hits the bottom of the opposing slots) holds the joints together, with a quartet of steel blocks + magnets ensuring perpendicularity during curing:

    Lid box - gluing
    Lid box – gluing

    The glue cures to a transparent skin, so it doesn’t look nearly as awful as you might think. Besides, being inside with lids all over, nobody will ever see the overage. Right?

    The box pattern comes from the wonderful boxes.py as a magic URL:

    https://festi.info/boxes.py/UnevenHeightBox?FingerJoint_angle=90.0&FingerJoint_style=rectangular&FingerJoint_surroundingspaces=2.0&FingerJoint_edge_width=1.0&FingerJoint_extra_length=0.0&FingerJoint_finger=2.0&FingerJoint_play=0.0&FingerJoint_space=2.0&FingerJoint_width=1.0&Grooved_arc_angle=120&Grooved_gap=0.1&Grooved_interleave=0&Grooved_inverse=0&Grooved_margin=0.3&Grooved_style=arc&Grooved_tri_angle=30&Grooved_width=0.2&bottom_edge=f&x=70&y=80&outside=0&height0=40&height1=40&height2=60&height3=60&lid=0&lid_height=0&edge_types=eeee&thickness=1.5&format=svg&tabs=0.0&debug=0&labels=0&reference=0&inner_corners=corner&burn=0.04&render=0
  • Manjaro Linux: TOTP PSA

    Manjaro Linux: TOTP PSA

    I set up my pobox.com account set up with two-factor authentication through my Yubikey, so logging in requires my user ID, password, and a Time-based One-time Password generated through the Yubikey Authenticator program. A few weeks ago, pobox occasionally rejected the TOTP and it eventually became a hard failure. Oddly, other sites I’ve set up with TOTP 2FA continued to work fine.

    My initial trouble report:

    The last couple of times I’ve tried to sign in, the usual TOTP copy-n-paste from my Yubikey authenticator has failed.

    Up to that point, it worked flawlessly.

    Manually typing the TOTP also fails.

    I have reset my (complex!) password to no avail; I use Firefox’s password manager to fill it in.

    I do have a set of lockout codes, but they’re a solution to a different problem.

    Given the constant updates to Firefox (102.0.3), it’s almost certain the hole is in my end of the boat. I have disabled all the usual ad blocking for pobox.com, although there may be other domains I’ve overlooked.

    Other than that, my email seems to be working just fine …

    Any suggestions on how to proceed? (Obviously, I’m not going to be able to sign on to look at the ticket.)

    Thanks …

    This is the fastest I’ve ever reached Tier 2:

    We’re happy to help you with this. I’ve escalated your ticket to our Tier 2 agents, as they are best suited to assist with this issue.

    There is nothing like a good new problem to take your mind off all your old problems:

    I’ve had a chat with our Tier 2 agents about this and they’ve suggested I escalate it to our developers to have a look at.

    Somewhat later:

    I am afraid to say that our developers were unable to find any clear reason as to why your Yubikey failed.

    Yubikey devices verify by connecting with Yubikey’s server, and it is possible that this connection failed.

    Can you please try using the Yubikey again to see if the issue is still occurring?

    If it’s still failing, can you please try adding a new Yubikey device to see if it works?

    Of course, the problem didn’t magically Go Away, but I did more experimentation and figured out where the hole was in my end of the boat:

    Ah-HA! It’s a PEBKAC error!

    For unknown reasons, this PC was not set for automatic NTP time updates(*). Its time had drifted (presumably since I installed it back in June 2021) and was now 58 seconds behind real time, exceeding pobox’s tolerance.

    Other websites apparently allow a few more seconds of slop before disallowing a TOTP, so I had not yet run afoul of their limit.

    Some lesser-used sites threw me out, however, but I had not looked beyond the most common sites.

    The default TOTP interval is 30 seconds, so perhaps pobox allows only ±1 interval and the other sites allow ±2? Frankly, I think pobox has it right: everybody else prioritizes customer sat over security.

    Got the clock set correctly and, gosh, TOTP works fine.

    Mark it solved, but definitely add “Soooo, is your PC’s clock set for automatic updates?” to the debugging protocol.

    Thanks …

    (*) I’ve installed all of the boxen here and would not ever have picked “Yeah, sure, I want to dink with the clock.”

    The solution looks like this:

    Manjaro Time and Date Settings - Auto Set
    Manjaro Time and Date Settings – Auto Set

    Which was unchecked on this PC.

    Of course, systemd has long since subsumed NTP, making everything I thought I once knew obsolete: now it’s handled by timesyncd.

    How you make sure time synchronization is enabled goes like this:

    $ systemctl status systemd-timesyncd.service
    ● systemd-timesyncd.service - Network Time Synchronization
         Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
         Active: active (running) since Thu 2022-08-25 06:49:31 EDT; 10h ago
           Docs: man:systemd-timesyncd.service(8)
       Main PID: 355 (systemd-timesyn)
         Status: "Contacted time server 23.157.160.168:123 (2.manjaro.pool.ntp.org)."
          Tasks: 2 (limit: 19063)
         Memory: 2.2M
            CPU: 188ms
         CGroup: /system.slice/systemd-timesyncd.service
                 └─355 /usr/lib/systemd/systemd-timesyncd
    
    Aug 25 06:49:31 shiitake systemd[1]: Starting Network Time Synchronization...
    Aug 25 06:49:31 shiitake systemd[1]: Started Network Time Synchronization.
    Aug 25 06:50:12 shiitake systemd-timesyncd[355]: Timed out waiting for reply from 162.159.200.123:123 (2.manjaro.pool.ntp.org).
    Aug 25 06:50:12 shiitake systemd-timesyncd[355]: Contacted time server 23.157.160.168:123 (2.manjaro.pool.ntp.org).
    Aug 25 06:50:12 shiitake systemd-timesyncd[355]: Initial clock synchronization to Thu 2022-08-25 06:50:12.850444 EDT.
    

    If it’s enabled and running, then it’s all good.

    Whereupon all my TOTP passwords began working again.

    I checked two other Manjaro systems: one had auto updates enabled, one didn’t. I have no explanation.