Electronics (SO1)

From ShapeOko
Jump to navigation Jump to search

This is the archived version of the page for the original ShapeOko. Please see Electronics for the current version.

As noted on the Electronics Overview page, there are a number of components necessary to move the axes of a machine.


From the Wikipedia Article[1]: Arduino is an open-source single-board microcontroller, descendant of the open-source Wiring platform designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board I/O support. The software consists of a standard programming language compiler and the boot loader that runs on the board.

Where does Arduino fit into our project? We use the Arduino as the CNC controller by flashing grbl. Arduino is our link between software and hardware, it's the bridge between the intangible (gcode) and tangible (machine hardware). grbl receives raw text input via serial transfer generally in the form of gcode, and interprets that gcode into the correct step and directional pulses to send to the stepper motor driver.


Arduino Stepper Shield

Stepper Shield from buildlog.net

A (4) axis stepper driver Arduino shield that is perfect for use with grbl (garble) and other Arduino applications. The steppers drivers can be Pololu A4983, Pololu A4988 or open source StepStick drivers. These drivers can run steppers motors at up to 30V and 2 amp per coil. The resolution is jumper selectable per driver between full step,2x, 4x, 8x and 16x microstepping. There is now a relay driver board that is pin compatible with the stepper drivers that could be used to control spindle motors and coolant devices.

The plug in drivers are a great low cost solution for low power CNC devices. The drivers can easily be moved to other projects or replaced if they are damaged.


  • Screw terminal blocks for all stepper motor connections
  • Screw terminal block for the motor power supply.
  • Arduino reset button for easy access to reset the Arduino.
  • Jumpers for resolution selection.
  • Motor enable wired to an Arduino pin. Default is set to enable motors


Pololu A4988 Stepper Drivers


Pololu A4988 stepper driver250px

The A4988 stepper motor driver carrier is a breakout board for Allegro’s easy-to-use A4988 microstepping bipolar stepper motor driver and is a drop-in replacement for the A4983 stepper motor driver carrier. The driver features adjustable current limiting, overcurrent protection, and five different microstep resolutions. It operates from 8 – 35 V and can deliver up to 2 A per coil (MAX).

The potentiometers (POTS) on the drivers must be adjusted to control the current passing through the drivers. *See notes on heat below* We want to limit the driver to 1.0 amps without a heatsink and up to 1.5 amps with a heatsink, so we adjust the POT until we measure 0.4-0.6 volts at the marked point. Calculate this for yourself with the formula V(ref) = I(limit) * 0.4

TIP: You'll need a really small screw driver to get the pot to turn.

The ground pin to measure is not circled in the above drawing. It is the pin in the corner closest to the potentiometer screw. Verify this by looking on the bottom at the driver, the silkscreen will say gnd. TOUCHING ANY OF THE PINS SIMULTANEOUSLY (e.g. if the ground from your meter contact two of the closely spaced pins) COULD IMMEDIATELY FRY THE DRIVER. One method to deal with this is to tack a jumper wire to the ground pin with a bit of solder before any power is applied. You can then wrap the other end of the wire around your voltmeters ground lead and place it to the side and free a hand to either turn the pot or contact the marked point.

See the buildlog.net driver shield user guide for more information.

Pololu offered the following advice on setting the current level:

We usually recommend that you do not use the VREF to set the current limit for the driver as this method is harder to get right compared to adjusting the limiting while measuring the actual coil current with a multimeter or similar tool. When setting the current limiting by measuring the actual coil current, you should have your motor hooked up and powered on. If you have to use VREF to set the current, you do not have to have the motor hooked up, or the output enabled.

Here is some advise to new users experiencing heat related problems:

A 24V power supply is overkill in my opinion and is creating many problems for new users with overheating. By default, the driver boards you received will be calibrated for 1A current at 12V. If you fail to adjust the potentiometer down before using them in a stepper shield with a 24V power supply, you are essentially using them at 1.6 - 2 amps, Very close to the max rated current and you may destroy them if there is no heat sink.

Although the allegro a4988 "Pololu" drivers are rated to 35V, Using them at anything above 15-18V creates tremendous excess heat. My advise is to turn down your 24V power supply to 18V. Then adjust your driver current limit pots down before you plug them in. Finally, tune the pot *VERY SLOWLY* to achieve smooth stepper operation. You can tell that the setting is correct by the sound of your steppers and the fact that your chips will be very warm to the touch during continuous operation. The sound should be smooth and quite buzzing. If your chips are so hot you cannot touch them then you are running too high voltage / too much current.

I have seen many different suggestions about tuning the pot by measuring the vref voltage and calculating the current (including the instructions linked above). Again, in my opinion this is totally unnecessary. Just start low and slowly work your way up for smooth operation. No measurements required. Note that it is not necessary to achieve any specific current setting, regardless of what your steppers are rated for.

In addition, if you really have a boner for using 24V, go right ahead. Just be sure to start with the pot VERY low and adjust VERY VERY VERY slow just like outlined above.

Assembling the electronics

Assemble the stepper driver shield If you purchased the Stepper Driver Shield as a kit, you'll need to solder the parts yourself.

Tip A great way to get the pins aligned properly is to actually plug the un-soldered header pins into the Arduino, and then set the driver shield on top. The pins will be aligned and allow you to easily solder them in place.

A complete video guide to assembling the buildlog shield is available http://j.mp/Lal92X

The stepper shield allows you to configure the drivers to use microstepping by adding jumpers to the pins along the center of the shield. We want to use microstepping on the x-axis and y-axis, but not the z-axis. Connect all three pairs of jumpers for X and Y to indicate 16 microsteps. Leave the pins "un-jumpered" for Z and A.

Stepper Shield from buildlog.net

Solder headers to the drivers You'll need to solder the headers to the drivers, too.

Tip You can use the same trick to solder the headers to the drivers and you did to solder the headers to the driver shield. Plug the headers into the driver shield and set the driver on top. The pins will be aligned and allow you to easily solder them in place.

Pololu A4988 stepper driver

Keeping things separated The shield sits extremely close to the Arduino. If it looks like components on the shield are going to touch the Arduino, you'll need to do something to keep them separated. Either insert some insulating material between them, or insert a set of headers between the Arduino and shield.

Driver shield sitting a little too close to the ArduinoDriver shield separated by an extra set of headers Driver shield separated by an extra set of headers


Another option to help seperate the stepper shield from the arduino is to buy the Googly Eye Shield from evilmadscience.com!

Googly Eye Shield from Evil Mad Science

Power Supply

Any power supply that can produce 4.2A - 6A at 18-30v.

Note: We have successfully used 18V and 24v power supplies between 4A and 6A. Other power supplies may work. If you are unsure about anything related to powering the machine: STOP AND FIND A QUALIFIED PERSON TO ASSIST YOU!

I used an old power cord and connected the Load, Neutral, and Ground to the black, white, and green wires.

The COM connection on the power supply should be connected to the - on the driver shield. The +V connects to the + on the driver shield.


Stepper Motors

The ShapeOko requires at least three stepper motors, one for each axis (Dual-drive Y-Axis is a popular upgrade and is now standard on the ShapeOko 2). See Stepper Motors for more detail.

500px 470px

Connect the stepper motors to the stepper shield as shown below.



To convert Lin Engineering 5718x-05E-03 from uni-polar to bi-polar stepper motors: my original notes from 3 years ago

  • cut the connector off the end of the leads
  • strip off about 1/2" of coating on all 8 wires
  • connect the red/white wire to the solid blue wire (twist them together, then cover with electrical tape or shrink tubing)
  • connect the black/white wire to the solid green wire (twist them together, then cover with electrical tape or shrink tubing)

Now you are left with four wires:

  • black
  • green/white
  • red
  • blue/white

Coil 1 = Black | green/white Coil 2 = Red | blue/white

Make sure none of the 4 remaining wires are touching each other.

  • Spin the motor shaft with your fingers. It should be pretty easy to turn
  • Now, if you touch the coil wires together (i.e. Black -> Green/White) you will feel resistance when turning the motor
  • Same goes if you touch the Red wire to the blue/white wire and attempt to turn the motor shaft

Ventilation and Cooling

Two 12 volts DC fans in series can be connected directly to the power supply to cool everything as each one will have a voltage drop of around 12 volts. There has been some discussion in the Forums indicating this should not be done. Please research and consider the electrical aspects before doing this.

Further Alternatives

See also Advanced Electronics