In this tutorial, we will learn how to make a Programmable 6DOF Robot Arm using Arduino. It is controlled by an Android mobile app. Android mobile app and Robot Arm are connected through Bluetooth. The specialty of this is the ability to be controlled through the mobile app and to remember the steps and operate again and again. we can program the movements of this robot as we want.
You can watch the following video or read the written tutorial below.
Overview
This robot, made of 6DOF Robot Arm Kit, can be controlled by Bluetooth up to a distance of 15 meters. The Android app was made with MIT APP Inverter. It can be controlled as well as programmed using the mobile app. For programming the automatic robot movement with this app, when we press the “SAVE” button we simply store the current positions of the stepper motors into arrays. Then when we press the “RUN” button, we call the runSteps() custom function which executes or runs through all stored steps using some for and while loops.
Components Needed
Before we begin, make sure you have gathered all the necessary components. The purchase links are in the description of my YouTube video.
- 6 DOF Robotics Kit Metal Alloy MG996 for Arduino Robot Arm DIY Programmable Kit
- IO Expansion Shield
- HC-05 Bluetooth module
- 3S Li-Po battery
- Arduino Nano
- Step-down buck converter (12V to 6V)
- Jumper wires
- Soldering iron and solder
- Glue gun
- Mobile device with the 6DOF Arm Robot app installed

Assemble the 6DOF Robot Arm
The 6 DOF Robot Arm Kit is made of metal alloy. When we buy it, we get it as parts (DIY Kit). Make it using the instruction sheet or get the details online. There is a youtube video of me assembling the 6 DOF Robot Arm Kit. It would be great if you could assemble it that way.
YouTube Video Link – https://youtu.be/bmIBn6t7TuM?si=0SMrwzftrtohjM4H



IO Expansion Shield
Using the Arduino NANO IO Expansion Shield is easy to make a programmable 6DOF Robot Arm.

The point indicated by this arrow should be damaged with a blade and the voltage passing through that part should be stopped. The reason for doing this is to provide separate 6V to the MG996R Servo motors. Secure the IO Expansion Shield onto the Arduino Nano. Confirm that the pins align correctly for a stable connection. The expansion shield simplifies interaction with the servo motors and other components, enhancing the project’s flexibility.



Connect the Servo Motors
The MG996R requires an external power supply for operation. It’s essential to provide an appropriate voltage (usually around 4.8 to 7.2 volts) to ensure the motor operates within its specified range. The voltage I supply to the servo motors is 6V. Mark the six MG996R Servo motors of the 6DOF Robot Arm as shown in the figure below.




Connect the MG996R servo motors to the NANO IO Expansion Shield as follows.
- Connect the first MG996R servo motor to the 10th connector of the NANO IO expansion shield.
- Connect the second MG996R servo motor to the 4th connector of the NANO IO expansion shield.
- Connect the third MG996R servo motor to the 3rd connector of the NANO IO expansion shield.
- Connect the fourth MG996R servo motor to the 7th connector of the NANO IO expansion shield.
- Connect the fifth MG996R servo motor to the 6th connector of the NANO IO expansion shield.
- Connect the sixth MG996R servo motor to the 5th connector of the NANO IO expansion shield.
Power Up the System
Power both the Arduino Nano and the servo motors using a 3S LiPo battery through a step-down buck converter. Adjust the buck converter to reduce the voltage from 12V to 6V, ensuring compatibility with both the Arduino Nano and the servo motors.
- Step down to 6 volts Connect the OUT(+) of the step-down module to the AREF (V) pin of the nano io expansion board and the DC male socket (+).
- Step down to 6 volts Connect the OUT(-) of the step-down module to the AREF (G) pin of the nano io expansion board and the DC male socket (-).



Connecting the Bluetooth module to the nano io expansion board.
Integrate the HC-05 Bluetooth module with the Arduino Nano, utilizing the available pins on the IO Expansion Shield. Consult the HC-05’s documentation for accurate pin connections, including power (VCC), ground (GND), transmit (TX), and receive (RX).

In this way, connect the nano io expansion board and the Bluetooth module by jumper wires.
- The VCC pin of the Bluetooth module is connected to the A0 (V) pin of the nano io expansion board.
- The GND pin of the Bluetooth module is connected to the A0 (G) pin of the nano io expansion board.
- The TXD pin of the Bluetooth module is connected to the 11 (S) pin of the nano io expansion board.
- The RXD pin of the Bluetooth module is connected to the 12 (S) pin of the nano io expansion board.
Program the Arduino Nano
Copy the following Arduino code and paste it into the new sketch in the Arduino IDE. Select the board and port and upload the code. Before uploading the code to Arduino NANO board select its processor as old bootloader. The bootloader selected via Tools > Processor > ATmega328P (Old Bootloader) is the “ATmegaBOOT” bootloader. If this is difficult to do, watch a tutorial video.
You can download the Arduino code and open it directly through the Arduino IDE. Click the Download button below to download the Arduino code
#include <SoftwareSerial.h>
#include <AccelStepper.h>
#include <Servo.h>
Servo servo01;
Servo servo02;
Servo servo03;
Servo servo04;
Servo servo05;
Servo servo06;
SoftwareSerial Bluetooth(11, 12); // Arduino(RX, TX) - HC-05 Bluetooth (TX, RX)
// Define the stepper motors and the pins the will use
AccelStepper LeftBackWheel(1, A1, A2); // (Type:driver, STEP, DIR) - Stepper1
AccelStepper LeftFrontWheel(1, 40, 41); // Stepper2
AccelStepper RightBackWheel(1, 44, 45); // Stepper3
AccelStepper RightFrontWheel(1, 46, 47); // Stepper4
#define led 14
int wheelSpeed = 1500;
int lbw[50], lfw[50], rbw[50], rfw[50]; // arrays for storing positions/steps
int servo1Pos, servo2Pos, servo3Pos, servo4Pos, servo5Pos, servo6Pos; // current position
int servo1PPos, servo2PPos, servo3PPos, servo4PPos, servo5PPos, servo6PPos; // previous position
int servo01SP[50], servo02SP[50], servo03SP[50], servo04SP[50], servo05SP[50], servo06SP[50]; // for storing positions/steps
int speedDelay = 20;
int index = 0;
int dataIn;
int m = 0;
void setup() {
// Set initial seed values for the steppers
LeftFrontWheel.setMaxSpeed(3000);
LeftBackWheel.setMaxSpeed(3000);
RightFrontWheel.setMaxSpeed(3000);
RightBackWheel.setMaxSpeed(3000);
pinMode(led, OUTPUT);
servo01.attach(5);
servo02.attach(6);
servo03.attach(7);
servo04.attach(3);
servo05.attach(4);
servo06.attach(10);
Bluetooth.begin(9600); // Default baud rate of the Bluetooth module
Bluetooth.setTimeout(5);
delay(20);
Serial.begin(9600);
// Move robot arm to initial position
servo1PPos = 90;
servo01.write(servo1PPos);
servo2PPos = 60;
servo02.write(servo2PPos);
servo3PPos = 100;
servo03.write(servo3PPos);
servo4PPos = 120;
servo04.write(servo4PPos);
servo5PPos = 90;
servo05.write(servo5PPos);
servo6PPos = 140;
servo06.write(servo6PPos);
}
void loop() {
// Check for incoming data
if (Bluetooth.available() > 0) {
dataIn = Bluetooth.read(); // Read the data
Serial.println(dataIn);
if (dataIn == 0) {
m = 0;
}
if (dataIn == 1) {
m = 1;
}
if (dataIn == 2) {
m = 2;
}
if (dataIn == 3) {
m = 3;
}
if (dataIn == 4) {
m = 4;
}
if (dataIn == 5) {
m = 5;
}
if (dataIn == 6) {
m = 6;
}
if (dataIn == 7) {
m = 7;
}
if (dataIn == 8) {
m = 8;
}
if (dataIn == 9) {
m = 9;
}
if (dataIn == 10) {
m = 10;
}
if (dataIn == 11) {
m = 11;
}
if (dataIn == 12) {
m = 12;
}
if (dataIn == 14) {
m = 14;
}
if (dataIn == 16) {
m = 16;
}
if (dataIn == 17) {
m = 17;
}
if (dataIn == 18) {
m = 18;
}
if (dataIn == 19) {
m = 19;
}
if (dataIn == 20) {
m = 20;
}
if (dataIn == 21) {
m = 21;
}
if (dataIn == 22) {
m = 22;
}
if (dataIn == 23) {
m = 23;
}
if (dataIn == 24) {
m = 24;
}
if (dataIn == 25) {
m = 25;
}
if (dataIn == 26) {
m = 26;
}
if (dataIn == 27) {
m = 27;
}
// Move the Mecanum wheels platform
if (m == 4) {
moveSidewaysLeft();
}
if (m == 5) {
moveSidewaysRight();
}
if (m == 2) {
moveForward();
}
if (m == 7) {
moveBackward();
}
if (m == 3) {
moveRightForward();
}
if (m == 1) {
moveLeftForward();
}
if (m == 8) {
moveRightBackward();
}
if (m == 6) {
moveLeftBackward();
}
if (m == 9) {
rotateLeft();
}
if (m == 10) {
rotateRight();
}
if (m == 0) {
stopMoving();
}
// Mecanum wheels speed
if (dataIn > 30 & dataIn < 100) {
wheelSpeed = dataIn * 20;
}
// Move robot arm
// Move servo 1 in positive direction
while (m == 16) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo01.write(servo1PPos);
servo1PPos++;
delay(speedDelay);
}
// Move servo 1 in negative direction
while (m == 17) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo01.write(servo1PPos);
servo1PPos--;
delay(speedDelay);
}
// Move servo 2
while (m == 19) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo02.write(servo2PPos);
servo2PPos++;
delay(speedDelay);
}
while (m == 18) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo02.write(servo2PPos);
servo2PPos--;
delay(speedDelay);
}
// Move servo 3
while (m == 20) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo03.write(servo3PPos);
servo3PPos++;
delay(speedDelay);
}
while (m == 21) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo03.write(servo3PPos);
servo3PPos--;
delay(speedDelay);
}
// Move servo 4
while (m == 23) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo04.write(servo4PPos);
servo4PPos++;
delay(speedDelay);
}
while (m == 22) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo04.write(servo4PPos);
servo4PPos--;
delay(speedDelay);
}
// Move servo 5
while (m == 25) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo05.write(servo5PPos);
servo5PPos++;
delay(speedDelay);
}
while (m == 24) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo05.write(servo5PPos);
servo5PPos--;
delay(speedDelay);
}
// Move servo 6
while (m == 26) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo06.write(servo6PPos);
servo6PPos++;
delay(speedDelay);
}
while (m == 27) {
if (Bluetooth.available() > 0) {
m = Bluetooth.read();
}
servo06.write(servo6PPos);
servo6PPos--;
delay(speedDelay);
}
// If arm speed slider is changed
if (dataIn > 101 & dataIn < 250) {
speedDelay = dataIn / 5; // Change servo speed (delay time)
}
// If button "SAVE" is pressed
if (m == 12) {
//if it's initial save, set the steppers position to 0
if (index == 0) {
LeftBackWheel.setCurrentPosition(0);
LeftFrontWheel.setCurrentPosition(0);
RightBackWheel.setCurrentPosition(0);
RightFrontWheel.setCurrentPosition(0);
}
lbw[index] = LeftBackWheel.currentPosition(); // save position into the array
lfw[index] = LeftFrontWheel.currentPosition();
rbw[index] = RightBackWheel.currentPosition();
rfw[index] = RightFrontWheel.currentPosition();
servo01SP[index] = servo1PPos; // save position into the array
servo02SP[index] = servo2PPos;
servo03SP[index] = servo3PPos;
servo04SP[index] = servo4PPos;
servo05SP[index] = servo5PPos;
servo06SP[index] = servo6PPos;
index++; // Increase the array index
m = 0;
}
// If button "RUN" is pressed
if (m == 14) {
runSteps();
// If button "RESET" is pressed
if (dataIn != 14) {
stopMoving();
memset(lbw, 0, sizeof(lbw)); // Clear the array data to 0
memset(lfw, 0, sizeof(lfw));
memset(rbw, 0, sizeof(rbw));
memset(rfw, 0, sizeof(rfw));
memset(servo01SP, 0, sizeof(servo01SP)); // Clear the array data to 0
memset(servo02SP, 0, sizeof(servo02SP));
memset(servo03SP, 0, sizeof(servo03SP));
memset(servo04SP, 0, sizeof(servo04SP));
memset(servo05SP, 0, sizeof(servo05SP));
memset(servo06SP, 0, sizeof(servo06SP));
index = 0; // Index to 0
}
}
}
LeftFrontWheel.runSpeed();
LeftBackWheel.runSpeed();
RightFrontWheel.runSpeed();
RightBackWheel.runSpeed();
// Monitor the battery voltage
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.00) * 3; // Convert the reading values from 5v to suitable 12V i
//Serial.println(voltage);
// If voltage is below 11V turn on the LED
if (voltage < 11) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
void moveForward() {
LeftFrontWheel.setSpeed(wheelSpeed);
LeftBackWheel.setSpeed(wheelSpeed);
RightFrontWheel.setSpeed(wheelSpeed);
RightBackWheel.setSpeed(wheelSpeed);
}
void moveBackward() {
LeftFrontWheel.setSpeed(-wheelSpeed);
LeftBackWheel.setSpeed(-wheelSpeed);
RightFrontWheel.setSpeed(-wheelSpeed);
RightBackWheel.setSpeed(-wheelSpeed);
}
void moveSidewaysRight() {
LeftFrontWheel.setSpeed(wheelSpeed);
LeftBackWheel.setSpeed(-wheelSpeed);
RightFrontWheel.setSpeed(-wheelSpeed);
RightBackWheel.setSpeed(wheelSpeed);
}
void moveSidewaysLeft() {
LeftFrontWheel.setSpeed(-wheelSpeed);
LeftBackWheel.setSpeed(wheelSpeed);
RightFrontWheel.setSpeed(wheelSpeed);
RightBackWheel.setSpeed(-wheelSpeed);
}
void rotateLeft() {
LeftFrontWheel.setSpeed(-wheelSpeed);
LeftBackWheel.setSpeed(-wheelSpeed);
RightFrontWheel.setSpeed(wheelSpeed);
RightBackWheel.setSpeed(wheelSpeed);
}
void rotateRight() {
LeftFrontWheel.setSpeed(wheelSpeed);
LeftBackWheel.setSpeed(wheelSpeed);
RightFrontWheel.setSpeed(-wheelSpeed);
RightBackWheel.setSpeed(-wheelSpeed);
}
void moveRightForward() {
LeftFrontWheel.setSpeed(wheelSpeed);
LeftBackWheel.setSpeed(0);
RightFrontWheel.setSpeed(0);
RightBackWheel.setSpeed(wheelSpeed);
}
void moveRightBackward() {
LeftFrontWheel.setSpeed(0);
LeftBackWheel.setSpeed(-wheelSpeed);
RightFrontWheel.setSpeed(-wheelSpeed);
RightBackWheel.setSpeed(0);
}
void moveLeftForward() {
LeftFrontWheel.setSpeed(0);
LeftBackWheel.setSpeed(wheelSpeed);
RightFrontWheel.setSpeed(wheelSpeed);
RightBackWheel.setSpeed(0);
}
void moveLeftBackward() {
LeftFrontWheel.setSpeed(-wheelSpeed);
LeftBackWheel.setSpeed(0);
RightFrontWheel.setSpeed(0);
RightBackWheel.setSpeed(-wheelSpeed);
}
void stopMoving() {
LeftFrontWheel.setSpeed(0);
LeftBackWheel.setSpeed(0);
RightFrontWheel.setSpeed(0);
RightBackWheel.setSpeed(0);
}
// Automatic mode custom function - run the saved steps
void runSteps() {
while (dataIn != 13) { // Run the steps over and over again until "RESET" button is pressed
for (int i = 0; i <= index - 2; i++) { // Run through all steps(index)
if (Bluetooth.available() > 0) { // Check for incomding data
dataIn = Bluetooth.read();
if ( dataIn == 15) { // If button "PAUSE" is pressed
while (dataIn != 14) { // Wait until "RUN" is pressed again
if (Bluetooth.available() > 0) {
dataIn = Bluetooth.read();
if ( dataIn == 13) {
break;
}
}
}
}
// If speed slider is changed
if (dataIn > 100 & dataIn < 150) {
speedDelay = dataIn / 10; // Change servo speed (delay time)
}
// Mecanum wheels speed
if (dataIn > 30 & dataIn < 100) {
wheelSpeed = dataIn * 10;
dataIn = 14;
}
}
LeftFrontWheel.moveTo(lfw[i]);
LeftFrontWheel.setSpeed(wheelSpeed);
LeftBackWheel.moveTo(lbw[i]);
LeftBackWheel.setSpeed(wheelSpeed);
RightFrontWheel.moveTo(rfw[i]);
RightFrontWheel.setSpeed(wheelSpeed);
RightBackWheel.moveTo(rbw[i]);
RightBackWheel.setSpeed(wheelSpeed);
while (LeftBackWheel.currentPosition() != lbw[i] & LeftFrontWheel.currentPosition() != lfw[i] & RightFrontWheel.currentPosition() != rfw[i] & RightBackWheel.currentPosition() != rbw[i]) {
LeftFrontWheel.runSpeedToPosition();
LeftBackWheel.runSpeedToPosition();
RightFrontWheel.runSpeedToPosition();
RightBackWheel.runSpeedToPosition();
}
// Servo 1
if (servo01SP[i] == servo01SP[i + 1]) {
}
if (servo01SP[i] > servo01SP[i + 1]) {
for ( int j = servo01SP[i]; j >= servo01SP[i + 1]; j--) {
servo01.write(j);
delay(speedDelay);
}
}
if (servo01SP[i] < servo01SP[i + 1]) {
for ( int j = servo01SP[i]; j <= servo01SP[i + 1]; j++) {
servo01.write(j);
delay(speedDelay);
}
}
// Servo 2
if (servo02SP[i] == servo02SP[i + 1]) {
}
if (servo02SP[i] > servo02SP[i + 1]) {
for ( int j = servo02SP[i]; j >= servo02SP[i + 1]; j--) {
servo02.write(j);
delay(speedDelay);
}
}
if (servo02SP[i] < servo02SP[i + 1]) {
for ( int j = servo02SP[i]; j <= servo02SP[i + 1]; j++) {
servo02.write(j);
delay(speedDelay);
}
}
// Servo 3
if (servo03SP[i] == servo03SP[i + 1]) {
}
if (servo03SP[i] > servo03SP[i + 1]) {
for ( int j = servo03SP[i]; j >= servo03SP[i + 1]; j--) {
servo03.write(j);
delay(speedDelay);
}
}
if (servo03SP[i] < servo03SP[i + 1]) {
for ( int j = servo03SP[i]; j <= servo03SP[i + 1]; j++) {
servo03.write(j);
delay(speedDelay);
}
}
// Servo 4
if (servo04SP[i] == servo04SP[i + 1]) {
}
if (servo04SP[i] > servo04SP[i + 1]) {
for ( int j = servo04SP[i]; j >= servo04SP[i + 1]; j--) {
servo04.write(j);
delay(speedDelay);
}
}
if (servo04SP[i] < servo04SP[i + 1]) {
for ( int j = servo04SP[i]; j <= servo04SP[i + 1]; j++) {
servo04.write(j);
delay(speedDelay);
}
}
// Servo 5
if (servo05SP[i] == servo05SP[i + 1]) {
}
if (servo05SP[i] > servo05SP[i + 1]) {
for ( int j = servo05SP[i]; j >= servo05SP[i + 1]; j--) {
servo05.write(j);
delay(speedDelay);
}
}
if (servo05SP[i] < servo05SP[i + 1]) {
for ( int j = servo05SP[i]; j <= servo05SP[i + 1]; j++) {
servo05.write(j);
delay(speedDelay);
}
}
// Servo 6
if (servo06SP[i] == servo06SP[i + 1]) {
}
if (servo06SP[i] > servo06SP[i + 1]) {
for ( int j = servo06SP[i]; j >= servo06SP[i + 1]; j--) {
servo06.write(j);
delay(speedDelay);
}
}
if (servo06SP[i] < servo06SP[i + 1]) {
for ( int j = servo06SP[i]; j <= servo06SP[i + 1]; j++) {
servo06.write(j);
delay(speedDelay);
}
}
}
}
}
Code language: PHP (php)
Download 6DOF Arm Robot Lk App And Its Function
Pair your mobile device with the HC-05 Bluetooth module and launch the 6DOF Arm Robot app. Establish a connection with the module, and start controlling your robot arm wirelessly. The app’s user-friendly interface allows you to send commands to each servo motor, providing precise control over the arm’s movements.
The Android App download




For programming the automatic robot movement with this app, when we press the “SAVE” button we simply store the current positions of the stepper motors into arrays. Then when we press the “RUN” button, we call the runSteps() custom function which executes or runs through all stored steps using some for and while loops.
Conclusion
In conclusion, the creation of a Programmable 6DOF Robot Arm using Arduino, facilitated by an IO Expansion Shield and integrated with an HC-05 Bluetooth module, provides a versatile and interactive robotic platform. The assembly of the robot arm, guided by an instruction sheet or online details and demonstrated through a YouTube video, ensures a systematic construction process. Powering the system with a 3S LiPo battery through a step-down buck converter and integrating the Bluetooth module enables wireless control up to 15 meters. Careful connections of MG996R Servo motors to the IO Expansion Shield and the precise programming of the Arduino Nano contribute to the robot arm’s functionality. The user-friendly mobile app, coupled with the Bluetooth connection, allows for both real-time control and programming of automated sequences, adding a unique dimension to the robot’s capabilities. Overall, this tutorial provides a comprehensive guide for enthusiasts to build, program, and wirelessly control a programmable 6DOF Robot Arm, offering a hands-on and customizable experience in the realm of robotics.