Archive for category Electronics Workbench

MPCNC: Z-Axis Probed Height Map to Solid Model

I set up an orthotic shoe insert on the MPCNC and unleashed the Z-Axis height probe on it:

Orthotic - bottom probing
Orthotic – bottom probing

In principle, the grid keeps the object aligned with the machine axes and the blocks put the upper surface more-or-less parallel with the platform. The XY origin, at the G28 location I’ve been using for tool changes, is on the midline of the sole, with Z touched off by probing the platform beside the sole.

The only interesting part of the orthotic is the rigid white plastic plate, which extends about 20 mm into a pocket in the black foam, so the probe area excludes the bendy part.

I’m abusing the bCNC Auto-level probe routine to get the height map, because it produces a tidy file of XYZ coordinates with three header lines describing the overall probe area:

-50 140 39
-50 50 21
-2 35 500

-50 -50 0.11
-45 -50 0.06
-40 -50 0.005

The first two lines give the X and Y coordinate ranges and number of samples. The third line is the Z axis range and probe speed (?). After that, it’s just probed XYZ coordinates, all the way down.

Meshlab can import ASC files consisting of XYZ coordinates, with the ability to skip a specific number of header lines:

Meshlab ASC file import - header lines
Meshlab ASC file import – header lines

If you don’t skip those three lines, then you get three additional points, far off in XYZ space, that will confuse the next step.

Checking the Grid Triangulation box (the default) produces a nicely lofted sheet:

Orthotic - R bottom triangulated
Orthotic – R bottom triangulated

It is, however, a single-sided sheet, not a manifold 3D object. After a few days of screwing around, I’m unable to find any (automatic, reliable, non-manual) way to solidify the thing in Meshlab, so just save it as a PLY file in ASCII format:

Meshlab PLY file export - unchecked Binary Encoding
Meshlab PLY file export – unchecked Binary Encoding

Import it into Meshmixer, Ctrl-A to select the whole thing, click (Select →) Edit → Extrude, pick Y-Axis and Flat EndType, then extrude a convenient base in the negative direction:

Meshmixer - Y-Axis extrusion
Meshmixer – Y-Axis extrusion

For whatever reason, some 3D programs show machine-tool coordinates with Z pointing upward and others aim the Z axis at your face. Both must have made sense at the time, because Meshmixer defaults to swapping the Y and Z coordinates on import / export.

The Density slider controls the number of generated faces in the extruded section, so tune for best results.

I have no idea what Harden does.

Accept the result and you have a solid object suitable for further modeling.



1 Comment

Pride Lift Chair Control Dimming

For reasons not relevant here, we recently decontaminated a second lift chair, this one in bariatric size (so it doesn’t suffer from fuzz-shaving struts) with a six-switch control pod:

Pride lift chair control - dimmed LEDs
Pride lift chair control – dimmed LEDs

The green LED-lit buttons were so bright I took it apart to see what could be done; the picture shows the considerably dimmed result.

Start by prying outward on the tab at the USB charging port:

Pride lift chair control - USB port latch
Pride lift chair control – USB port latch

Done right, you can then release the latches along the sides:

Pride lift chair control - side opened
Pride lift chair control – side opened

It’s impossible to photograph the PCB with the LEDs active, but here’s what it looks like without power:

Pride lift chair control - PCB overview
Pride lift chair control – PCB overview

The eight (!) SMD LEDs align with light pipes around the switch openings:

Pride lift chair control - button keys
Pride lift chair control – button keys

The black dots come from Sharpie ink daubed in the shallow recesses intended to nestle around the LEDs. Note that the four switch caps have unique keying, so you can’t put them back incorrectly without some effort.

While we’re inside, here’s a closer look at the cable entry point, just in case I must replace the industrial-strength coily cord:

Pride lift chair control - cable entry
Pride lift chair control – cable entry

Unfortunately, it has a five-conductor cable, so a cheap phone coily cord (remember when phones had coily cords?) won’t suffice.

The PCB sports a pair of PICs, one of which seems to handle the buttons. I betcha the cable dates back to the days of hard-wired power switches, with the PIC now handling the intricate logic of deciding which motors to actuate for each function, then controlling MOSFETs as fake switch contacts.

The other PIC snuggles against the USB interface, which the manual describes as a charging-only port. It might also serve as a programming interface for the main PIC; admittedly the notion of a firmware upgrade for a lift chair seems far-fetched.

Reassembly is in reverse order with a resounding snap at the conclusion. It works fine and you (well, I) can now look at the control pod without sunglasses.


Raspberry Pi vs. eBay Camera: Assembly Completion

I picked up a pair of Raspberry Pi V1 cameras, both of which arrived unstuck to their breakout board:

RPi V1 camera adhesive
RPi V1 camera adhesive

Requiring the customer to peel off the white layer and stick the camera to the PCB helps keep costs low. They’re $4 if you’re willing to wait two months or $7 from a “USA Seller”.


Alead Telecoil Receiver: Magnetic Field Check

I got an Alead / Nolan HearLinks (many adjectives) Telecoil receiver to boost my ability to hear music & presentations at Vassar, because they recently slotted telecoil loops into the floors of their public venues. It took a few concerts to get the appropriate volume setting, after which I wondered how sensitive the receiver was:

Alead T-coil receiver - test setup
Alead T-coil receiver – test setup

The small T in the upper right corner marks the receiving coil location, with the coil oriented parallel to the body’s long axis. It’s the secondary winding of an air-core transformer with a single-turn (perhaps using Litz wire) primary embedded in the floor, with the induced voltage obeying the usual transformer equation:

V = 2π µ₀ µr N A f H cos θ


  • µ₀ – vacuum permeability = 4π×10-7 H/m
  • µr – relative permeability
  • N – number of turns
  • A – receiver loop area, m²
  • f – signal frequency, Hz
  • H – magnetomotive force, A/m
  • θ – angle between windings

For a given installation and receiver position, pretty much everything is fixed, with the voltage depending only on the H field caused by the primary winding current.

The induced voltage is linearly dependent on the frequency, but the transmitter equalization filters apparently flatten the spectrum to get equal receiver amplitude between about 100 Hz and 5 kHz.

The coil in that picture has nine turns, with four passing through the Tek current probe. Applying 10 mVpp to the winding produces a corresponding current:

JDS6600 10mVpp 1 kHz - 4 turns - 1 mA-div
JDS6600 10mVpp 1 kHz – 4 turns – 1 mA-div

The scope sees 14 mVpp = 1.4 div at 1 mA/div = 1.4 mA. Dividing by 4 turns means the coil actually carryes 350 µA. The signal generator has a 50 Ω output impedance, so 10 mV should produce about 200 µA, which seems a bit low. On the other paw, the signal generator sees the coil as a dead short at 1 kHz, so I don’t trust the numbers.

Whatever magnetic flux it may be produces a 1 kHz tone at a somewhat higher volume (for the same receiver setting) than the fancy Vassar loops, so the flux is in the right ballpark. With a bit more attention to detail, perhaps I can tinker up a current-mode loop drive amplifier.

The Alead receiver has an internally generated tick audible at the audio volume I need for the Vassar loops, which is 5 to 7 steps down from the maximum volume at 15 steps. It seems related to the internal Bluetooth hardware, although it’s present even when the receiver is not paired with my Pixel phone and, in fact, is unchanged even when 100 feet from the nearest electronic device.

When I reported the problem, they said:

Yes, you can hear very minor tick sound on telecoil mode. It is caused by some electronic and current to make those tick sound. Sorry for this defective on the design.

It had one job that it doesn’t do well, so it’s on the way back for a refund.

Evidently, I must build an audio loop receiver to get what I want …



Cateye Astrale Cyclocomputer Battery Life

The display on Mary’s Cateye Astrale “Cyclocomputer” had once again faded to gray, so it’s time for a new CR2032 lithium cell:

Cateye Astrale - battery change 2019-09-22
Cateye Astrale – battery change 2019-09-22

The old cell read 2.5 V, well below what it should be.

The notes scrawled on the cell become readable under better light:

Cateye Astrale - CR2032 life
Cateye Astrale – CR2032 life

Seven years (at 1942 mile/yr) ain’t bad at all!

To replace the cell fast enough to maintain the odometer reading, just unscrew & remove the battery cover, slam the back of the Astrale on the bench, and pop in the new cell.

Maybe I should replace the cell twice a decade, regardless of how feeble it might be?

Leave a comment

CNC 3018-Pro: DRV8825 Drivers at the Edge of Madness

Having previously concluded running the CNC 3018-Pro steppers from 12 V would let the DRV8825 chips provide better current control in Fast Decay mode at reasonable speeds, I wondered what effect a 24 V supply would have at absurdly high speeds with the driver in 1:8 microstep mode to reduce the IRQ rate.

So, in what follows, the DRV8825 chip runs in 1:8 microstep mode with Fast Decay current control. You must apply some hardware hackage to the CAMTool V 3.3 board on the CNC 3018-Pro to use those modes.

In all the scope pix, horizontal sync comes from the DRV8825 Home pulse in the top trace, with the current in the two windings of the X axis motor in the lower traces at 1 A/div. Because only the X axis is moving, the actual axis speed matches the programmed feed rate.

Homework: figure out the equivalent two-axis-moving speed.

The 12 V motor supply works well at 140 mm/min, with Fast Decay mode producing clean microstep current levels and transitions:

3018 X - Fast - 12V - 140mm-min 1A-div
3018 X – Fast – 12V – 140mm-min 1A-div

The sine waves deteriorate into triangles around 1400 mm/min, suggesting this is about as fast as you’d want to go with a 12 V supply:

3018 X - Fast - 12V - 1400mm-min 1A-div
3018 X – Fast – 12V – 1400mm-min 1A-div

Although the axis can reach 3000 mm/min, it’s obviously running well beyond its limits:

3018 X - Fast - 12V - 3000mm-min 1A-div
3018 X – Fast – 12V – 3000mm-min 1A-div

The back EMF fights the 12 V supply to a standstill during most of the waveform, leaving only brief 500 mA peaks, so there’s no torque worth mentioning and terrible position control.

Increasing the supply to 24 V, still with 1:8 microstepping and Fast Decay …

At a nose-pickin’ slow 14 mm/min, Fast Decay mode looks rough, albeit with no missteps:

3018 X - Fast - 24V - 14mm-min 1A-div
3018 X – Fast – 24V – 14mm-min 1A-div

At 140 mm/min, things look about the same:

3018 X - Fast - 24V - 140mm-min 1A-div
3018 X – Fast – 24V – 140mm-min 1A-div

For completeness, a detailed look at the PWM current control waveforms at 140 mm/min:

3018 X - Fast detail - 24V - 140mm-min 1A-div
3018 X – Fast detail – 24V – 140mm-min 1A-div

The dead-flat microstep in the middle trace happens when the current should be zero, which is comforting.

At 1400 mm/min, where the 12 V waveforms look triangular, the 24 V supply has enough mojo to control the current, with increasing roughness and slight undershoots after the zero crossings:

3018 X - Fast - 24V - 1400mm-min 1A-div
3018 X – Fast – 24V – 1400mm-min 1A-div

At 2000 mm/min, the DRV8825 is obviously starting to have trouble regulating the current against the increasing back EMF:

3018 X - Fast - 24V - 2000mm-min 1A-div
3018 X – Fast – 24V – 2000mm-min 1A-div

At 2500 mm/min, the back EMF is taking control away from the DRV8825:

3018 X - Fast - 24V - 2500mm-min 1A-div
3018 X – Fast – 24V – 2500mm-min 1A-div

The waveforms take on a distinct triangularity at 2700 mm/min:

3018 X - Fast - 24V - 2700mm-min 1A-div
3018 X – Fast – 24V – 2700mm-min 1A-div

They’re fully triangular at 3000 mm/min:

3018 X - Fast - 24V - 3000mm-min 1A-div
3018 X – Fast – 24V – 3000mm-min 1A-div

In round numbers, you’d expect twice the voltage to give you twice the speed for a given amount of triangularity, because the current rate-of-change varies directly with the net voltage. I love it when stuff works out!

At that pace, the X axis carrier traverses the 300 mm gantry in 6 s, which is downright peppy compared to the default settings.

Bottom lines: the CNC 3018-Pro arrives with a 24 V supply that’s too high for the DRV8825 drivers in Mixed Decay mode and the CAMTool V3.3 board’s hardwired 1:32 microstep mode limits the maximum axis speed. Correcting those gives you 3000 mm/min rapids with good-looking current waveforms.

I’m reasonably sure engraving plastic and metal disks at 3000 mm/min is a Bad Idea™, but having some headroom seems desirable.

, ,

Leave a comment

DRV8825 Stepper Driver: Adding a Home Output

The DRV8825 stepper driver chip has a -Home output going active during the (micro)step corresponding to 45°, where both winding currents equal 71% of the peak value:

DRV8825 pinout
DRV8825 pinout

Unfortunately, pin 27 is another unconnected pin on the DRV8825 PCB, without even a hint of a pad for E-Z soldering.

It’s also an open-drain output in need of a pullup, so I globbed on a 1/8 W 10 kΩ resistor in addition to the tiny wire from the IC pad to the left header pin:

DRV8825 PCB - Home signal output
DRV8825 PCB – Home signal output

Read it from the right: brown black black red gold. Even in person, the colors don’t look like that, not even a little bit: always measure before installation!

The right header pin is firmly soldered to the PCB ground pin I also used for the 1:8 microstep hack. The whole affair received a generous layer of hot melt glue in the hope of some mechanical stabilization, although hanging a scope probe off those pins can’t possibly end well.

The general idea is to provide a scope sync output independent of the motor speed, so I can look at the current waveforms:

3018 X - Fast - 12V - 140mm-min 1A-div
3018 X – Fast – 12V – 140mm-min 1A-div

The alert reader will note the pulse occurs on the down-going side of the waveforms, which means I have the current probes clipped on backwards or, equivalently, on the wrong wire. The point is to get a stable sync, so it’s all good no matter which way the current goes.

, ,

1 Comment