Page 5
Copyright The Keyestudio trademark and logo are the copyright of KEYES DIY ROBOT co.,LTD. All products under Keyestu- dio brand can’t be copied, sold or resold without authorization by anyone or any company.
Page 6
WiKi FKS0003 KEYESTUDIO SMART ROBOT ARM KIT WITH JOYSTICK FOR ESP32...
1. KIT LIST Please check the list to ensure that all parts are intact. If you find missing ones, please contact our sales staff immediately. NAME Keyestudio ESP32 servo drive board keyestudio ESP32 Core board Keyestudio Joystick Module 3D PS2 joystick cap...
Page 8
WiKi Table 1 – continued from previous page NAME MG90S 14G 180° servo metal gear Keyestudio 9G 180° servo DC 6-slot AA battery holder 15CM connector 2 18650 battery packs (recommended to use pointed 18650 batteries) F-F 50CM/10P DuPont wire...
Page 9
WiKi Table 1 – continued from previous page NAME M2+M3 wrench F693ZZ motor classInner: 3MM; Outer: 8MM; Thickness: 4MM AXK 3-plate flat bearingInner: 20MM; Outer: 35MM, Thickness: 4MM 2 bearing covers 4 acrylic board M3 nut M2 nut M3 self-locking nut...
Page 10
WiKi Table 1 – continued from previous page NAME M2.5 nut M3*6MM round head screw M2*10MM round head screw M3*8MM round head screw M1.2*5MM self-tapping screw 2.54MM M3*10MM round head screw M3*12MM round head screw M3*6MM round head nylon screw...
Page 11
WiKi Table 1 – continued from previous page NAME M2.5*25+6MM single-pass copper pillar M2.5*6MM round head screw M1.4*6MM self-tapping screw M3*6+6MM single-pass copper pillar M3*14MM flat head screw...
2. DESCRIPTION Based on ESP32 development board, we utilize various servos to build up a programmable robot arm, which is able to wave, grasp and lift objects. It can be controlled by WiFi and Bluetooth to communicate with other devices.
Flexibility: With 4 degrees of freedom, the robot arm is able to move and rotate in multiple directions to perform complex actions and tasks. Convenient Control: The ESP32 microcontroller is used as the control core, and its rich interface are convenient for communication and control with other devices or systems.
5.1 5.1 Introduction Based on ESP-WROOM-32, the keyestudio ESP32 Core board is a mini development board, whose I/O pins are reserved a space of 2.54mm on both sides, so that it can be connected to peripherals according to needs. In addition, these pins also make your operation more concise and convenient when using and debugging.
Although ESP32 board boasts fewer pins than commonly used processors, you will not encounter any problems when you reuse multiple functions on pins (pins IO36, IO35, IO34, IO39 only inputs signals). ATTENTION: The voltage of ESP32 pins is 3.3V. If it works with other devices with an operating voltage of 5V, a level converter is required.
Page 21
WiKi GND: 3 GND pins. Enable pin(EN): used to enable or disable modules. The pin enables module at high and disables at low. I/O pin(GPIO): 32 GPIO pins, used to communicate with LED, switches, and other input/output devices. These pins can be pulled up or down.
6.1 6.1 Description The KEYESTUDIO ESP32 servo drive board has 6 servo drive ports (5V), 9 IO ports (3.3V), and two IIC interfaces (3.3V). The servo drive uses two LM2596S-5.0V 3A high current power ICs to provide working voltage to the servo.
For Windows, there is an easier way to install the ESP32, click the link to download esp32_package_2.0. 12_arduinome.exe. Click to enable the automatic installation. After that, open Arduino IDE and you will see ESP32: esp32_package_2.0.12_arduinome.exe download link:...
Page 26
WiKi Chapter 7. 7. Arduino IDE Basic Tutorial...
Page 65
WiKi Test code: Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 8.6 is named 8-6. 8.6. 8.6 Right-side Upper Arm and Its Servo...
Page 66
WiKi Keyestudio ESP32 Robot Arm 8-6 Servo Configuration Function: set servo at pin IO17 to the angle of 90° http://www.keyestudio.com #include <ESP32Servo.h> // create a servo objects Customizable name Servo servo; servoPin //Connect servo to pin IO17 void setup() servo.attach(servoPin);...
Page 67
WiKi 8.6. 8.6 Right-side Upper Arm and Its Servo...
Page 79
WiKi Test code: Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 8.8 is named 8-8. 8.8. 8.8 Left-side Forearm/Upper Arm and Forearm Servo...
Page 80
WiKi Keyestudio ESP32 Robot Arm 8-8 Servo Configuration Function: Set servo at pin IO2 to the angle of 90° http://www.keyestudio.com #include <ESP32Servo.h> // create a servo objects Customizable name Servo servo; servoPin //Connect servo to pin IO2 void setup() servo.attach(servoPin);...
Page 81
WiKi 8.8. 8.8 Left-side Forearm/Upper Arm and Forearm Servo...
Page 89
WiKi Test code: Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 8.10 is named 8-10. 8.10. 8.10 Claw...
Page 90
WiKi Keyestudio ESP32 Robot Arm 8-10 Servo Configuration Function: Set servo at pin IO4 to the angle of 90° http://www.keyestudio.com #include <ESP32Servo.h> // create a servo objects Customizable name Servo servo; servoPin //Connect servo to pin IO4 void setup() servo.attach(servoPin);...
Page 107
WiKi Test code: Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 8.12 is named 8-12. 8.12. 8.12 Base and Bearing...
Page 108
WiKi Keyestudio ESP32 Robot Arm 8-12 Servo Configuaration Function: set servo at pin IO16 to the angle of 90° http://www.keyestudio.com #include <ESP32Servo.h> // create a servo objects Customizable name Servo servo; servoPin //Connect servo to pin IO16 void setup() servo.attach(servoPin);...
WiKi 8.15 8.15 Wiring Servo wiring: Connect the corresponding servo motor to the corresponding IO port according to the schematic diagram of the im- ageThe wiring is consistent with the angle settings of each servo motor 8.15. 8.15 Wiring...
CHAPTER NINE 9. ROBOT ARM PROJECTS 9.1 9.1 Control Servo 9.1.1 9.1.1 Introduction Servo is a position driver, which is mainly composed of a shell, a circuit board, a non-core motor, a gear and a position detector. When a receiver or an MCU sends a signal to the steering gear, its built-in reference circuit generates a reference signal with a period of 20ms and a width of 1.5ms.
WiKi 9.1.3 9.1.3 Principle The rotation angle of the servo can be controlled by adjusting the duty cycle of the PWM (pulse width modulation) signal. The period of the standard PWM (pulse width modulation) signal is fixed at 20ms (50Hz). Theoretically, pulse width should be within 1ms ~ 2ms, but in fact, the range is 0.5ms ~ 2.5ms, corresponding to the rotation angle of 0°...
WiKi 9.1.4 9.1.4 Wiring Diagram 9.1.5 9.1.5 Test Code Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.1.5is named 9-1-5. 9.1. 9.1 Control Servo...
Page 126
WiKi Keyestudio ESP32 Robot Arm 9-1-5 tutorial code Function: control the servo to rotate to 0°, 90°, 180° http://www.keyestudio.com #include <ESP32Servo.h> // create a servo objects Customizable name Servo servo; servoPin //Connect servo to pin IO16 void setup() servo.attach(servoPin);...
Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.1.7.1 is named 9-1-7-1. Keyestudio ESP32 Robot Arm 9-1-7-1 tutorial code Function: servo slowly rotates from 0° to 180°, and then slowly back to 0°...
9.2.3 9.2.3 Principle Axis X and Y are actually two potentiometers. As shown below, the analog value of the X(Y) axis ranges from 0 ~ 4095 (the analog value of ESP32 is 0 ~ 4095). Chapter 9. 9. Robot Arm Projects...
Page 129
WiKi The analog value will decrease in the Y-axis upward because the resistance of the output pin to the ground is decreasing, and the resistance will be increasing in the downward direction. So does it in the X-axis (direction: right and left).
Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.2.5 is named 9-2-5. Keyestudio ESP32 Robot Arm 9-2-5 tutorial code Function: read the value of the joystick in axis X Y Z http://www.keyestudio.com...
WiKi 9.2.7 9.2.7 Read the remote lever value of the handle Connect two remote rod sensors to the ESP32 servo drive board, then read the values and print them through the serial port. Chapter 9. 9. Robot Arm Projects...
Page 133
WiKi 9.2.7.1Wiring Diagram 9.2. 9.2 Read Analog Value of Joystick...
Page 134
WiKi 9.2.7.2 Code Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.2.7.2is named 9-2-7-2. Keyestudio ESP32 Robot Arm 9-2-7-2 tutorial code Function: http://www.keyestudio.com //Define the left remote rod pin #define left_B 12...
9.3.1 9.3.1 Introduction We connect the ESP32 development board and the joystick module to the servo drive board, and then the development board reads the value of the axis X/Y of the module to determine the rotation angle, so that the arm is controlled by the module.
WiKi 9.3.3 9.3.3 Test Code Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.3.3 is named 9-3-3. Keyestudio ESP32 Robot Arm 9-3-3 tutorial code Function: joystick control the robot arm http://www.keyestudio.com #include "ESP32Servo.h"...
Page 139
WiKi (continued from previous page) gripper.attach(gripperPin); base.write(baseAngle); arm.write(armAngle); forearm.write(forearmAngle); gripper.write(gripperAngle); void loop() { // put your main code here, to run repeatedly: left_B_data digitalRead(left_B); left_X_data analogRead(left_X); left_Y_data analogRead(left_Y); right_B_data digitalRead(right_B); right_X_data analogRead(right_X); right_Y_data analogRead(right_Y); baseControl(); armControl(); forearmControl(); gripperControl(); //control base...
Page 140
WiKi (continued from previous page) (armAngle <= 80) armAngle delay(10); //control forearm void forearmControl() { (right_Y_data < 20) { while (analogRead(right_Y) < 20) { forearm.write(forearmAngle++); (forearmAngle >= 120) forearmAngle 120; delay(10); else if (right_Y_data > 3000) { while (analogRead(right_Y) >...
WiKi 9.3.4 9.3.4 Test Result After uploading the code, rotate joysticks to control the arm. For the left joystick, axis X controls the entire rotation of the robot arm (X < 20: turn right; X > 3000: turn left); its axis Y raises and lowers the upper arm (Y <...
Page 143
WiKi 9.3.5.1 Flow 9.3. 9.3 Joystick Control Robot Arm...
Page 144
Download codes: Codes Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.3.5.2 is named 9-3-5-2. Keyestudio ESP32 Robot Arm 9-3-5-2 tutorial code Function: joystick controls arm, axis z stores the rotation angle and re-plays the␣...
Page 145
WiKi (continued from previous page) pinMode(left_Y, INPUT); pinMode(right_B, INPUT); pinMode(right_X, INPUT); pinMode(right_Y, INPUT); Serial.begin(9600); base.attach(basePin); // attaches the servo on pin 16 to the servo object arm.attach(armPin); forearm.attach(forearmPin); gripper.attach(gripperPin); base.write(90); arm.write(90); forearm.write(90); gripper.write(90); void loop() { // put your main code here, to run repeatedly: left_B_data digitalRead(left_B);...
Page 146
WiKi (continued from previous page) (left_Y_data > 3000) { while (analogRead(left_Y) > 3000) { arm.write(armAngle++); (armAngle >= 180) armAngle 180; delay(10); else if (left_Y_data < 20) { while (analogRead(left_Y) < 20) { arm.write(armAngle--); (armAngle <= 80) armAngle delay(10); //forearm control...
In the previous project, we learned how to control the robot arm via joysticks. In this experiment, we will control the arm through WiFi. We just need to connect a mobile phone/pad and ESP32 board to one wifi frequency of 2.4GHz (ESP32 only connect to 2.4GHz frequency wifi). After uploading code, we can control the arm by wifi.
Page 150
Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.4.2 is named 9-4-2-1. (because there are two codes in this section, add -1 and -2 after 9-4-2 to distinguish) Ensure the ESP32 correctly connects to Wi-Fi first. You may refer to the following code: Keyestudio ESP32 Robot Arm...
Page 151
WiKi (continued from previous page) Serial.begin(9600); //initialize Wifi WiFi.begin(ssid, password); //search wifi. while loop: if no wifi is connected, keep searching; state: connecting while (WiFi.status() WL_CONNECTED) { delay(500); Serial.print("."); Serial.println(""); Serial.println("WiFi connected."); //wifi connected: print the IP address Serial.println("Connected to WiFi");...
Page 152
WiKi Once Wi-Fi is connected, ESP32’s Web server will serve up web pages. In the following example, we will create a simple web page that says “Hello, World!” : Keyestudio ESP32 Robot Arm 9-4-2-2 tutorial code Function: Conenct to WiFi and print esp32 IP address, set up a web page saying “Hello␣...
Page 153
“Hello, World!”. When PC, mobile device and ESP32 board connect to the same network, you can visit that page on two devices simultaneously. Here will be your IP address of ESP32.
WiKi 9.4.3 9.4.3 WiFi Control Robot Arm Chapter 9. 9. Robot Arm Projects...
Page 155
WiKi 9.4.3.1 Flow 9.4. 9.4 WiFi Control Robot Arm...
Page 156
"your_SSID"; const char *PASS "your_PASSWORD"; Code: Keyestudio ESP32 Robot Arm 9-4-3-2 tutorial code Function: connect ESP32 to wifi to check IP address. Visit the address to enter a␣ control panel to control the arm wirelessly http://www.keyestudio.com #include <WiFi.h> #include <WebServer.h>...
Page 157
WiKi (continued from previous page) slider4Value // Default position void setup() { Serial.begin(9600); base.attach(basePin); // Connect base to pin 2 arm.attach(armPin); // Connect arm to pin 4 forearm.attach(forearmPin); // Connect forearm to pin 5 gripper.attach(gripperPin); // Connect gripper to pin 18 delay(100);...
Page 158
8, pos4 11).toInt(); gripperControl(val4); // HTML Page String webPage "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta␣ name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>ESP32 Servo␣ Control</title>\ <style>body {font-family: Arial, sans-serif;background-color: #f5f5f5;margin: 0;padding:␣ 0;}\ .container {max-width: 100%;margin: 20px auto;padding: 20px;background-color: #fff; (continues on next page) Chapter 9. 9. Robot Arm Projects...
Page 160
WiKi (continued from previous page) client.println("HTTP/1.1 200 OK"); //Sends an HTTP response header to␣ indicate that the server successfully processed the request client.println("Content-Type: text/html"); //Set the type of the response content to␣ HTML client.println("Connection: close"); //Disconnect to the client when the␣...
Page 161
WiKi (continued from previous page) else if (angleVal < armAngle) { while (angleVal < armAngle) { arm.write(armAngle--); (armAngle <= 80) armAngle delay(10); // forearm control void forearmControl(int angle) { angleVal map(angle, 0, 180, 30, 150); (angleVal > forearmAngle) {...
Page 162
After uploading code, open Arduino IDE and set baud rate to 9600. After the wifi is connected, the serial monitor prints the IP address of ESP32: Open the browser and visit the IP address in the URL bar, such as “192.168.135.7” here. Enter the web page as shown below: Chapter 9.
3. When “— —..— —..— —..” appears and the uploading is exited with an error, please click the “upload” button on IDE and then press the Boot button on ESP32:...
Page 166
DC power (being powered ON). When the current of the computer USB port cannot meet the working needs of the robot arm, the ESP32 cannot work normally, so then the connection is unstable. Chapter 10. FAQ...
2. Please check whether the WiFi name and passwords are correct. 3. Please check what the frequency of wifi is. The esp32 only connects wifi at a frequency of 2.4GHz. 10.5 Q: Sensors respond slowly when remote control via web.
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers