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.

Category: Electronics Workbench

Electrical & Electronic gadgets

  • 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 …

  • 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.

     

  • MPCNC: Makerbot-style Endstop Switch Modification

    The Protoneer CNC Shield has headers for two endstops on each axis, although they’re wired to the same Arduino input pin. I installed a pair of Makerbot-style endstops on the Y axis, plugged them in, triggered one, and … the Arduino crashed. Hard. As in, a complete loss of power and reboot.

    Some fiddling around produced absolutely baffling symptoms, as I replaced each endstop board and their cables to no avail.

    Perusing the schematic (the “full instructions” link is dead, of course) eventually revealed the problem:

    Makerbot style endstop - schematic
    Makerbot style endstop – schematic

    Got it?

    Although there’s a pullup on the COM switch terminal, the switch’s NC terminal is connected to the +5 V supply, shorting across the both resistor and the LED+resistor. With two endstops in parallel, triggering one crowbars the other’s power supply to ground. I’m sure it made sense at the time, perhaps by ensuring no possible noise source could interfere with the pullup.

    The solution is simple: disconnect the NC terminal from the power supply. As it turns out, the PCB layout routes +5 V on the bottom layer, up through the via around the NC switch terminal, thence to the LED and resistor, leaving only one choice:

    MPCNC - dual MG endstop hack
    MPCNC – dual MG endstop hack

    Yup, amputate the NC terminal and be done with it.

    After that, the pullup resistor lets the endstops cooperate like you’d expect: triggering either one lights up both LEDs.

  • 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 …

  • Sandisk 32 GB High Endurance Video Monitoring Card

    Despite my misgivings, “Ships from and sold by Amazon.com” suggests I could return a Sandisk 32 GB High Endurance MicroSD card if things turned out badly:

    MicroSD 32 GB - Samsung EVO and SanDisk High Endurance
    MicroSD 32 GB – Samsung EVO and SanDisk High Endurance

    Unlike the Samsung cards, Sandisk charges a substantial premium for not buying through Amazon.

    Verifying the card using f3probe produced the same results as with the earlier 64 GB card and copying the existing files from the Fly6 card (on the left) went smoothly:

    
    rsync -rtv /mnt/Fly6/ /mnt/part
    
    

    “High Endurance” means it’s rated for 5000 hours of “Full HD” recording, which they think occurs at 26 Mb/s. The Fly6 records video in 10 minutes chunks, each weighing about 500 MB, call it 1 MB/s = 8 Mb/s, a third of their nominal pace. One might reasonably expect this card to outlive the camera.

    As with the AS30V, we shall see …

  • Compact Fluorescent Bulb Autopsy

    I fished the failed CFL bulb from the recycling box:

    Failed CFL - case damage
    Failed CFL – case damage

    The straight-ish crack between the tube ends looks like it happened as the (yellowed) plastic ruptured and hardened.

    Not wanting to get a face full of glass fragments spiced with metallic mercury, I wrapped a blast shield around the spiral tube:

    Failed CFL - tube wrap - shattered base
    Failed CFL – tube wrap – shattered base

    The terminal ends fit loosely in the crumbling base at the start of this operation, leaving the tube wobbling above the base. The plastic cracked as I wrapped the tube, so, for lack of anything smarter, I applied a pin punch to break away the rest of the upper base.

    The tube doesn’t fit into a socket, of course, and terminates in four wire connections:

    Failed CFL - tube terminals
    Failed CFL – tube terminals

    Those wires pass through notches on the edge of the PCB, bend around the board, pass through vias, and get soldered to pads. The solder side faces the tube, with all the components nestled into the base toward the screw terminals:

    Failed CFL - PCB solder side faces upward
    Failed CFL – PCB solder side faces upward

    The component side sports a surprising number of parts:

    Failed CFL - PCB components - 2
    Failed CFL – PCB components – 2

    A view from the other direction, where you can see the tube wires curling around the edge:

    Failed CFL - PCB components - 1
    Failed CFL – PCB components – 1

    I generally harvest inductors & suchlike, but it got really really hot in there and, methinks, cooked the life out of the parts:

    Failed CFL - overheated capacitor
    Failed CFL – overheated capacitor

    The PCB date code stamp could be “730”, suggesting either 1997 or 2007. In any event, it’s been a while.

    I hope LED bulbs outlast these things, but I have my doubts …

     

  • Samsung EVO Plus 32 GB MicroSD Cards: Verification

    A pair of known-good MicroSD cards arrived direct from Samsung at a surprisingly slight premium over the junk available on Amazon:

    Samsung EVO Plus MicroSD - 32 GB
    Samsung EVO Plus MicroSD – 32 GB

    f3probe reported they’re OK, which is no surprise:

    sudo f3probe --time-ops /dev/sdc
    F3 probe 6.0
    Copyright (C) 2010 Digirati Internet LTDA.
    This is free software; see the source for copying conditions.
    
    WARNING: Probing normally takes from a few seconds to 15 minutes, but
             it can take longer. Please be patient.
    
    Probe finished, recovering blocks... Done
    
    Good news: The device `/dev/sdc' is the real thing
    
    Device geometry:
    	         *Usable* size: 29.81 GB (62521344 blocks)
    	        Announced size: 29.81 GB (62521344 blocks)
    	                Module: 32.00 GB (2^35 Bytes)
    	Approximate cache size: 0.00 Byte (0 blocks), need-reset=no
    	   Physical block size: 512.00 Byte (2^9 Bytes)
    
    Probe time: 2'04"
     Operation: total time / count = avg time
          Read: 51.79s / 4197134 = 12us
         Write: 1'10" / 4192321 = 16us
         Reset: 1.41s / 1 = 1.41s
    

    These will go into Raspberry Pi projects, where their huge capacity won’t produce any benefit. It seems one can’t get known-good, small cards these days.

    I don’t see much point in buying known-crap counterfeits on Amazon, given their commingled-storage problem as pointed out by their helpful FBA advice:

    Use the manufacturer barcode to track inventory

    By default, your seller account is set to use the manufacturer barcode to track your eligible inventory throughout the Amazon fulfillment process. You can change this default barcode preference at any time. You have the option to change your barcode preference for each offer you create. You can also change your barcode preference for a product when you change a listing from Fulfilled by Merchant to Fulfilled by Amazon.

    Important: Items in your inventory that are identified and tracked using manufacturer barcodes are commingled with items of the same products from other sellers who also use manufacturer barcodes for those items.

    If you choose to use manufacturer barcodes, when customers purchase a product from you, Amazon can send the item that is closest to them, even if you didn’t send it to the fulfillment center. When that happens, you get the credit for the sale, and we transfer an item from your inventory to the seller whose inventory was used to fulfill the order. In addition, if you use the manufacturer barcode, you don’t have to apply an Amazon barcode to each item yourself.

    Even though inventory tracked using the manufacturer barcode is commingled within the network, the source of the inventory is tracked by our fulfillment systems and is taken into consideration if inventory problems arise.