Advertisements

Posts Tagged CNC

MPCNC: Z Axis Upward Homing with Opto Proximity Sensor

Homing the MPCNC’s Z axis at the bottom end of its travel made no sense, but the Z stage lacks a convenient spot to mount / trigger a switch at the top of its travel, so this sufficed for initial tests & fiddling:

MPCNC - Z min endstop

MPCNC – Z min endstop

The EMT rail carrying the switch moves downward, tripping the lever when it hits the MPCNC’s central assembly.

Somewhat to my surprise, a TRCT5000-based optical proximity sensor (harvested from the Kenmore 158 Crash Test Dummy’s corpse) and a strip of black electrical tape work perfectly:

MPCNC - Z Axis Opto Proximity Endstop

MPCNC – Z Axis Opto Proximity Endstop

The PCB wears a shiny new epoxy coat:

MPCNC - Epoxy-coated Endstop - Opto Prox Sensor

MPCNC – Epoxy-coated Endstop – Opto Prox Sensor

I soldered the wires (harvested from the previous endstop) directly to the PCB, because the pinout isn’t the same and fewer connectors should be better.

The mount uses black PETG, rather than translucent orange, in hope of IR opacity, and wraps around the EMT rail at (roughly) the 2 mm standoff producing the peak response:

IR Reflective Sensor module - TCRT5000 - response vs distance

IR Reflective Sensor module – TCRT5000 – response vs distance

In truth, I set the gap by eyeballometric guesstimation to make the entire mount arc sit equidistant from the EMT:

MPCNC - Z Opto Prox Endstop - top view

MPCNC – Z Opto Prox Endstop – top view

The mount includes the 2 mm spacing around the EMT OD and puts the sensor tip flush with the arc OD, so it should be pretty close:

TCRT5000 Z Axis Endstop Mount - solid model

TCRT5000 Z Axis Endstop Mount – solid model

A strip of 3M permanent tape, cut to clear the 608 bearings, affixes the mount to the MPCNC’s central assembly. The solid model now includes a midline reference notch, with a height rounded up to the next-highest multiple of 2.0 mm. It needs a loop to anchor the cable.

The blue twiddlepot sets the comparator threshold midway between the response over black tape (incorrectly on = too low) and bare EMT (incorrectly off = too high), in the hope of noise immunity. The range spanned nearly half of the pot rotation, so I think it’s all good.

The sensor doesn’t trip when the edge of the tape exactly meets its midline, which meant I had to trim a strip of tape to suit. As part of setting the twiddlepot, I shut off the Z axis motor and laid some test strips on the EMT:

MPCNC - Z Axis Opto Prox Endstop - Test Tape

MPCNC – Z Axis Opto Prox Endstop – Test Tape

I spun the leadscrew with one hand, held the sensor with the other, twiddled the trimpot, trimmed the upper and lower ends of the tape, and generally had a fine time. The sensor responds equally well to a half-wide strip of tape (in the upper picture), with the distinct advantage of not encroaching on the 608 bearing tracks.

The GRBL setup now homes Y and Z toward the positive end of their travel, with X still toward the negative end while a set of extension cables remains in transit around the planet.

The OpenSCAD source code as a GitHub Gist:

The original doodles, including a bunch of ideas left on the cutting room floor:

MPCNC Z Opto Proximity Sensor Endstop - doodles

MPCNC Z Opto Proximity Sensor Endstop – doodles

Advertisements

, ,

Leave a comment

MPCNC: A4988 Driver Microstep Waveforms

I measured stepper motor winding current with a pair of Tek Hall effect probes for future reference.

MPCNC - X Axis current measurement setup - overview

MPCNC – X Axis current measurement setup – overview

The pistol-shaped A6303 measures up to 100 A, so it’s grossly overqualified for the job. The much smaller A6302 goes to 20 A and is definitely the right hammer. The single-trace pix show 200 mA/div.

I’m using the default 12 V6 A MPCNC stepper power supply, with A4988 stepper driver boards on the Protoneer CNC Shield atop a knockoff Arduino UNO running GRBL firmware. The blue USB cable goes off to a Raspberry Pi running minicom for manual control.

All the pix use the same G-Code command: G1 X2.4 F180. Running at 180 mm/min = 3 mm/s eliminates pretty nearly all visible acceleration.

Each picture requires:

  • m9 to disable stepper power
  • Remove X axis A4988 driver board
  • Set jumpers to select new microstep mode
  • Reinstall driver board
  • Change GRBL $100 step/mm setting to match jumpers
  • Ctrl-X = reset GRBL
  • $x = unlock
  • m8 = enable power
  • Enable scope trigger (single-trigger mode)
  • g1x2.4f180 motion for next image
  • x0 = return to origin

With the A4988 stepper driver in 16:1 microstep mode:

MPCNC g1x2.4f180 - 16 ustep - 200 mA-div

MPCNC g1x2.4f180 – 16 ustep – 200 mA-div

Notice how some of the microsteps aren’t particularly crisp, notably around the zero crossings. I think the relatively low 12 V supply doesn’t give the A4988 enough control authority to boss the current around, resulting in difficulty holding the current setpoint, even at low speed:

MPCNC X 10mm 60mm-s 500mA-div

MPCNC X 10mm 60mm-s 500mA-div

More on that problem in a while.

In 8:1 microstep mode:

MPCNC g1x2.4f180 - 8 ustep - 200 mA-div

MPCNC g1x2.4f180 – 8 ustep – 200 mA-div

In 4:1 microstep mode:

MPCNC g1x2.4f180 - 4 ustep - 200 mA-div

MPCNC g1x2.4f180 – 4 ustep – 200 mA-div

In 2:1 microstep mode:

MPCNC g1x2.4f180 - 2 ustep - 200 mA-div

MPCNC g1x2.4f180 – 2 ustep – 200 mA-div

And, a rarity in modern times, both windings at 500 mA/div in full step mode:

MPCNC g1x2.4f180 - 1 ustep - dual 500 mA-div

MPCNC g1x2.4f180 – 1 ustep – dual 500 mA-div

The A4988 driver reduces the peak current to 1/√2 of the stepped sine wave peak to maintain the same average power dissipation and torque. For reasons I cannot explain, the full-step move takes far less time than the others; it must have something to do with how GRBL computes the average speed. It sounds like a robotic woodpecker hammering on the MPCNC’s frame, so I flipped back to 16:1 microstep mode after taking that picture.

Now I can refer to these from elsewhere …

,

Leave a comment

MPCNC: Stepper Motor Power Control

GRBL responds to critical errors by disabling its outputs, which seems like a useful feature for a big-enough-to-hurt CNC machine like the MPCNC. Unlike the RAMPS 1.4 board, there’s no dedicated power-control pin, so I connected the Coolant output to the same DC-DC SSR I tried out with the RAMPS board:

MPCNC - CNC Shield - Power SSR

MPCNC – CNC Shield – Power SSR

With homing enabled, GRBL emerges from power-on resets and error conditions with the spindle and coolant turned off and the G-Code interpreter in a locked state requiring manual intervention, so turning the stepper power on fits right in:

  • $x – Unlock the controls
  • m8 – Coolant output on = enable stepper power
  • $h – Home all axes

The steppers go clunk as the power supply turns on, providing an audible confirmation. The dim red LED on the SSR isn’t particularly conspicuous.

Turning the stepper power off:

  • m9 – Coolant output off = disable stepper power

I think the A4988 drivers maintain their microstep position with the stepper power supply off, because their logic power remains on. In any event, you probably wouldn’t want to restart after an emergency stop without clearing the fault and re-homing the axes.

The board has Cycle Start, Feed Hold, and Abort inputs just crying out for big colorful pushbutton switches.

Unlike the RAMPS board, the Prontoneer CNC Shield does not feed stepper power to the underlying Arduino UNO, leaving it safely powered by USB or the coax jack.

 

, , ,

Leave a comment

MPCNC: 12 V Supply vs. Stepper Current vs. Axis Speed

The default MPCNC configuration wires the two stepper motors on each axis in series, doubling the total resistance and inductance of a single motor. The stock Automation Technology motor presents 2.8 Ω and 4.8 mH in each winding to the driver, for an L/R time constant of τ = 1.7 ms. Doubling both doesn’t change the ratio, but including the harness wiring resistance gives 1.6 ms = 9.6 mH / 6 Ω.

The default DRV8825 driver configuration uses 1:32 microstepping, which I thought was excessive. I replaced the stock RAMPS setup with a Protoneer / GRBL setup using A4988 drivers in 1:16 microstepping mode, got it configured, and made a few measurements:

MPCNC CNC Shield - Current Measurement Setup

MPCNC CNC Shield – Current Measurement Setup

The current probe measures the winding current in the red wire. The voltage probe at the bottom isn’t doing anything, because I ran out of hands.

Here’s a 10 mm X axis move at 3600 mm/min = 60 mm/s:

MPCNC X 10mm 60mm-s 500mA-div

MPCNC X 10mm 60mm-s 500mA-div

The top trace shows the winding current at 500 mA/div. The bottom trace shows the voltage applied to the winding at the A4988 driver pin.

Basically, the +12 V supply doesn’t provide enough headroom to let the driver force the required current into the winding at full speed, which is why the peak current decreases as the step rate increases and the sinusoid becomes a square(-ish) wave. The applied voltage switches rapidly to maintain the proper winding current when the axis is stationary or moving slowly (where the driver’s PWM current control works fine), but turns into a square (well, rectangular) wave as the pace picks up (and the driver loses control of the current).

The motor drives a 16 tooth pulley with a 2 mm belt pitch, so each revolution moves 32 mm of belt. With 1:16 microstepping, each revolution requires 3200 = 200 full step × 16 microstep/step pulses, which works out to 100 step/mm = (3200 step/rev) / (32 mm/rev). At the commanded speed near the middle of the trace, the driver must produce 6000 step/s = 60 mm/s × 100 step/mm, so each step lasts 167 μs, about τ/10.

In round numbers, the first full cycle on the left has a 20 ms period. Each full cycle = 4 full steps = 64 microsteps, so the belt moved (60 step) / (100 step/mm) = 0.6 mm, at an (average) speed of 30 mm/s = 1800 mm/min. The current begins to fall off by the third cycle with a 12 ms period, a pace of 50 mm/s = 3000 mm/s, and pretty much falls off a cliff by 60 mm/s in the middle.

To be fair, those are aggressive speeds for milling, but lasers and 3D printers tick along pretty quickly, so they’re not unreasonable.

More study is indicated, as the saying goes …

, ,

1 Comment

MPCNC: Endstop Mount, Now With Recess

There being nothing like a new problem to take your mind off all your old problems, now there’s a cable tie latch recess:

X min endstop - recessed cable tie latch

X min endstop – recessed cable tie latch

A sectioned view of the model shows the layout:

MPCNC MB Endstop Mount - latch recess

MPCNC MB Endstop Mount – latch recess

On the other side, a ramp helps bend the tie toward the MPCNC rail:

X min endstop - recessed strap

X min endstop – recessed strap

Which looks thusly in the realm of applied mathematics:

MPCNC MB Endstop Mount - strap recess

MPCNC MB Endstop Mount – strap recess

I’ll leave the OpenSCAD code to your imagination, because the endstop block turns out to be a bit small for the recesses. Eventually, they need a dust cover and some cleanup.

So, there!

, , ,

1 Comment

MPCNC: GRBL Configuration

This collection of GRBL settings gets the MPCNC hardware up and running:

Conveniently, the $$ command (in the first line) produces output in exactly the format it will accept as input, so just pour the captured file into GRBL’s snout. I used ascii-xfr with a 250 ms line delay:

ascii-xfr -s -v -l 250 MPCNC-GRBL.cfg > /dev/ttyACM0

Now, to be fair, the MPCNC hasn’t yet done any useful work, but it moves.

Notes:

Setting $22=1 requires home switches to be installed and working, with $23=7 putting them on the negative end of the axes, which may not work well in practice. In particular, having the Z axis homing downward is just plain dumb.

The step/mm values in $10[012] require 1/16 microstepping with 2 mm belts on 16 tooth motor pulleys. The MPCNC’s Marlin config uses 1/32 microstepping, which doubles the step frequencies and (IMO) doesn’t provide any tangible benefit.

The speeds in $11[012]=6000 seem aggressive, although they actually work so far.

The accelerations in $12[012] may push the motors too hard with anything installed in the toolholder.

The travel limits in $13[012] depend on the rail lengths you used.

, ,

4 Comments

Makerbot-style Endstop Power Adapter for Protoneer Arduino CNC Shield

The Protoneer Arduino CNC shield (*) has a row of 2-pin headers for bare endstop switches. Being a big fan of LED Blinkiness, I have a stock of 3-pin Makerbot-style mechanical endstops that require a +5 V connection in addition to ground and the output.

A crude-but-effective adapter consists of half a dozen header pins soldered to a length of stout copper wire, with a pigtail to a +5 V pin elsewhere on the board:

3-pin to 2-pin Endstop Power Adapter

3-pin to 2-pin Endstop Power Adapter

A closer look:

3-pin to 2-pin Endstop Power Adapter - detail

3-pin to 2-pin Endstop Power Adapter – detail

The pins get trimmed on the other side of the bus wire, because they don’t go through the PCB.

Installed on the board, it doesn’t look like much:

3-pin endstop adapter on Prontoneer board

3-pin endstop adapter on Prontoneer board

Looks like it needs either Kapton tape or epoxy, doesn’t it?

Three more endstops at the far end of the MPCNC rails (for hard limits) will fill the unused header pins.

(*) It’s significantly more expensive than the Chinese knockoffs, but in this case I cheerfully pay to support the guy: good stuff, direct from the source.

, , ,

4 Comments