Introduction: Scrappy Integrated Grbl CNC Controller & Power

This 'ible describes an integrated unit of

  • CNC motion controller,
  • controller power,
  • switched and fused motor power,
  • ABORT/HOLD/RESUME inputs, and
  • indicator LEDs

that is not attached to any single machine. Combining these parts into a simple separate unit simplifies playing with random scrappy machine parts like scrap CD/DVD drive sleds. The major parts cost less than $10, if you don’t already have them lying around waiting for a project, and the rest can be whatever works from found scraps.

...emphasizing “scrap” for the 2020 Scraps Speed Challenge...

The Scraps Challenge description says there’s a difference between trash and scrap - without saying much about the difference. ...?... So let’s say: stuff intercepted on the way to landfill and directly restored or repurposed from its discarded form was trash; and retained leftovers or bits harvested out of forgotten trash of the past because it could be raw material for anything is now scrap.

Everybody has access to different scraps of different kinds, so this is more of an inspirational example than a repeatable how-to. You can get to the same end by the road that starts where you are.

Supplies

Some amazing projects by other people provide the important parts that make this work.

Software

  • Grbl - “no-compromise, high performance, low cost” motion control software “utilizing every clever feature of the AVR chips” to extract high performance from low-cost Arduino boards like UNO

Hardware

  • Stepper motor driver modules - in a format pioneered by Pololu Robitics & Electronics. Driving stepper motors to their best performance is tricky business. There are several sophisticated ICs to help with the job and Pololu developed a tidy package that has become a common modular interface for many different stepper driver ICs.
  • Protoneer CNC shield - all the power and interface details to go between (up to) four stepper drivers and an Arduino board in a tidy “shield” format
  • Arduino UNO R3 - a microcontroller board that runs Grbl and fits the CNC shield
  • All of the above in a single kit, for less than $10 (USD, at time of writing)
  • ~7 Volt DC regulator - to reduce the higher voltage motor supply for input to the Arduino's on-board regulator. LM317 adjustable regulators -- a common part for nearly half a century -- are available in simple adjustable modules so inexpensive that it's hard to justify any greater effort on that front.
  • "Dupont" connector parts

Scrapware, Electrical

  • laptop power brick - typically 16-20 Volts and more current than a few Pololu-style stepper drivers can handle. Protoneer CNC shield silkscreen indicates 12V-36V. A4988 stepper drivers, as in the all-up kits linked above, call for 8V < supply < 35V.
  • Power input connector(s) - I like "5-way" binding posts for flexibility
  • Hookup wire - heavy enough to carry more total current than your motor drivers can handle
  • Switch - rated for more total current than your motor drivers can handle
  • Fuse - rated for less total current than your motor drivers can handle
  • Fuse holder
  • Conveniently suitable scrap PCB with
    • Momentary switches (3) - for ABORT, HOLD & RESUME inputs
    • LEDs (3) - for controller power, motor power & motor ENABLE indicators
    • room for motor power switch
    • connector and signal wires
  • Discrete SMT
    • 330 Ohm resistors (3) - current limiting for LEDs
    • NPN transistor - to switch the high-voltage indicator LED
    • 47 kOhm resistor - limit transistor base current
    • What‽ Collecting scrap chip resistors & SOTs? Seriously? Yup. I grew up in ye olde through-hole age and started learning these newfangled surface mount things by harvesting, identifying, collecting and re-using the easy parts

Scrapware, Mechanical

  • wood scrap - approx 6in x 3in / 15cm x 8cm / hand x finger
    • or other soft-ish insulating material
    • or hard and/or conductive material plus PCB standoffs
  • boxy thing to mount switches & indicators and cover fuse/switch wiring
  • various screws

Step 1: Buttons and Blinkenlights

I wanted a switch for the high voltage supply to the CNC shield, buttons for Grbl's ABORT, HOLD & RESUME signals, and maybe some LED power/status indicators.

If you've ever scrapped out an HP 930c, you might have a conveniently sized PCB with three tactile switches, three LEDs, mating connectors with wires for all that, room for a switch, and a bit of dopamine to reinforce the habit of collecting such stuff. Sweet.

That's ABORT, HOLD & RESUME buttons ready to go.

But connecting 5 Volts, or 35 Volts, across the LEDs will kill them. So they will need a little help.

Step 2: Controller +5V Power and Motor ENABLE Indicator LEDs

LEDs for these two 5V signals only need resistors of a few hundred Ohms to set a reasonable current.

A couple of 330 Ohm chip resistors took care of that. One simply fit between adjacent pins. The other spans a cut trace. Notes on the photo show the details.

Step 3: A Little More Help for the High Voltage Motor Power Indicator LED

The motor supply could be anything from ~8V to ~36V. That makes is harder to pick a single resistor to set current through the indicator LED.

Instead the same 5V supply and 330 Ohm resistor light the LED through a transistor switch controlled by the motor supply. A little creative trace carving made room to place a scavenged SOT-23 NPN transistor between the LED and "ground" and connect the motor supply through a high resistance to the base of the transistor to turn the LED on when the motor supply is switched on.

Again, see the notes on the photos for details of how that works.

Step 4: Button & LED Connections to CNC Shield

With the LEDs taken care of, the PCB is ready to connect to various points around the CNC shield.

Most of the connections on the CNC shield go to 0.1 inch header pins. Cutting each wire to length and terminating them with "Dupont"-style female pins makes a neat connection. I connected the motor supply sense wire into the CNC shield screw terminal for convenience. That wire needs only a short bit of solid wire (I used a scrap header pin) soldered to the end instead of a "Dupont" pin.

Looking at the front with the LEDs on top and the connector at the top right, the connections are:

  1. GND
  2. open
  3. 5V
  4. Resume
  5. EN(able)
  6. Hold
  7. motor +V
  8. Abort

See the notes on the photo for connection points on the CNC Shield.

Step 5: Mounting the Motor Supply Switch

The "front panel" PCB also provides an open space to add a 5 Amp rated switch to control the power supply for the motors.

A simple hole allowed mounting the switch through the PCB. And a little half-depth hole for the tab that prevents the switch from twisting.

At first I imagined the switch in line with the tactile buttons. That would give the panel a row of LEDs, a row of space for labels, a row of switches and another row of space for labels. But the angle of the panel and depth of the switch required moving the switch higher up the panel. I still haven't decided how to finish & label the panel with this arrangement. At least I figured out the placement before drilling an unusable hole ... for once!

Step 6: Mounting Parts and Wiring Power

Early in choosing parts I found a scrap plastic handle from a different printer that was:

  • "just right" for mounting the switch/LED PCB, including margins of material behind the locating holes in the PCB so the PCB can be attached with a couple of screws
  • a good fit with the LM317 module and binding posts located behind
  • big enough to cover the binding post terminals, fuse and switch.

I arranged the UNO/CNC Shield, the regulator module, the panel PCB & "box" bit, and the binding posts to fit on the scrap wood base.

Then wired power connections:

  • + & - from the input terminals to the VIN & GND terminals of the LM317 regulator
  • VOUT & GND from the regulator to the Arduino at the lugs of the barrel connector
  • motor - from the input terminal to the - power input of the CNC shield with heavier wire
  • motor + from the input terminal to the fuse holder
  • motor + from the fuse holder to the switch
  • motor + from the switch to the + power input of the CNC shield

I used solid wire thinking that would work well with the screw terminals, which it does, but it was tedious to deal with the stiff wire. Note the un-mounted motor power switch remains exactly in its place in the photo.

And ... that's pretty much it.

With an 18.5 Volt supply, the regulator heatsink eventually gets warm enough to be uncomfortable to touch. It can get a lot hotter without damage so that leaves plenty of headroom. I haven't tried a long run at 35V. If running at the high end of the motor supply voltage, I would probably set the LM317 module output closer to the high end of acceptable input for the Arduino regulator so that the two regulators could share the heat load. Different motor controllers may have sufficiently different logic-level power consumption to make a difference. I've only used A4988s myself. If Arduino & CNC shield really do draw more power than the LM317+heatsink can supply with ~35V input, then the job might call for a switching DC-DC converter.

Step 7: Bonus Tracks

Using random scrap power bricks with random incompatible plugs

Cut the random incompatible plug off and replace it with some common connector. I've been using RCY connectors for this but not for any compelling reason. If I think I might ever want to use the brick for it's original purpose, I'll put the original end on a mating RCY connector so I can re-connect it when called for.

Then make up interchangeable ends with connectors you use. In this photo I'm using a pair of banana plugs between a random scrap laptop power brick and the Scrappy Integrated CNC Controller.

Bluetooth

An HC-05 Bluetooth module, configured for 115.2 kbps, turns this into complete stand-alone motion controller that needs only power and a machine to control.

Yes, someone will see the photo here and warn that you shouldn't connect an HC-05 directly to a 5V device because that may cook the HC-05's 3.3V RX input pin. They're right and you shouldn't do that.because no one promises that you won't cook your HC-05. For ad-hoc hook-ups, i.e. not actually making something with a soldering iron and a plan, I routinely connect HC-05 modules to 5V I/O and have not yet had a reason to regret doing so. But I still don't promise that you won't cook your HC-05. See the first link above for wiser guidance on how to connect an HC-05 to a 5V Arduino.

Anyhow after wiring up an HC-05 according to your best judgement, you can connect with something like G-Code2GRBL from your phone and control motion.