Archive for category Software

MPCNC: Z-Axis Height Probe

A slight modification to the MPCNC LM12UU collet pen holder turns it into a long-reach Z-Axis Height Probe:

CNC 3018-Pro - Z-Axis height probe - overview
CNC 3018-Pro – Z-Axis height probe – overview

A flange on the top plate holds a Makerbot-style endstop switch:

Collet Holder - LM12UU - switch plate - solid model
Collet Holder – LM12UU – switch plate – solid model

The brass probe rod sports a 3/32 inch ball epoxied on its tip, although for my simple needs I could probably use the bare rod:

CNC 3018-Pro - Z-Axis height probe - ball tip detail
CNC 3018-Pro – Z-Axis height probe – ball tip detail

I clamped the rod to extend a bit beyond the plate, where it can soak up most of the switch release travel, leaving just enough to reset the clickiness after each probe:

CNC 3018-Pro - Z-Axis height probe - detail
CNC 3018-Pro – Z-Axis height probe – detail

The probe responds only to Z motion, not tip deflection in XY, so it’s not particularly good for soft objects with sloped sides, like the insole shown above. It works fine for rigid objects and should suffice to figure the modeling workflow.

The bCNC Auto-Level probe routine scans a grid over a rectangular region:

Insole - bCNC AutoLevel Probe Map - detail
Insole – bCNC AutoLevel Probe Map – detail

Which Meshlab turns into a solid model:

Insole - Meshlab triangulation
Insole – Meshlab triangulation

That’s the bottom of the insole probed on a 5 mm grid, which takes something over an hour to accomplish.

The OpenSCAD code as a GitHub Gist:

, ,

1 Comment

CNC 3018-Pro: Diamond Drag Engraving Test Disk

The smaller and more rigid CNC 3018-Pro should be able to engrave text faster than the larger and rather springy MPCNC, which could engrave text at about 50 mm/min. This test pattern pushes both cutting depth and engraving speed to absurd values:

Engraving Test Pattern - 2019-09-18
Engraving Test Pattern – 2019-09-18

Compile the GCMC source to generate G-Code, lash a CD / DVD to the platform (masking tape works fine), touch off the XY coordinates in the center, touch off Z=0 on the surface, then see what happens:

CNC 3018-Pro - Engraving test pattern - curved text
CNC 3018-Pro – Engraving test pattern – curved text

The “engraving depth” translates directly into the force applied to the diamond point, because the spring converts displacement into force. Knowing the Z depth, you can calculate or guesstimate the force.

Early results from the 3018 suggest it can engrave good-looking text about 20 times faster than the MPCNC:

CNC 3018-Pro - Engraving - speeds
CNC 3018-Pro – Engraving – speeds

You must trade off speed with accuracy on your very own machine, as your mileage will certainly differ!

The GCMC source code as a GitHub Gist:

, , ,

2 Comments

CNC 3018-Pro: Tape-Down Platter Fixture

Diamond drag engraving doesn’t put much sideways force on the platters, so taping the CD in place suffices to hold it:

CNC 3018-Pro - CD taped to platform
CNC 3018-Pro – CD taped to platform

Wrapping a flange around the screw-down platter fixture provides plenty of surface area for tape:

Platter Fixtures - CD on 3018 - tape flange
Platter Fixtures – CD on 3018 – tape flange

Which looks exactly as you think it would in real life:

CNC 3018-Pro - CD fixture - taped
CNC 3018-Pro – CD fixture – taped

Admittedly, masking tape doesn’t look professional, but it’s low-profile, cheap and works perfectly. Blue painter’s tape for the “permanent” hold-down strips on the platform would be a colorful upgrade.

It’s centered on the platform at the XY=0 origin in the middle of the XY travel limits, with edges aligned parallel to the axes. Homing the 3018 and moving to XY=0 puts the tool point directly over the center of the CD without any fussy alignment.

The blue-and-red rings around the center hole assist probe camera alignment, whenever that’s necessary.

The OpenSCAD source code as a GitHub Gist:

, ,

6 Comments

CNC 3018-Pro: LM6UU Linear-bearing Diamond Drag Bit Holder

The CNC 3018-Pro normally holds a small DC motor with a nicely cylindrical housing,so this was an easy adaptation of the MPCNC’s diamond drag bit holder:

CNC 3018-Pro - Diamond bit - overview
CNC 3018-Pro – Diamond bit – overview

The lip around the bottom part rests atop the tool clamp, with the spring reaction plate sized to clear the notch in the Z-axis stage.

The solid model looks about like you’d expect:

Diamond Scribe - Mount - solid model
Diamond Scribe – Mount – solid model

The New Thing compared to the MPCNC holder is wrapping LM6UU bearings around an actual 6 mm shaft, instead of using LM3UU bearings for the crappy diamond bit shank:

CNC 3018-Pro - Diamond bit - epoxy curing
CNC 3018-Pro – Diamond bit – epoxy curing

I cut the shank in two pieces, epoxied them into 3 mm holes drilled into the 6 mm shaft, then epoxied the knurled stop ring on the end. The ring is curing in the bench block to stay perpendicular to the 6 mm shaft.

The spring constant is 55 g/mm and it’s now set for 125 g preload:

CNC 3018-Pro - Diamond bit - force measurement
CNC 3018-Pro – Diamond bit – force measurement

A quick test says all the parts have begun flying in formation:

CNC 3018-Pro - Diamond bit - test CD
CNC 3018-Pro – Diamond bit – test CD

It’s definitely more rigid than the MPCNC!

The OpenSCAD source code as a GitHub Gist:

, ,

2 Comments

Ripping Vinyl Records on a Raspberry Pi

Having already set up a Raspberry Pi streaming radio player for the living room, it seemed reasonable to also use it for recording audio from the long-disused turntable. A pair of RCA cables from the amplifier’s TAPE 2 REC outputs to the Behringer UCA202 USB audio interface got the audio where it needed to be:

RPi streamer - Behringer UCA202 USB audio box
RPi streamer – Behringer UCA202 USB audio box

Fiddle with the amp to select the phonograph, poke the TAPE 2 button to send audio to/from the UCA202, fire up an SSH session, kill the streaming audio program, and figure out what audio hardware is out there:

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Not much else to choose from on a Raspberry Pi, so see what the UCA202 can do:

$ arecord --dump-hw-params 
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "default":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S8 S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: [8 16]
FRAME_BITS: [8 32]
CHANNELS: [1 2]
RATE: [8000 48000]
PERIOD_TIME: [1000 65536000]
PERIOD_SIZE: [16 524288]
PERIOD_BYTES: [64 524288]
PERIODS: [2 1024]
BUFFER_TIME: (666 131072000]
BUFFER_SIZE: [32 1048576]
BUFFER_BYTES: [64 1048576]
TICK_TIME: ALL
--------------------
arecord: set_params:1233: Sample format non available
Available formats:
- S8
- S16_LE

Given those limited choices, 16 bit little-endian at 48 kHz seems like a no-brainer.

Find out all the ALSA device names:

$ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=CODEC
    USB Audio CODEC, USB Audio
    Default Audio Device
front:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Front speakers
surround21:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct sample mixing device
dsnoop:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct sample snooping device
hw:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct hardware device without any conversions
plughw:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Hardware device with all software conversions

They all point to the same hardware, so AFAICT the default device will work fine.

Try recording something directly to the RPi’s /tmp directory, using the --format=dat shortcut for “stereo 16 bit 48 kHz” and --mmap to (maybe) avoid useless I/O:

$ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /tmp/Side\ 1.wav
Recording WAVE '/tmp/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                  +02%|01%+                                   overrun!!! (at least 1.840 ms long)
                                  +02%|02%+                                   overrun!!! (at least 247.720 ms long)
                                +# 07%|06%##+                                 overrun!!! (at least 449.849 ms long)
                                 + 03%|02%+                                   overrun!!! (at least 116.850 ms long)

Huh. Looks like “writing to disk” sometimes takes far too long, which seems to be the default for MicroSD cards.

The same thing happened over NFS to the file server in the basement:

$ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /mnt/part/Transfers/Side\ 1.wav

Recording WAVE '/mnt/part/Transfers/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

                               +   09%|07%  +                                 overrun!!! (at least 660.372 ms long)

                                +# 08%|06%# +                                 overrun!!! (at least 687.906 ms long)

So maybe it’s an I/O thing on the RPi’s multiplexed / overloaded USB + Ethernet hardware?

Trying a USB memory jammed into the RPi, under the assumption it might be better at recording than the MicroSD Card:

$ arecord --format=dat --mmap --vumeter=stereo --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                  +01%|01%+                                   overrun!!! (at least 236.983 ms long)

Well, if it’s overrunning the default buffer, obviously it needs Moah Buffah:

$ arecord --format=dat --mmap --vumeter=stereo --buffer-time=1000000 --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                               +## 10%|06%# +                                 overrun!!! (at least 359.288 ms long)

When brute force doesn’t work, you’re just not using enough of it:

$ arecord --format=dat --mmap --vumeter=stereo --buffer-time=2000000 --duration=$(( 30 * 60 ))  /mnt/part/Side\ 1.wav
Recording WAVE '/mnt/part/Side 1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
                                  +00%|00%+                                   

Sampling four bytes at 48 kHz fills 192 kB/s, so a 2 s buffer blots up 384 kB, which seems survivable even on a Raspberry Pi.

The audio arrives at 11.5 MB/min, so an LP side with 20 min of audio will require about 250 MB of disk space. The USB memory was an ancient 2 GB card, so all four sides filled it halfway:

$ ll /mnt/part
total 1.1G
drwxr-xr-x  2 ed   root 4.0K Dec 31  1969  ./
drwxr-xr-x 17 root root 4.0K Jun  7 19:15  ../
-rwxr-xr-x  1 ed   root 281M Sep  1 14:38 'Side 1.wav'*
-rwxr-xr-x  1 ed   root 242M Sep  1 15:01 'Side 2.wav'*
-rwxr-xr-x  1 ed   root 265M Sep  1 15:27 'Side 3.wav'*
-rwxr-xr-x  1 ed   root 330M Sep  1 15:58 'Side 4.wav'*

Side 4 is a bit longer than the rest, because I was folding laundry and the recording stopped at the 30 minute timeout after 10 minutes of silence.

Now, to load ’em into Audacity, chop ’em into tracks, and save the lot as MP3 files …

,

2 Comments

CNC 3018-Pro: Probe Camera Case for Logitch QuickCam Pro 5000

The ball-shaped Logitch QuickCam Pro 5000 has a rectangular PCB, so conjuring a case wasn’t too challenging:

Probe Camera Case - Logitech QuickCam Pro 5000 - bottom
Probe Camera Case – Logitech QuickCam Pro 5000 – bottom

That’s more-or-less matte black duct tape to cut down reflections.

The top side has a cover made from scuffed acrylic scrap:

Probe Camera Case - Logitech QuickCam Pro 5000 - top
Probe Camera Case – Logitech QuickCam Pro 5000 – top

The corners are slightly rounded to fit under the screw heads holding it in place.

The solid model shows off the internal ledge positioning the PCB so the camera lens housing rests on the floor:

3018 Probe Camera Mount - solid model
3018 Probe Camera Mount – solid model

The notch lets the cable out, while keeping it in one place and providing some strain relief.

I though if a camera was recognized by V4L2 and worked with VLC, it was good to go:

Logitech QuickCam Pro 5000 - short focus
Logitech QuickCam Pro 5000 – short focus

Regrettably, it turns out the camera has a pixel format incompatible with the Python opencv interface used by bCNC. This may have something to do with running the code on a Raspberry Pi, rather than an x86 box.

The camera will surely come in handy for something else, especially with such a cute case.

The OpenSCAD source code as a GitHub Gist:

, ,

Leave a comment

CNC 3018-Pro: Platter Fixtures

Up to this point, the Sherline has been drilling 3.5 inch hard drive platters to serve as as reflecting bases for the vacuum tubes:

LinuxCNC - Sherline Mill - Logitech Gamepad
LinuxCNC – Sherline Mill – Logitech Gamepad

The CNC 3018-Pro has a work envelope large enough for CD / DVD platters, so I mashed the Sherline fixture with dimensions from the vacuum tube code, added the 3018’s T-slot spacing, and conjured a pair of fixtures for a pair of machines.

Because I expect to practice on scrap CDs and DVDs for a while:

Platter Fixtures - CD on 3018
Platter Fixtures – CD on 3018

And a 3.5 inch hard drive platter version:

Platter Fixtures - hard drive platter on 3018
Platter Fixtures – hard drive platter on 3018

The holes sit at half the 3018’s T-slot spacing (45 mm / 2), so you can nudge the fixtures to the front or rear, as you prefer.

The alignment dots & slots should help touch off the XY coordinate system on the Sherline, although it can’t reach all of a CD. Using bCNC’s video alignment on the hub hole will be much easier on the 3018.

After fiddling around with the 3018 for a while, however, the CD fixture doesn’t have many advantages over simply taping the disc to a flat platen. Obviously, you’d want a sacrificial layer for drilling, but it’s not clear the OEM motor / ER11 chuck would be up to that task.

The OpenSCAD source code as a GitHub Gist:

, , ,

2 Comments