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: Memo to Self

Maybe next time I’ll get it right

  • Optical Filament Diameter Sensor Doodles

    It should be possible to sense the filament diameter with a cheap webcam and some optics:

    Filament Diameter Sensor - Optical Path Layout
    Filament Diameter Sensor – Optical Path Layout

    The general idea:

    Given that LinuxCNC runs on a bone-stock PC, you can plug in a stock USB webcam and capture pictures (I have done this already). Because LinuxCNC isolates the motion control in a hard real time process, you can run heavy metal image manipulation code in userland (think ImageMagick) without affecting the motors.

    So you can put a macro lens in front of a webcam (like that macro lens holder) and mount it just above the extruder with suitable lighting to give a high-contrast view of the filament. Set it so the filament diameter maps to about 1/4 of the width of the image, for reasons explained below.

    For a crappy camera with 640×480 resolution, this gives you 160 pixel / 1.75 mm filament = 91 pixel/mm → about 0.01 mm resolution = 0.6%. Use a better camera, get better resolution: 1280 pixel = 0.3% resolution.

    That gives you roughly 1% or 0.5% resolution in area. This is pretty close to the holy grail for DIY filament diameter measurement.

    Add two first-surface mirrors / prisms aligned at right angles, so that the camera sees three views of the filament: straight on, plus two views at right angles, adjacent to the main view. Set the optics so they’re all about 1/4 of the image width, to produce an image with three parts filament and one part high-contrast background separating them. This is the ideal, reality will be messier.

    Figure 1 shows an obvious arrangement, the mirrors in Figure 2 give more equal distances.

    You could align the mirrors to provide three views at mutual 120° angles, which would equalize the distances and give you three identical angles for roundness computation, should that matter.

    Diameter measurement process:

    • Extract one (*) scan line across the image.
    • Convert to binary pixels: 1 = filament, 0 = background, perhaps with ImageMagick auto thresholding.
    • Add pixel values across the line, divide by 3, multiply by mm/pixel → average filament diameter.
    • Done!

    Adding binary pixels is easy: it’s just the histogram, which ImageMagick does in one step. Dump data to a file / pipe, process it with Python. It all feeds into a LinuxCNC HAL component, which may constrain the language to C / Python / something else.

    (*) You can get vertical averaging over a known filament length, essentially for free. Extract three (or more) scan lines, process as above, divide by 3 (or more), and you get a nicely averaged average.

    Win: the image is insensitive to position / motion / vibration within reasonable limits, because you’re doing the counting on pixel values, not filament position. The camera can mount near, but not on, the extruder, so you can measure the filament just above the drive motor without cooking the optics or vibrating the camera to death.

    Win: it’s non-contacting, so there’s not much to get dirty

    Win: you get multiple simultaneous diameter measurements around one slice of the filament

    You could mount the camera + optics at one end of the printer’s axis (on the M2, the X axis). Drive the extruder to a known X position, take a picture of the straight-on view, drive to another position, take a picture of the mirrored views, and you have two pictures in perfect focus. Combine & process as above.

    You can do that every now and again, because any reasonable filament won’t vary that much over a few tens of millimeters. Maybe you do it once per layer, as part of the Z step process?

    You could generalize this to a filament QC instrument that isn’t on the printer itself: stream the filament from spool to spool while measuring it every 10 mm, report the statistics. That measurement could run without stopping, because you don’t reposition the filament between measurements: it’s all fixed-focus against a known background. You could have decent roller guides for the filament to ensure it’s in a known position.

    Heck, that instrument could produce a huge calibration file that gives diameter / roundness vs. position along the entire length of the filament. Use it to accept/reject incoming plastic supplies or, even better, feed the data into the printer along with the spool to calibrate the extrusion on the fly without fancy optics or measurements.

    Dan wonders if this might be patented. I’m sure it is: I’m nowhere near as bright as the average engineering bear at a company that’s been spending Real Money for three decades. My working assumption: all the knowledge is out there, behind a barrier I can’t see through or reach around: there’s no point in looking for it beyond a casual Google search on the obvious terms that, so far, hasn’t produced anything similar.

    Memo to Self: Might even be marketable, right up until they crush me like a bug…

  • Monthly Science: Larval Engineer

    Part of becoming an engineer involves discovering the difference between what works and what doesn’t, with the goal of doing more of the former and less of the latter. In tech fields, gaining such knowledge requires observations, records, and graphs.

    Our Larval Engineer is off to a good start, having collected her projects & notes into blog format.

    The alert reader may recognize the understated presence of a guiding hand, here and there, in some projects. I needed one, too, back in the day, even if I didn’t appreciate it (by at least the same amount). Fortunately, blogs hadn’t been invented, so you’ll never know.

    Karen at the lathe
    Karen at the lathe

    You may enjoy her story of the Taxi Horn project, which you see here in the lathe.

    Memo to Self: After launch, guiding hands must remain with the gantry. One must Just. Let. Go.

  • Mad Phil: Requiem

    My buddy Mad Phil’s obituary will read that he died from “complications of ALS“. In his case, he lived nearly three weeks after his swallowing reflex failed, whereupon he quietly and deliberately stopped eating and drinking. He slipped into intermittent unconsciousness last week, departed from consensus reality, and died of dehydration yesterday.

    It’s not starvation, because you can survive for much longer than a month without food, but not even the correct name makes it prettier. The rule of thumb for death by dehydration gives you a week or two, tops, but early on I told him that he’d survive for a month on sheer cussedness. For reasons I’ll describe in a few days, I know from personal experience that he was still up and running after seven days. He slowed down a bit during the second week, but still held court from his bed 15 days after entering final approach.

    We met, decades ago, at a locally important company whose name cannot be mentioned (but whose initials are IBM, if that helps), where he taught me a good deal of what I know about hardware construction and debugging. He was known as Mad Phil, not because he was crazy, but because when something important needed doing, he could get it done and you did not get between him and his goal.

    Here’s how that worked, once upon a time:

    Mad Phil and a bunch of techs are returning from a trip to a vendor in Massachusetts. Some of the guys plan to visit a favorite fishing hole on the way home, so they stop at a deli in a small town for provisions. Being young guys, they simply slam to a stop in a no-parking zone. A tech hops out of the back seat and runs into the deli.

    Mad Phil sits in the passenger seat of the other car, a Chrysler Cordoba rental pimpmobile, with a tech named Guido at the wheel; Guido looks exactly like you’d expect, dressed to impress right down to the open shirt and gold chain. Phil, being the responsible engineer in charge of the trip, is (uncharacteristically) wearing a suit. There being no parking, Guido makes loops around the traffic circle at the center of town. They spot a local police car near the deli, so Guido drives carefully.

    After a few loops, the tech runs out of the deli with two large brown bags and waves at Guido, who pulls up between the police car and the deli. In quick succession, the policeman gets out of the patrol car, the tech tosses one bag into Guido’s lap, hops into the other car, and pulls out with unseemly haste.

    The policeman studies Guido, Phil, the bag, and the Cordoba. Phil powers down his window, smiles, and asks “May we be of assistance, officer?” The policeman looks at both of them again, meets Phil’s gaze, and says “There’s no point, you’d be out of jail in fifteen minutes.” Phil replies “Thank you, officer, we appreciate your cooperation” and nods at Guido, who gently backs the car out, and they drive off in a stately manner.

    He was obviously that guy you did not mess with.

    Over the course of the last two years, after being diagnosed with ALS, he quietly and efficiently got his affairs in order, selling and donating his extensive collection of tools, equipment, and parts: putting his stuff where it would do the most good. He gave many tools to a local group that builds and repairs houses, helped stock the local hackerspace, gave me a wide assortment of doodads (some of which you’ve seen here), and was far more generous than anyone really should be.

    Go in peace, old friend. You’ve earned it.

    Memo to Self: Do like he did.

  • Gratuitous Engine Jeweling

    While pondering whether I should use the carcass of an old Dell PC to house the stepper drivers and control logic for the LinuxCNC M2 project, I bandsawed a scrap of aluminum sheet to about the right size. It had some truly nasty gouges and bonded-on crud, so I chucked up a wire brush cup in the drill press and had at it:

    Machine jeweled baseplate
    Machine jeweled baseplate

    It’s obvious I haven’t done jeweling in a long time, isn’t it? Even a crude engine jeweling job spiffs things right up, though, even if a cough showcase job like this deserves straighter lines and more precise spacing. The aluminum sheet is far too large for the Sherline, which put CNC right out of consideration, and I’m not up for sufficient crank spinning on the big manual mill.

    I match-marked mounting holes directly from the harvested motherboard and drilled them, whereupon I discovered that the aluminum is a dead-soft gummy alloy that doesn’t machine cleanly: it won’t become the final baseplate.

    Memo to Self: Use the shop vacuum with the nozzle spinward of the brush, fool.

  • Long-term Paint Storage: Just Don’t

    We probably should have noticed this sooner, but …

    Leaking paint can
    Leaking paint can

    Yes, that can really does did contain white paint!

    It cleaned up about as well as you’d expect, which is to say not very well at all:

    Leaking paint can - residue
    Leaking paint can – residue

    Fortunately, we’re not particularly fussy about shelves in the Basement Laboratory Paint Storage Wing.

    Memo to Self: Just throw the nearly empty paint cans out, OK?

  • Yes, Giant Heatshrink Tubing Shrinks 50%, Too

    Even though I know heatshrink tubing contracts by (or to) 50% of its expanded size, this was still startling:

    Giant heatshrink tubing test
    Giant heatshrink tubing test

    That’s a test for another repair on the never sufficiently to be damned Samsung vacuum cleaner, about which, more later.

    Memo to Self: Pre-shrink the tubing about 3/4 of the way.

  • Muting the Optiplex 760 Internal Speaker

    The Dell Optiplex 760 that I’m using as a rendering box has an internal “business audio” speaker that is not disabled by plugging an external speaker / earphone into either the front or rear audio output jack. The tiny volume control applet in the Xubuntu 12.04 notifications panel doesn’t provide any control over the sound card; it’s definitely not a mixer and its Sound Settings button calls up the Pulseaudio configuration which is oddly unhelpful.

    So.

    Install xfce4-mixer, add it to the panel, fire it up, select the HDA Intel “sound card”, enable all the controls, slide rightward until Mono appears, click the speaker button under the slider to mute it, and you’re done.

    Memo to Self: there ought to be a BIOS setting for that.