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
The bCNC doc shows how to use a USB camera for XY alignment and I want to try it out. The Box o’ USB Cameras emitted a likely candidate with a focusing lens, six (!) white LEDs, and a ball mount attached to an aggressive spring clip, but its thick USB cable included a lumpy brightness pot for the LEDs and sprouted a mic plug (apparently, it predated cheap USB audio):
USB Camera – OEM wiring
The Box o’ USB Cables emitted a surprisingly long cable amputated from some random hunk of consumer electronics.
The LED brightness won’t need much adjustment after the first few minutes. I found a little 2 kΩ trimpot to fit the PCB holes:
USB Camera – inside – brightness pot
Miracle of miracles, the dial ended up almost centered behind the original mic pore. A few minutes of gentle filing embiggened the pore and moved it over the trimpot:
USB Camera – front with brightness pot
Yeah, the hole may need a plug or tape to keep the dust out, but there’s an even bigger gap around the lens.
It produces a 640×480 picture with pretty much the expected quality, which should suffice for its intended purpose.
Inside, it uses the same pushbutton and pogo pin as the pen holder design, with a similar brass tube around the pogo pin.
There’s a conspicuous lack of good wire management; we all know where those wires will snap. In practice, you’d secure it to the DW660 power cord, way up on top, to eliminate most of the flexing. Still, it wants better strain relief than its gets from those heatstink tubes.
It’s sitting upside-down in a 5 mm brim for more platform adhesion.
The next one will have a 1/8 inch stud to fit the DW660’s other collet and shorten the top by 3/8 inch, because I want the rod inserted three diameters for stability. The bottom can’t get much shorter, because the pogo pin determines the switch-to-tip distance. Maybe a simple membrane switch will work well enough?
You can see the depression in the glass sheet pretty clearly in a bCNC Autolevel scan on 30 mm centers (clicky for more dots):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mary mentioned the pivot pin supplied with a quilting ruler tended to hang up on the layers of fabric and batting in the quilt squares she’s been making. A quick look showed the pin bore a remarkable resemblance to an ordinary thumb tack:
Ruler Quilting Pivot Pin – as delivered
I reset the pin shaft perpendicular to the head, grabbed a small brass tube in the lathe tailstock, inserted pin in tube, grabbed the head in the chuck, ignored a slight radial offset, and attacked the pin with fine files and sandpaper:
Ruler Quilting Pivot Pin – sharpened
The lathe chuck seemed the easiest way to firmly hold the head; I rotated the chuck by hand while filing.
Most of the remaining scratches go mostly parallel to the pin, but it really didn’t work much better than before. We decided polishing the pin wouldn’t improve the situation enough to make it worthwhile.
That’s the difference between sharp and keen, which cropped up with the cheap ceramic knife from a while ago. The point may penetrate the fabric, but the shaft can’t get through the tight weave.
She’s now using a scary thin and pointy embroidery pin, having successfully rebuffed my offer to mount it in a suitable base.
After doing sudo modprobe uinput, lsmod | grep uinp returns nothing at all (Xubuntu 16.04), but evtest seems perfectly happy:
sudo evtest /dev/input/event17
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x58f product 0x9410 version 0x0
Input device name: "KB800 Kinesis Freestyle"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 113 (KEY_MUTE)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 140 (KEY_CALC)
Properties:
Testing ... (interrupt to exit)
Event: time 1518199358.454619, type 1 (EV_KEY), code 113 (KEY_MUTE), value 1
Event: time 1518199358.454619, -------------- SYN_REPORT ------------
Event: time 1518199358.454638, type 1 (EV_KEY), code 113 (KEY_MUTE), value 0
Event: time 1518199358.454638, -------------- SYN_REPORT ------------
Event: time 1518199361.014681, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1518199361.014681, -------------- SYN_REPORT ------------
Event: time 1518199361.014699, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1518199361.014699, -------------- SYN_REPORT ------------
Event: time 1518199361.654701, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1518199361.654701, -------------- SYN_REPORT ------------
Event: time 1518199361.654721, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 1518199361.654721, -------------- SYN_REPORT ------------
Event: time 1518199362.294715, type 1 (EV_KEY), code 140 (KEY_CALC), value 1
Event: time 1518199362.294715, -------------- SYN_REPORT ------------
Event: time 1518199362.294733, type 1 (EV_KEY), code 140 (KEY_CALC), value 0
Event: time 1518199362.294733, -------------- SYN_REPORT ------------
And the keys work without any special configuration on my part. Apparently they’re already built into XFCE, despite the sound keys not showing up in the Keyboard Shortcuts control panel where you assign programs to keys.
This is wonderful work!
I’ve never seen so many calculators before! Oops.
There should be some udev-rule-ish way to automagically figure out which /dev/hidraw? device to use and symlink to a suitable alias, so the program could use it without knowing the actual device. A casual search turns up:
The skirt is scant at 0.20 mm, the boxes are 0.15 mm short at 2.85 mm, and the walls are 0.03 mm too thin. Some Z offset adjustment seems in order, as the first few layers (on the left) came out grossly squished:
Calibration box – 2.85 – detail
However, the box heights came out sufficiently uniform to show the platform alignment remains just fine.
Putting it there replaces all the mechanical putzing and adjusting cute little screws / bolts / nuts / spacers / suchlike with a simple offset in the startup G-Code:
G28 Z-2.15 ; home Z to platform switch, with measured offset
So I changed the startup G-Code in Slic3r to use G28 Z-2.30, sliced a single box in the middle of the platform, printed it, and … it came out exactly the same height: 2.85 mm.
Huh.
To make a very long story short, it turns out Marlin 1.1 ignores the numeric parameter in G28. When I updated the firmware to that version, I had changed the Configuration.h file to include the homing offsets:
So, with the same offset burned into the firmware, it looked like the startup G-Code was Doing The Right Thing. I never deleted the offset from the startup G-Code and, at some point, Marlin stopped supporting the numeric parameter.
Huh.
However, the X and Y homing offsets must be hardcoded, because I want the XY origin in the middle of the platform to match my original OpenSCAD part designs. Everybody else prefers the XY origin in the front-left corner. FWIW, in Marlin 1.1-RC5 (two years old by now), the #define BED_CENTER_AT_0_0 constant appears only in that line and nowhere else in the source code. Maybe it was a change in progress back then?
Anyhow, rather than hardcode the Z offset again, I set it to 0.00:
Recompile and reload the firmware, then change the startup G-Code to use G28 Z without the offset.
Doing so means I can measure and adjust the actual Z offset with M206, then store the value in EEPROM with M500:
M206 Z-2.25
M500
I went a little short at -2.25, for reasons I cannot explain now.
Measuring the offset goes like this:
Zero the offset: M206 Z0
Move the extruder off to the right: G0 X135
Home Z: G28 Z
Get some air under the nozzle: G0 Z4.0
Measure the actual clearance, perhaps using your taper gauge, at (let’s say) 1.7 mm
Set (1.7 – 4.0) as the offset: M206 Z-2.3
Print a box and adjust the offset accordingly
Using my actual measurement, not the for-instance example, I resliced the box, printed it, and it came out at 2.94 mm, just slightly short, so I re-tweaked the offset to Z-3.28 and re-stored it.
Embiggening the wall thickness turned out to be a matter of updating the filament diameter. I measured the start of the current spool of orange PETG at 1.75 mm, the same as the previous natural PETG spool, but the current section is 1.70 mm. Plugging that into Slic3r, reslicing, and reprinting produced a dead-on square: 3.00 mm tall with 1.20 mm walls:
Calibration Square series
The skirt now comes out at 0.25 mm, the way it should, too. The difference between the original 0.20 mm skirt and 0.25 mm suggests the squashed center thread (of the three in the skirt around the first set of five boxes) forced the two adjacent threads to become a bit taller, for lack of somewhere for the excess plastic to go on one side of each thread, and the nozzle rode higher than you’d (well, I’d) expect from the bare numbers.
The picture is missing a few squares in the middle, because I couldn’t believe changing the G28 Z-2.15 offset had no effect. It was easier to believe I’d inadvertently loaded the wrong file than the software / firmware was doing something wrong.
However, during the course of the adventure, I established M851 does exactly nothing in this context, perhaps because it applies to some different type of homing / probing / mesh leveling / whatever. You can set the Z offset with several other G-Code and M-Code commands, but the documentation isn’t always forthcoming about how the various methods interact and different firmware uses identical codes for completely different functions, so proceed with Exceedingly Great Caution.
In any event, it’s much easier and faster to adjust the printer & slicing parameters by measuring test boxes than by puzzling over actual prints, so …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
They’re supporting the snippets produced by trimming the clamp extrusions to fit across the bench under the MPCNC; I figure they ought to come in handy for something.
Both extrusions carry a warning sticker giving the bar’s serial number:
Harbor Freight Bar Clamp Labels
Huh.
I could be persuaded the number applies to a given production batch, although I’d be unsurprised to learn it’s a batch of labels, not clamps.
They don’t look much different than the previous versions:
MPCNC – bar clamp mount
The main change was to raise the bars by another 2 mm to give one of the clamp shoes more clearance. As you might expect, the top and bottom halves of the clamp castings aren’t quite symmetric.
The plastic mounts come in mirror-image sets due to that off-center bolt hole.
Yes, the threaded casting is slightly angled from the screw clamping force.
All in all, the mounts look pretty good, in a bright-orange sort of way.
An SJCAM M20 action camera includes the date and time in its file names, but the directory entries appear with the wrong timestamp:
sudo mount -o uid=ed /dev/sdc1 /mnt/part
ll -tr /mnt/part/DCIM/Photo/ | head
total 4.8G
drwxr-xr-x 4 ed root 16K Apr 8 2016 ../
drwxr-xr-x 2 ed root 144K Jan 25 18:52 ./
-rwxr-xr-x 1 ed root 3.8M Jan 26 05:08 2018_0126_100825_001.JPG*
-rwxr-xr-x 1 ed root 3.8M Jan 26 05:08 2018_0126_100830_002.JPG*
I’m in the Eastern US time zone, -5 hr from UTC.
By definition, FAT directory entries contain the “local time” when the file was created / changed. Because it cannot know which “local time” applies, the Linux VFAT filesystem treats the timestamp as UTC and adjusts it by -5 hr.
So the camera writes the directory timestamps properly. When mounted, Linux correctly (for a reasonable definition of correctly) regards them as UTC, knocks off five hours to match this time zone, and displays the result.
Alas, disabling the VFAT timestamp conversion has no effect:
sudo mount -o uid=ed,tz=UTC /dev/sdc1 /mnt/part
ll -tr /mnt/part/DCIM/Photo/ | head
total 4.8G
drwxr-xr-x 4 ed root 16K Apr 8 2016 ../
drwxr-xr-x 2 ed root 144K Jan 25 18:52 ./
-rwxr-xr-x 1 ed root 3.8M Jan 26 05:08 2018_0126_100825_001.JPG*
-rwxr-xr-x 1 ed root 3.8M Jan 26 05:08 2018_0126_100830_002.JPG*
I’m not sure why that doesn’t do anything; it doesn’t generate any error messages.
Although it seems like a reasonable thing, one cannot force a specific time zone with, say, tz=EST or tz=EDT or tz=UTC8 or whatever.
You can specify an offset in minutes:
sudo mount -o uid=ed,time_offset=$((-5*60)) /dev/sdc1 /mnt/part
ll -tr /mnt/part/DCIM/Photo/ | head
total 4.8G
drwxr-xr-x 4 ed root 16K Apr 8 2016 ../
drwxr-xr-x 2 ed root 144K Jan 25 23:52 ./
-rwxr-xr-x 1 ed root 3.8M Jan 26 10:08 2018_0126_100825_001.JPG*
-rwxr-xr-x 1 ed root 3.8M Jan 26 10:08 2018_0126_100830_002.JPG*
The time_offset value is subtracted from the directory timestamp, which means you’re feeding in the actual time offset from UTC, including whatever Daylight Saving Time offset may be in order.
So Linux takes the FAT timestamp, adds (subtracts a negative) 5 hr, and displays the result as my (now correct) local time.
I suppose I could set the camera to UTC, but then the camera’s on-screen and in-video timestamps would be off by four or five hours, depending on the season. So it goes.