Armduino - a Controllable Robotic Arm System Using Micro Servos, Joystick, & RGB LED W/ Arduino Uno

by RJN in Circuits > Arduino

682 Views, 4 Favorites, 0 Comments

Armduino - a Controllable Robotic Arm System Using Micro Servos, Joystick, & RGB LED W/ Arduino Uno

448455886_1504003816887683_8777405102652292190_n.png
81027f32-5706-4037-91e1-6aef4467499b.png
83426b0d-6f73-450b-a071-cd343134a8d9.png

Hey everyone! Ever wondered what it would be like to build your own robotic arm? Well, that's exactly what I've been up to lately. I'm a 16-year-old tech enthusiast who's always been fascinated by robots and how they work. With a bit of tinkering and a lot of excitement, I've created something I'm proud to introduce: Armduino – a simple yet sound robotic arm, controlled using micro servos, a joystick, and an RGB LED, all powered by an Arduino Uno.

This project isn't just about wires and circuits for me; more so applying a new technical skillset I am trying to build in a challenging manner. Thus, whether you're new to engineering or have tinkered in the past, the Armduino project offers some pretty practical hands-on experience in building and programming your a robotic application of circuits, and electronics components.

Thus, from precise movements controlled by the joystick to the mechanical feedback of the Servos, join me in this simple walkthrough on how to develop your own Armduino.

(Attached Image is an Image of the Schematic Design From TinkerCade)

Supplies

d2e8afec-6bdf-4deb-8c6e-4b4a1f5243c1.png
48b63de0-2baa-4358-8a35-9c4740a49600.png

Construction & Assembly

20d52a38-eeda-403c-84b5-66268b4790a1.png
448172275_501431688888253_8497250221624338841_n.png
b74fd8a0-c80c-42b8-8f51-9ef568a0dcd1.png
744c0c5e-f99c-4663-a07f-6ce664276521.png
8f8e1bfd-8cef-461e-a3c0-8bebadb6f405.png
448628530_1184319539372928_1423393738854738006_n.png
448363055_1802122006949400_6875040322194940993_n.png
448123459_3763975700541736_8405448726750089344_n.png

To begin constructing the robotic arm, start by preparing the base using the "Foamular" Foam Core Board as a stable platform. Securely attach the base servo onto the Foam Core Board using 1/8" nails, ensuring it is positioned securely for stability. Next, assemble the main chassis of the arm using approximately 14-18 popsicle sticks. Use a hot glue gun to firmly glue the popsicle sticks together, forming a robust frame that will support the arm's structure. Make 2 popsicle stick glued back to back on each other, and make 4 of these in total. Bridge and connect pairs of these with snapped popsicle sticks in between to produce a sturdy "H" shape, where the middle stabilizer is placed lower (as this will be important later). Use a screwdriver to prep connection holes on the lower end of both of these. You should have 2 H shapes.

Mount the servo motors onto the popsicle stick chassis using double-sided foam mounting tape. This tape provides a strong adhesive bond and helps dampen vibrations. Ensure each servo is firmly attached to the chassis to withstand movement during operation. Additionally, reinforce the servos with hot glue around the edges where they meet the popsicle sticks for added durability, and use a servo bracket to be helped in place and stable. For the base servo motor however, figure out where you would like to place it on the board, and use nails to nail in the platform bracket in place into the foam core, in order to have a sturdy, and less prone to bend, setup for the first and key servo. The 2nd servo should attach right onto the base, accommodating for the H structures as the arm, likewise the third servo and 2nd arm will be fixated at the top of the first H using hot glue, a bracket, and mounting tape.

Install 3/8" screw hooks at the joints where segments of the arm will connect. These screw hooks serve as hinge points, allowing the arm segments to move smoothly. Use 3/8" screws to securely fasten the screw hooks together at the joints, ensuring they are tightened enough to prevent any looseness or wobbling. Ensure that these screws do not go too far into the joint of the motor, otherwise it will impact the gear turning ability within the Servo, and potentially damage the motor.

Once all segments are connected and the servos are mounted, conduct initial testing in terms of mechanics. Verify the range of motion and functionality of each servo motor individually to ensure they operate smoothly without any binding or interference, and ensure that the max range positioning for each motor is sensible for an arms degree of freedoms. This arm has 3 degrees of freedom, and no claw as it is proof of concept, however you may add more if you will. Make necessary adjustments to servo angles and arm movements as needed to achieve desired functionality, and use the attached images as guidance and reference.

Note, if you are having issues with the balance and stability of the arm within its max reach with all 3 degrees of freedom extended fully, use rubber bands to serve as a tension-based counter force against a forward lean, and fixate it towards the opposite end of your motors initial placement to generate tension.

Wiring

448119430_1212339989925306_6291364309550872460_n.png
3c288e23-5f90-4c22-a89c-5da2134fc7f0.png
3b8ca43c-0380-4417-ac31-29681419d154.png
f6b41bb8-257d-4b37-85eb-71d79040638a.png
448138012_339563859012557_3244395935547807708_n.png
57aaf8f1-d2cf-4642-aeb7-2f1e6baf9402.png
cc7170ca-a862-426e-a9f3-4f9e76ea9166.png
26f912bb-6ad5-4925-8d8a-fabf145c25c9.png
41d034fa-3b36-4227-b7ea-3f6253cbebef.png
9c2abae8-17cb-4ffa-9e8b-55c0b43cdd98.png
448772336_1004673001382777_253492353345036079_n.png
1de7d4a2-7a51-4336-8a9d-3fbf937734a9.png
49ad1090-d867-40a5-a676-ec0703600aa0.png
ef91df37-314d-49ed-98f7-b94e9fa5f608.png

Close to the fixation of the base of the arm, or in place where there will be no interference, apply your breadboard by using the adhesive sticker on the back, and prepare for wiring. Note that a lot of wires will be exposed as the Servos need movable and unrigid wires to enable their access to their respective degree of freedoms.


Servo Motors

To connect the servo motors, start with the Base Servo by attaching its signal wire to digital pin 9 on the Arduino Uno. This pin will transmit control signals to the servo, allowing precise positioning of the arm's base. The servo's ground (GND) wire connects to any of the Arduino's GND pins, completing the circuit and providing a return path for current. The power wire of the base servo connects to the 5V pin on the Arduino, ensuring the servo receives sufficient power to operate smoothly without voltage drops.

Next, for the Arm1 Servo, connect its signal wire to digital pin 10 on the Arduino. This pin serves as the control interface for the arm's first joint, enabling movements along its horizontal axis. Similar to the base servo, connect the servo's ground wire to a GND pin on the Arduino to maintain a common ground reference. The power wire of the arm1 servo also connects to the Arduino's 5V pin to ensure consistent power supply during operation.

For the Arm2 Servo, connect its signal wire to digital pin 11 on the Arduino. This pin controls the movements of the arm's second joint, facilitating adjustments along its vertical axis. As with the other servos, connect the ground wire of the arm2 servo to a GND pin on the Arduino to complete the electrical circuit. The power wire of the arm2 servo connects to the Arduino's 5V pin to provide stable voltage for optimal servo performance.

Digital pins 9-11 on the Arduino Uno are capable of PWM (Pulse Width Modulation) ensuring that different signals of voltage can be outputted and controlled to produce a moving mechanical motion with the motor's gearboxes. Double check the wiring as this is important.

Joystick and Potentiometer

Moving on to the Sunfounder Joystick, connect its X-axis (horizontal) pin to analog pin A0 and its Y-axis (vertical) pin to analog pin A1 on the Arduino. These connections enable the Arduino to read the joystick's analog signals, translating physical joystick movements into digital values for controlling the arm's position. The VCC (power) pin of the joystick connects to the Arduino's 5V pin to supply operating voltage, while the GND pin connects to a GND pin on the Arduino to complete the circuit.

For the Potentiometer, connect one end to the 5V pin on the Arduino to establish the maximum voltage reference. The other end of the potentiometer connects to a GND pin on the Arduino, setting the minimum voltage reference. The middle pin (wiper) of the potentiometer connects to analog pin A2 on the Arduino, allowing the Arduino to read the voltage level set by adjusting the potentiometer's knob. This setup enables precise control over specific functions of the robotic arm, such as speed or sensitivity adjustments.

Control - touching base on the way the operation and control of this arm is supposed to work - the X axis of the joystick controls thee 0 to 180 degree range of the BASE servo motor, whilst the Y axis controls arm 1, which is lower and fixated to the base motor. The potentiometer controls the range of motion for arm2, and is separate from the joystick. In this build I did not utilize the z-axis of the joystick which was its switch/pushbutton - however feel free to integrate a claw mechanism that opens and closes by the push of the z-axis button. Also throughout this build, it is highly recommended that you use some of the mounting tape from earlier, or some electrical tape, to make neater wiring along the sides of the foam core to ensure there's no "spaghetti" jumble of wires. Tracking the wiring yourself will be important for later as you need to clearly identify your connections for the programming component.

RGB LED

Finally, for the Common Anode RGB LED, begin by connecting its common anode (longest pin) to the 5V pin on the Arduino. This connection ensures that the LED receives sufficient voltage to emit light across its color channels. Each cathode (red, green, blue) of the RGB LED connects to separate digital pins on the Arduino (red to pin 4, green to pin 3, blue to pin 8) through current-limiting resistors (e.g., 330 ohms). These resistors prevent excess current flow through the LED, protecting it from damage and ensuring consistent brightness levels across different colors.

For fun, I additionally added a simple, non programmable green Led connected through a 330 ohm resistor (to keep from fusing) and connected to the 5V power rails and GND common rail. This added a simple yet nice analog touch to the system.

Arduino Connections Summary

  • Vcc (5V) - power rail
  • GND - common rail
  • A0 - x-axis of Joystick
  • A1 - y-axis of Joystick
  • A2 - potentiometer for Arm 2
  • pin 2 - green pin of RGB
  • pin 4 - red pin of RGB
  • pin 7 - joystick switch/pushbutton
  • pin 8 - blue pin of RGB
  • pin 9 - base servo signal
  • pin 10 - arm1 servo signal
  • pin 11- arm2 servo signal


Final Checks

Verify each connection to ensure they are securely attached and properly insulated to prevent short circuits or loose connections as with this meticulous wiring setup, there s much room for error that we want to eliminate, and ensure that only programming is now part of our worries. The wiring ensures that all components of your robotic arm system are correctly interfaced with the Arduino Uno, and I used electrical tape for making bunches or clusters of wires more neat together, alng with double sided foam mounting tape by the servo motors to ensure a clean straight path downward for the signal, ground, and power wires, whilst maintaining tightness.

Programming Control & Operation

448116842_3644451772482036_4068287800606478968_n.png
075d2ca1-4ff8-441f-826a-c17fd8aada21.png


Variables and Setup

We begin the code by including the Servo library, which provides convenient functions for controlling servo motors connected to Arduino. Three servo objects are declared: base, arm1, and arm2. These objects will be used to control the position of the respective servos connected to the Arduino. Each servo is associated with its signal pin: base_pin, arm1_pin, and arm2_pin. These variables define where each servo's control signal is connected on the Arduino board, typically to digital output pins.

Analog input pins are allocated for interfacing with external analog sensors. Specifically, base_joy and arm1_joy are designated for reading joystick inputs, which are often used to provide manual control over servo movements in two dimensions (x and y axes). The arm2_pot pin is assigned to read from a potentiometer, which provides a variable resistance that translates to a specific angle for servo arm2. These analog inputs allow for intuitive and proportional control over the robotic arm system.

For visual feedback and indication, pins green_pin, red_pin, and blue_pin are configured as outputs - and these pins are intended to drive a common anode RGB LED, where each color (green, red, blue) can be individually controlled to visually represent different states or actions of the robotic arm. This setup enables the user to easily interpret the system's status or mode through color-coded signals.

Initial positions of the servos (init_x, init_y, init_z_pot) are set to 90 degrees. This establishes the starting orientation of the servos when the Arduino board is powered on or reset. These initial angles serve as a reference point from which the servos can move in response to input from the joystick and potentiometer.


Servo Initialization and Serial Setup

In the setup() function, pins for joystick and potentiometer are set as inputs using pinMode(). Similarly, RGB LED pins are set as outputs. Each servo is attached to its designated pin using base.attach(), arm1.attach(), and arm2.attach(), ensuring they are ready to receive position commands. Initial servo positions are set using base.write(), arm1.write(), and arm2.write(). Serial communication is initiated at 9600 baud rate (Serial.begin(9600)) for debugging purposes.


Main Loop Operation

In the loop() function of the Arduino code, the main control logic for the robotic arm system is implemented. Here’s a deeper analysis of how the map() function is utilized and its role in controlling servo movements with joystick and potentiometer inputs:


The function begins by reading analog values from the joystick and potentiometer using analogRead(). These analog inputs (base_joy, arm1_joy, arm2_pot) capture voltage levels from corresponding sensors. The Arduino board converts these voltage levels into digital values ranging from 0 to 1023, representing the full range of analog-to-digital conversion (ADC) resolution.


The map() function is employed to scale these raw analog readings into a range suitable for controlling servo motors. For instance, base_axis, arm1_axis, and arm2_axis store the analog readings obtained from the joystick and potentiometer. The map() function then converts these values from the 0-1023 range to a narrower range of 0-180 degrees, which is appropriate for positioning servo motors.

Understanding the map() Function

The map() function syntax is as follows:

mapped_value = map(input_value, input_min, input_max, output_min, output_max);

where:

  • input_value - the raw input value obtained from analogRead().
  • input_min, input_max - the minimum and maximum possible values of the input range (0 and 1023 in this case).
  • output_min, output_max - the desired minimum and maximum values for the output range (0 and 180 degrees for servo control).

For example, suppose base_axis (the degree range for the base servo motor) reads an analog value of 512 from the joystick. Using map(base_axis, 0, 1023, 0, 180), this value is converted to: base_angle=map(512,0,1023,0,180). Here, 512 corresponds to the midpoint (50%) of the joystick's range, resulting in a servo angle of 90 degrees - and this calculation allows precise control over the servo's position based on the joystick's movement.

Similarly, the potentiometer (arm2_pot) provides a variable resistance that translates to a range of analog values. By mapping these values, the robotic arm's third servo (arm2) can be controlled smoothly and precisely. For example, rotating the potentiometer adjusts the analog input, and the mapped value dictates the servo's position within the defined range (0-180 degrees). By using map() and the analog readings from the analog pins of the joysticks 0-1023 range on the x and y-axis, we can make manual dials that change the positioning of the motors, based off voltage output, directly controlled by the various potentiometers by decreasing resistance


RGB Integration


In the Arduino code controlling the robotic arm, servo motors are manipulated based on user inputs from a joystick and a potentiometer, yet for visual purposes I have also synced the servo motor movement with RGB color states. The loop() function continuously reads analog signals from the joystick (base_joy, arm1_joy) and potentiometer (arm2_pot), using analogRead() to capture the position inputs. This process ensures that the servos move proportionally according to the position indicated by the joystick and potentiometer, and provide visual feedback of the servo movements, a common anode RGB LED is employed. The RGB LED has three pins corresponding to its colors: red_pin, green_pin, and blue_pin. The functions red(), blue(), pink(), and rgb_off() control the LED based on the servo movements detected:

  • red() - turns on the RGB LED to display red color
  • blue() - turns on the RGB LED to display blue color
  • pink() - turns on the RGB LED to display pink color (a mixture of red and blue due to common anode configuration & green was malfunctioning)
  • rgb_off() - turns off all colors of the RGB LED


Also, the conditional statements in the loop() function evaluate whether each servo has moved significantly from its initial position (init_y, init_x, init_z_pot). This is determined by comparing the current servo angle (base_angle, arm1_angle, arm2_angle) with its respective initial angle using the abs() function. And If the difference between the current angle and the initial angle is greater than 1 degree, it indicates movement, thus basically, in response:

  • If base_angle deviates, red() is called to turn on the red LED.
  • If arm1_angle deviates, blue() is called to turn on the blue LED.
  • If arm2_angle deviates, pink() is called to turn on the pink LED.
  • If no servo is moving (all angles are within 1 degree of their initial values), rgb_off() is called to turn off the RGB LED.

I have attached the C++ .ino code file for you to look further in depth, to reference it back with my logic explanation on programming this arm - please take a further look to understand the code further.

Anyhow, throughout this instructable, we've combined robotics with practical programming skills to create Armduino, a three-degree-of-freedom robotic arm - and by integrating servo control, joystick and potentiometer inputs, and RGB LED feedback, we've explored the essentials of automation and electronics. This project serves as a practical introduction to robotics, emphasizing wiring, sensor integration, and Arduino programming for enthusiasts looking to delve into automation projects. 

Thank you for reading and I encourage for you to add a personal touch or addition to this project if you attempt to replicate it.

Happy Tinkering!

Downloads