Introduction: DRV8825 Compatible Servo Control With Digispark Arduino

This project is intended to provide a simple solution for using servos with CNC and plotter projects based on GRBL Arduino firmware (and CNC shield). Of course it is possible to use a modified GRBL firmware and drive the servo directly from the main Arduino. However, this requires specialized firmware and often specific Gcode instructions.

This project strives to use a Digispark (Attiny85) to imitate the DRV8825 stepper drivers to control the servo. This way you can use generic Gcode and the Digispark takes care of converting the Z axis commands to servo movement. My goal was to make this as simple as possible so anyone can do it. It would also work on other axes, but placement of the module might become less trivial and my main focus was the Z axis (as for 2.5D plotter like movement).

Step 1: Needed Parts

Needed: One Digispark module, the included pin header and two pieces of hard wire.

For the software one needs the Arduino IDE, the Digispark drivers and a micro USB cable.

For testing: a servo!

Step 2: Soldering

Solder the pin header on the bottom and the wires on the 5V and the GND pin.

Step 3: Flash the Firmware

Use the Arduino environment to upload the included ino file to the Digispark. Instructions on how to set up the Arduino IDE for Digispark can be found on the internet with some googling. Once the firmware is flashed, the USB cable is no longer needed

Step 4: Put It All Together

The Digispark module can be inserted as shown on the photo. The 5V and GND wires can be inserted in the FAULT and GND pins of the DRV socket (as shown in the picture). P0 of the Digispark module aligns with the DRV8825 DIR pin.

The servo PWM pin should be removed from the three-pin dupont socket and connected to the pin that is used for microstepping jumper (M2) because that way it is connected to P4 which does the PWM stuff. If you are not sure which pin on the shiled it is, you can try all six of them without damaging stuf.

Power for the servo can be taken from the CNC shield as shown in the picture. Now you can control the servo with generic Gcode Z commands!

Certainly the movement of the servo is limited to 180 degrees, but it remembers the absolute position, so it is possible to return to zero position. If necessary the startup position (initial value = 90) and the sensitivity (MICROSTEP) can be adjusted in the code.

For heavier servos an external power supply might be a good idea, since the 5V on the CNC shield is powered from the USB port of the computer. For simple servos it should suffice.

Arduino Contest 2016

Participated in the
Arduino Contest 2016

CNC Contest 2016

Participated in the
CNC Contest 2016