Introduction: CNC Servo Stepper(GRBL Capable)

About: I release original projects, tips, tricks and secrets. My focus is Electronics and Programing.

This project is a fairly simple motor controller that allows the use of cheap powerful DC motors with GRBL to operate the lead screws of a CNC machine. Check out the video above for a demonstration of this controller on my home built CNC machine connected to GRBL running on a home built Arduino on a perf board responding to G code sent with universal G code sender.

I designed this because I was building a fairly large CNC machine from scratch and I knew it was going to be too heavy and stiff for small stepper motors to be able to operate it.

The goal was to use cheap high torque DC gear motors but still have the ability to use G code like a normal CNC machine.


(for each axis)

1 Arduino nano

1 Hbridge strong enough to handle whatever motor you choose.

2 10k resistors

1 2k ohm resistor

1 500ohm pot

2 IR detector diodes

1 IR emitter diode

1 perf board

some wire

an encoder wheel(you can make it yourself or buy one)

soldering iron and solder

wire cutter/stripper

a hack saw

Step 1: Cut the Board

Use the hacksaw to cut into the perf board to make a slot for the encoder to slip through.

The photo above shows the slot in the board and how my wheel fits in it.

The key here is to cut it a little deeper than it needs to be so the encoder wheel does not drag or hit the board.

The detectors and emitter need to flank the slot so leave enough room on the board to accommodate them.

Step 2: Assembly

Place the nano and other components on the board.

Because it is perf board and every setup may be different placement of parts is up to you, but the connections must be as shown in the picture.

When placing the detectors take care to tie the anodes together and connect them to ground, and the cathodes must be separate.

Make sure there is enough lead on the detectors and emitter to allow them to be bent and adjusted.

You can use some tape or shrink tubing on the detectors cathodes to prevent them from shorting together.

The potentiometer should be set around center to give a good starting point for calibration when you get to that step.

Step 3: Program the Nano

After it is assembled you can upload the sketch to the nano.

The source file is a sketch for arduino, upload it to the board as you would any other arduino sketch.

Assembly of the mechanical parts is up to you as there are so many options for mechanical parts.

Step 4: Calibration

Once you have the board assembled, programed, mounted to your hardware and the encoder wheel is in place you can begin calibration.

When mounting the board try to get it close to the encoder, and in a position where the IR diodes are close to lined up.

You can move the diodes a little by eye after the board is mounted to get them close to lined up.

Now you power the control board you built, but not the Hbridge.

Move the mechanism and encoder a little and see if the red light blinks on the nano.

Adjust the diodes and potentiometer until the led responds when the teeth of the encoder move between the diodes.

The potentiometer adjusts the intensity of the IR light being emitted.

If too strong the light can bounce and cause the detectors to trip when they should not.

Too weak and the detectors will not trip.

Once you are satisfied with the adjustment you can apply power to the Hbridge.

When you move the encoder the board should read the movement and attempt to move the motor back to the resting position.

If it instead starts spining in the direction you turned the encoder you know that the wires to the motor need reversed on the hbridge output.

CNC Contest 2020

Participated in the
CNC Contest 2020