Dual Arduino “CNC” control
Generally when you work with CNC machinery, you program it on a computer, then allow a controller to automatically run through a cutting routine. Arduino boards have long been used for this kind of control through the grbl software package, but YouTuber Electronoobs decided to do things a bit differently.
His setup takes input from a potentiometer and several buttons, enabling manual control of his stepper motor-driven router. An Arduino Nano powers the motors through a pair of stepper drivers, while a second Nano is then used to output distance information on an LCD screen, letting him view exactly where his cutter is at a glance.
Why use 2 Arduinos? Well, if I use only one, the code would be very difficult with too much interruptions. We have to create pulses for the motors and print on the LCD at the same time. I’ve done that and each time I was printing on the LCD, there was a small pause in the motor rotation, and if the refresh rate is fast, the motors will have a pause each time and we don’t want that. That’s why I use 2 Arduinos. One will create the pulses for the motors and the other one will count the steps and print the distance and speed.
We have 2 step motors. I’ve used NEMA 17. Each with a A4988 driver. This driver needs 3 signals from the Arduino. Enable, direction and steps. The enable pin is connected to a toggle switch so we could start to stop the motors manually. The toggle switch is also connected to the Arduinos so we could know when the motors are enabled or not. To control speed we use a lineal potentiometer and to move axis and reset position, some push buttons with pulldowns. To print the distance, I’ve used an I2S LCD screen of 20×4 but you will have the code for the 16×2 version of LCD as well.
Besides adding a nice readout to the machine, this concept could certainly form the basis for all manner of other stepper-driven devices.