Simple Programmable Robotic Arm Using Arduino | Arduino Project

by | Dec 2, 2022 | Arduino, Coding

Home » Coding » Simple Programmable Robotic Arm Using Arduino | Arduino Project

Introduction

Have you ever made a Robotic Arm? In today’s coding project, we will create a Simple Programmable Robotic Arm Using Arduino by controlling Servo using a Potentiometer. The arm can be used to pick up and place objects.

Servos are the actuators that rotate and push the parts of the machine with precision.

 

Supplies

In order to make a Simple Programmable Robotic Arm using Arduino, we will require the following components.

Components

You can purchase the components from any electronics store, or you can also make them online through websites like Tinkercad.

Circuit Diagram

Simple Programmable Robotic Arm Using Arduino | Arduino Project

Steps To Make A Simple Programmable Robotic Arm Using Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

Micro Servo:

Step 2: Connect the Signal terminals of all four Servos to pin numbers 4, 5, 6 & 7 of the Arduino, respectively.

Step 3: Connect the Power terminal of each to the 5V pin of Arduino using connecting wires and a breadboard.

Step 4: Connect the Ground terminal of each to GND in Arduino at the analog side using Black colored wires and BreadBoard.

Potentiometers:

Step 5: Connect all four Potentiometers to the BreadBoard – Small.

Step 6: Connect the Wipro terminal of each to analog pin numbers A0, A1, A2, & A3 of the Arduino, respectively.

Step 7: Connect terminal 1 of it to the GND pin of the Arduino using black colored wires and BreadBoard.

Step 8: Connect terminal 2 of each to the 5V pin of Arduino using connecting wires and BreadBoard.

Source Code

#include <Servo.h>
Servo s1;
Servo s2;
Servo s3;
Servo s4;
int p1 = 0;
int p2 = 1;
int p3 = 2;
int p4 = 3;
int val1;
int val2;
int val3;
int val4;
void setup()
{
s1.attach(4);
s2.attach(5);
s3.attach(6);
s4.attach(7);
}
void loop()
{
val1 = analogRead(p1);
val1 = map(val1, 0, 1023, 0, 180);
s1.write(val1);
val2 = analogRead(p2);
val2 = map(val2, 0, 1023, 0, 180);
s2.write(val2);
val3 = analogRead(p3);
val3 = map(val3, 0, 1023, 0, 180);
s3.write(val3);
val4 = analogRead(p4);
val4 = map(val4, 0, 1023, 0, 180);
s4.write(val4);


delay(20);
}

Explanation of the Code

1. In the beginning, we included the header file Servo to control the Servo.

2. After that, we declared four Servo objects to control the Servo.

3. After that, we initialized four Potentiometer variables which are used to denote the analog pin number to which it is connected.

4. After that, we declared four variables to read the values from the analog pin.

5. Now, we have used two main functions, namely set up and loop.

6. In the setup function, we are attaching the servo object to the pin number to which we have connected the Servo.

7. In the loop function, we are reading the value of the potentiometer and storing it in “val” variables.

8. We are scaling the value of the potentiometer from 0 to 1023 and mapping it with Servo (0 to 180). So, as set the Servo position according to the potentiometer.

9. We are using a delay function, which takes time in milliseconds, to get the Servo there.

Output

On changing the potentiometer direction, the Servo will set its position accordingly.

Simple Programmable Robotic Arm Using Arduino

This can be used as a part of a small robotic project in which you can make the robotic arm pick up and place the objects using the potentiometer.

 

More Arduino Projects>>>>

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *