Autonomous Pick and Place Robotic Arm

This is an autonomous pick and place robotic arm based on ultrasonic sensors.

Name

Clarissa L

Interests

Computer Science

School

Lynbrook High School

Grade

Rising Junior

Reflection
There is so much more to engineering than software. I have had a wonderful three weeks exploring robotics, and it has been a great learning experience. Bluestamp has inspired me to expand on my Arduino knowledge and possibly try Raspberry Pi while working on more projects in the future.
Github
Look here for code and circuit diagrams.
Bill of Materials
1 ArmUno 2.0 Robotic Arm Kit
1 Arduino Uno
1 4 x AAA Battery Mount
4 SG90 Servos
1 HC-SR04 Ultrasonic Distance Sensor
1 Laser Diode
13 Male-to-Male Jumper Wires
4 Male-to-Female Jumper Wires

Demo Night Presentation

Milestone Three

Here’s a short video about my third milestone! I have finally added the distance sensor, and the arm is fully operational.
Additional Project Components
1 HC-SR04 Ultrasonic Distance Sensor
1 Laser Diode
2 Additional Male-to-Male Jumper Wires
4 Additional Male-to-Female Jumper Wires
Understanding Additional Project Components
HC-SR04 Ultrasonic Distance Sensor
This sensor uses ultrasonic signals to measure distance. To get a distance, first, send a pulse of HIGH for 10 microseconds over the TRIG pin. This will send eight 40 kHz ultrasonic signals through the transmitter. The receiver will start a clock and wait for the sound waves to be reflected. If there is an object within 2 to 400 centimeters of the sensor, the object will reflect the sound waves to the receiver mounted on the sensor. The user can then take the duration it took for the sound waves to be returned to the receiver and calculate the distance of the object from the sensor using the distance formula and the speed of sound.
You can use the NewPing library to use the HC-SR04. The NewPing library makes controlling one or more ultrasonic sensors easy, and it is also better than writing the code from scratch using pulseIn() because pulseIn() tends to be inaccurate for some ultrasonic sensors.
When running the sensor, you may notice that the distance output is inaccurate. This may be due to the speed of sound. Ultrasonic signals travel at the speed of sound, but the speed of sound is not immutable. It can be affected by medium, temperature, and humidity. You can attach a temperature and humidity sensor, such as the TCH-11 or TCH-22, to factor in the current temperature and humidity into your distance calculations. Unfortunately, this also has its downfalls. The reason I did not include a TCH-22 into this project is due to the stabilization time. It takes roughly five seconds for the sensor to stabilize, but factoring the robotic arm, the lag this delay would cause is not worth the slightly improved accuracy.
Updated Circuit Diagram
This is the updated circuit diagram. All potentiometers are removed. One HC-SR04 and one laser diode has been added to the circuit.
See Milestone One Circuit Diagram section for common mistakes made when wiring the circuit.
Updated Code
The above code uses input from a distance sensor to autonomously grab an item and move it with the robotic arm.

Milestone Two

Here’s a short video about my second milestone! So far, I have added the last servo and corresponding potentiometer.
You may notice that in the video that the arm sometimes moves sporadically even when I am not turning the potentiometers. This is not a coding or wiring issue. Rather, the potentiometers are cheap and can output unstable values if the wires connecting them to the Arduino are disturbed even slightly. Fortunately, potentiometers are only a temporary controller, so this will not be a major issue in the long run.
Additional Project Components
1 Additional SG90 Servo
1 Additional Potentiometer
3 Additional Male-to-Male Jumper Wires
3 Additional Male-to-Female Jumper Wires
Updated Circuit Diagram
This is the updated circuit diagram. One servo and one potentiometer has been added to the circuit. Four potentiometers are connected to four servos through the Arduino, and each potentiometer controls one servo.
See Milestone One Circuit Diagram section for common mistakes made when wiring the circuit.
Updated Code
The above code takes input values from four potentiometers and outputs those values to four servos.
Note that servoC’s input range has been changed from 0 to 180 degrees to 90 to 180 degrees to prevent servo coordination issues between itself and servoA, which both control the arm.

Milestone One

Here’s a short video about my first milestone! So far, I have completed the arm construction and hooked up a temporary controller using potentiometers.
Project Components
1 ArmUno 2.0 Robotic Arm Kit
1 Arduino Uno
1 4 x AA Battery Mount
3 SG90 Servos
3 Potentiometers
2 Solderless Breadboards
12 Male-to-Male Jumper Wires
9 Male-to-Female Jumper Wires
Discarded
Understanding Project Components
4 x AA Battery Mount
SG90s usually run on a voltage input from 4 to 6 volts. Four AA batteries or AAA batteries will provide you with 6 volts in addition to an adequate current to run three servos.
Avoid using 9-volt batteries if possible since the high voltage is likely to short the servos. These batteries also tend to produce less current than four AA or AAA batteries, so the servos may not even be powered. You can check the voltage input into your servos with a multimeter. If you do not have AA or AAA batteries on hand, adding two 9-volt batteries in parallel to your circuit should provide enough current for the servos to run.
Servos and Pulse Width Modulation
Servos internally use DC motors along with a potentiometer to rotate to a certain angle with greater accuracy and precision. Excluding continuous rotation servos, servo rotation is usually limited between 0 to 180 degrees. Servos use a three-wire system: one for ground, one for VCC, and one for control.
The control wire takes input in the form of pulse width modulation (PWM). The Arduino Uno has six PWM pins, which are digital pins capable of pulse width modulation. You can connect the control wire from the servo to any of these six. A servo can receive angle values from the PWM pin and rotate to the given angle.
PWM is a way to digitally encode an analog signal. A digital signal has a finite number of values while an analog signal can have infinite values. In this case, a digital pin can output one of two values: HIGH or LOW. Let’s say the HIGH value is 5 volts and the LOW value if 0 volts. Using a duty cycle, the percentage of the time the digital signal is HIGH, output values that are not 0 volts or 5 volts can be produced from a PWM pin. For example, with a duty cycle of 50%, the output will be 2.5 volts since the pin is only HIGH half the time.
Arm Assembly Note Concerning Servos: The ArmUno assembly instructions do not mention this, but it is extremely helpful to calibrate your servos before use. Calibrating servos is essentially setting them to the same angle, so when you attach arms to it, it is easier to determine their full range of motion.
Potentiometers
A potentiometer is a variable resistor. Like a servo, it uses the three-wire system: one for ground, one for VCC, and one for control. When connected to an Arduino Uno, it can output an analog value. Since an Arduino Uno has a 10-bit analog to digital converter, a potentiometer connected to an Arduino Uno can return a value from 0 to 1023. This is because a bit has two states: on or off. With 10 bits, 2 to the 10 different integer values can be stored. 2 to the 10 is 1024, but since 0 is included, the range of integer values will be from 0 to 2 to the 10 – 1 or 0 to 1023. To output values, a potentiometer requires power. These potentiometers require between 3.3 and 5 volts though 5 volts tends to be more stable; you can use either of Arduino’s 5 volt or 3.3 volt pins or an external power source to power your potentiometers.
Circuit Diagram
This is the circuit diagram. Three potentiometers are connected to three servos through the Arduino, and each potentiometer controls one servo.
Common Mistakes
Servos require 4 to 6 volts; you should use an external power source since the Arduino VCC pins do not produce enough current to drive motors. Your servos may not run if they do not receive enough current. Use a multimeter to check the voltage input for servos that do not seem to be receiving any power.
Servo control wires must be connected to digital pins capable of pulse width modulation.
Potentiometer control wires must be connected to analog pins.
A common ground must be set between the Arduino board and the battery pack. Your circuit will not be stable if you fail to do this, which may cause unpredictable potentiometer outputs.
Code
The above code takes input values from three potentiometers and outputs those values to three servos.

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering