# KS0096 keyestudio CNC Kit / CNC Shield V4.0 + Nano 3.0+3pcs a4988 Driver / GRBL Compatible Download Resource: [Resource](./Resource.7z) ![](media/wps1.png) ## 1. Introduction **keyestudio CNC Shield V4** Keyestudio CNC shield v4.0 needs to work with Keyestudio nano ch340 . It can be used as driver expansion board for engraving machines. It has in total 3 channel slots for A4988 stepper motor driver modules (not included) for driving 3 channel of stepper motors. Each channel of stepper motor only needs 2 IO ports, which means 6 IO ports is sufficient to manage 3 stepper motors. This shield can make quick work for managing stepper motors in your project. **keyestudio nano ch340** keyestudio nano ch340 controller is a small, complete board based on the ATmega328. It’s a open source Simple I/O platform with 12 Digital I/O Pins (of which 6 provide PWM output), 8 Analog Input Pins, pin 0 (RX) and 1 (TX) used to receive (RX) and transmit (TX) TTL serial data, a Mini-B USB connection, an ICSP header and a reset button. ## 2. Specification - 3 axis stepper motor driver - Compatible with micro-drive laser engraving machine, three-axis CNC engraving machine. - 2A can be controlled within the two-phase four-wire stepper motor. - Released the digital IO interface, easy to connect to other modules, such as ENDSTOP. - Released the I2C interface, you can connect to the LCD I2C or other I2C module. - power DC5v interface, 7.5-12V voltage input. - GRBL compatible - worked with arduino nano. ## 3. Kit list - 1x CNC Shield V4.0 - 1x nano board - 3x A4988 driver - 1x USB cable ## 4. Connection Diagram ![](media/wps2.png) ## 5. Software Download Open the browser and search: https://www.arduino.cc/en/software, we will take WINDOWS system as an example to show you how to download and install. ![](media/1.gif) You just need to click JUSTDOWNLOAD,then click the downloaded file to install it. And when the ZIP file is downloaded,you can directly unzip and start it. ![](media/2.gif) ## 6. Driver installation The driver is usually installed automatically when the board is connected to the computer. When the Arduino IDE can recognize the board port and upload the program, it proves that the installation has been completed automatically, so there is no need to carry out the operation of the tutorial in this section. If you can't recognize the board port and upload the program, please refer to the tutorial to install the driver manually. ### 6.1 Windows System **Checking the driver** 1. Connect the motherboard to the computer. 2. Open Device Manager,Open the device manager, if the prompt **"USB-SERIAL CH340(COMX)"** appears to prove that the driver has been installed, please skip the **"Driver installation"** part. ![](media/1-1767087859891-5.gif) **Manual driver installation** 1. Driver download - Windows System: [Windows System driver](./Windows.7z) 2. Connect the motherboard to the computer, open the device manager, if there is a yellow exclamation mark in front of the driver in the picture, it proves that the driver is not installed, please download the driver and install it manually. ![](media/2-1767087881926-7.gif) ### 6.2 MAC System **1 Checking the driver** Connect the development board to the computer, according to [Tools] ---> [Port] to select the development board port (Note: If you can not confirm which port is the development board, please connect the motherboard to take pictures to record all the ports, and then unplug the development board to re-take pictures to record all the ports, and then compare to find the disappeared ports, and then unplug the motherboard after the disappeared ports is the port of the board, and then select the port on the line)If you can not recognize the port, please replace the computer USB port or around the phone cable to re-recognize the port, if it still does not work refer to the following steps to install the driver. ![](media/image-20251230174826430.png) **2 Manual driver installation** 1. Driver download ​ Mac System: [Mac System driver](./Mac.7z) 2. double-click to decompress the downloaded driver zip package ![](media/4.gif) At this point, the port can be recognized by plugging in the board again. ## 7.Set Arduino IDE Connecting the board to the computer,and select the development board and port. ![](media/image-20251230175103259.png) ![](media/image-20251230175207492.png) **Upload the Code** Below is an example code for displaying the Hello World! Copy and paste the code to the Arduino environment IDE. ```c int val; int ledpin=13; void setup() { Serial.begin(9600); pinMode(ledpin,OUTPUT); } void loop() { val=Serial.read(); if(val=='R') { digitalWrite(ledpin,HIGH); delay(500); digitalWrite(ledpin,LOW); delay(500); Serial.println("Hello World!"); } } ``` **Result** ![](media/image-20251231092119393.png) After that, click the button to open the serial monitor. ![](media/image-20251231092224420.png) Then set the baud rate to 9600, enter an “R” and click Send, that is, the computer will send the character R. When NANO board receives it, you should see the RX led on the board flash once, and then D13 led flash once; when keyestudio NANO board sends "Hello World!" to the computer, finally you should see the "Hello World!" is showed on the monitor, and TX led on the board flash once. ![](media/image-20251231092315368.png) ## 8. Using Method ### 8.1 Test Main Board First, write below code in IDE to test whether main board, shield and three motors work normally. **Explanation** 1. If you properly reduce the value 800 in delayMicroseconds(800) to increase the frequency of input PWM signal, you can increase the rotation speed of stepper motor. The change of value cannot be too much or the motor will stop moving. 2. Rotate the knob on A4988, you can adjust the output current of the motors to change the torque. **Code** ```c #define EN 8 // stepper motor enable, low level effective #define X_DIR 5 //X axis, stepper motor direction control #define Y_DIR 6 //y axis, stepper motor direction control #define Z_DIR 7 //z axis, stepper motor direction control #define X_STP 2 //x axis, stepper motor control #define Y_STP 3 //y axis, stepper motor control #define Z_STP 4 //z axis, stepper motor control /* // Function: step -control the direction and number of steps of the stepper motor // Parameter: dir -direction control, dirPin corresponds to DIR pin, stepperPin correspomds to step pin, steps is the number of steps. // no return value */ void step(boolean dir, byte dirPin, byte stepperPin, int steps) { digitalWrite(dirPin, dir); delay(50); for (int i = 0; i < steps; i++) { digitalWrite(stepperPin, HIGH); delayMicroseconds(800); digitalWrite(stepperPin, LOW); delayMicroseconds(800); } } void setup()// set the IO pins for the stepper motors as output { pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT); pinMode(Y_DIR, OUTPUT); pinMode(Y_STP, OUTPUT); pinMode(Z_DIR, OUTPUT); pinMode(Z_STP, OUTPUT); pinMode(EN, OUTPUT); digitalWrite(EN, LOW); } void loop() { step(false, X_DIR, X_STP, 3200); // x axis motor rotates CCW for 1 circle, as in 200 steps step(false, Y_DIR, Y_STP, 3200); // y axis motor rotates CCW for 1 circle, as in 200 steps step(false, Z_DIR, Z_STP, 3200); // z axis motor rotates CCW for 1 circle, as in 200 steps delay(1000); step(true, X_DIR, X_STP, 3200); // X axis motor rotates CW for 1 circle, as in 200 steps step(true, Y_DIR, Y_STP, 3200); // y axis motor rotates CW for 1 circle, as in 200 steps step(true, Z_DIR, Z_STP, 3200); // z axis motor rotates CW for 1 circle, as in 200 steps delay(1000); } ``` ### 8.2 Install Firmware and Grbl Controller **a. Add Library** Open the Arduino IDE, follow [Sketch] → [Include Library] → [Add .zip Library]. ![](media/1-1767146219332-1.gif) **code** Note: before uploading the code, you need to import the library files; otherwise, the code upload will fail. ```c #include void setup() { startGrbl(); } void loop() { } //Burn the code above to keyestudio nano ch340 ``` **c. Install GrblController361 Software** Grbl Controller is a piece of software which is used to send GCode to CNC Machines. Run Grbl Controller361 Setup in your installation packet, the interface below will come out: Click Next to continue. ![](media/wps1-1767144801195-1.png) For a license agreement, please check I accept the agreement and click Next. ![](media/wps2-1767144866106-3.png) When you are ready to continue with Setup, click Next. ![](media/wps3.png) To continue, click Next. If you would like to select a different folder to install, click Browse. ![](media/wps4.png) To continue, click Next. If you would like to select a different folder to place program’s shortcuts, click Browse. ![](media/wps5.png) Select the additional tasks you would like Setup to perform while installing Grbl Controller, then click Next. ![img](media/wps6.png) Click Install to continue with the installation. ![](media/wps7.png) Click Next. ![](media/wps8.png) At last, click ”Finish” to finish the installation. ![](media/wps9.png) **c. Test G-Code on Grbl Controller** Power the main board using a USB cable and connect correctly all your external devices, then run Grbl Controller. Choose Port name the same as IDE COM port and click “Open” to open the series port, connecting CNC Machines with computer. ![](media/wps10.png) After opening the series port, the “Open” button change into “Close/Reset” and get red! At this time you can click the X axis、Y axis、Z axis as shown in below diagram to adjust the motion direction of motors. ![](media/wps11.jpg) Notes: after adjusting the axies, before beginning G-Code file, you must close and open again . Now, it is time to have a try! Click ”Choose file” to choose one G-Code file named cn. to test in the data packet for a beginner, and the interface will come out: ![](media/wps12.jpg) Click “Begin” , and you can see how the motors move on coordinates.