You are on page 1of 7

1) Prelab

a) Servo and potentiometer


i) One of the labs we did involved using a potentiometer to control a servo.
We did this to a greater extent on our robotic arm, in which we used four
potentiometers and four servos to control an arm. This, along with our
project of using a potentiometer to control the amount of LEDS that were
lit up were used to prepare us for our robotic arm project. The LED project
consisted of three LEDS, and as as you rotated the potentiometer, the
lights would illuminate depending on the feedback received by the
potentiometer

2) Challenge

- Our challenge was to build a robotic arm that was able to function as a crane. The arm
needed to have three servo motors that moved in the the x, y and z planes as well as a
motor to function as a clamp to pick up objects. The motors were controlled by an
arduino which we programmed in order to move the servos based on the rotation of four
potentiometers which measure voltage and send a signal back to the arduino and finally
the motors.
- Note: Servos are small devices that are electronically controlled by code. The servo
rotates from 0-179 degrees. Servos have a small shaft that can attach to a servo horn,
which just extends the motion of the shaft. The servo library needs to be included to run
the commands from the Arduino.
- The code “Servo Servo 1;” needs to be included to initialize a servo.
- The code “Servo1.attach(pin);” needs to be included to set a servo to a specific pin.
- The code ‘Servo.write()” will send a value, or write a value, to the servo. The shaft will
be rotated accordingly. This sets the angle of the shaft.
- The mapping function is used to control the rotation of the servo based on feedback
received from the potentiometer. The potentiometer has 1023 possible rotation levels
while the servo only has 179. As a result, you must map each of the servo rotation levels
to a larger amount of potentiometer levels of rotation in order to explain to both
components what they must send and receive when given a certain amount of input
2) Approach
- My partner and I decided to split up the tasks, one was going to build the physical crane
out of popsicle sticks, hot glue, and tape, while the other designed the hardware for the
arduino and began to write the code. On the first day we were able to complete the
hardware and establish a basis for the code and the arm. Unfortunately, Evan had to
leave school on the second day of work so he was unable to help. I was able to work

This is the section of code used to declare variables, servos, and potentiometers. We needed to
include Servo.h because this allows us to bring in commands from the arduino library.
In this block of code, we initialized each of the variables and told the computer to read the inputs
from each of the potentiometers.

In the final block of code, the void loop is essential because it allows the crane to continuously
function by constantly reading and mapping the values. Each of the four main sub-blocks tells
the computer to read each of the potentiometers, map their values, and then tells the servos to
rotate in regard to the mapped values.

extremely hard and manage to complete and compile the code and finish the design of the arm.
4.) Building
- There were two components that had to be built for this project. The first was the
arduino. It had to have four potentiometers which sent signals back to the arduino in the
form of an analog signal in order to tell the servo motors how far to rotate. The arduino
board was also used to power the motors, which received information from the board via
the digital ports and pulse width modulation. The second part of the build was the arm
itself. We first ensured that we had a sturdy base made of popsicle sticks which were
connected to each other using hot glue. After the base, the arm was built mostly from
popsicle sticks that had been broken in half in order to keep the arm short and ensure it
doesn’t tip over during its activities.
5.) Issues during building/programming
- Initially, our code didn’t function properly due to an incorrect wiring layout. We had
accidentally plugged a powered wire into the wrong power rail. This can result in a
shorting of the board, so it was imperative that we resolved this issue quickly. Another
issue we had was the claw not being stable enough on the end of the arm. Our code
was relatively flawless other than the occasional lack of a semicolon and a few other
minor errors that were resolved fairly quickly. Other than these, we had no other
problems.

6.) How we resolved these issued


It took us a little while to find the wiring issue, but once it was located it was promptly fixed.
Luckily, our board did not short and we could keep working. All we did to stabilize the claw was
add more hot glue to keep it in place.

7) Summary of synthesizing all the parts of this project together (building, programming,
designing)
The arm was controlled via the user turning the potentiometer. From there, an analog signal
was sent to the arduino board and via PWM the signals were read and transmitted to the servo
motors in order to control the arm. In order to transmit the potentiometer signals, the code had
to incorporate a mapping element. The map function uses five values, the value to be mapped,
the low range and the high vales of the input data and the low and high ranges for that data to
be remapped to. Again, from here the signals telling the servos how much to rotate were sent to
the arduino board and ended up at the servos.

8.) Reflection
This project showed us how basic skills when used together can create something entirely new.
We feel as though this project was a good way for us to synthesize our skills and apply the
things we’ve learned into one project. From creating the arduino and code to building the arm,
we had to utilize skills that we’d been developing all semester. The challenge was enjoyable
and the coding was reasonable, allowing us to have a successful product within a few days. I
would’ve liked the actually test our designs or maybe have some sort of competition, but since
all of our products were essentially the exact same thing I understand how that wouldn’t have
made much sense. My partner and I built the crane before we wrote the code. It was a random
decision, but It ended up making the coding process go by more quickly because we could
actually test our code. We also worked on the code and the construction equally as much. The
construction process was relatively simple, as the only challenge was making sure that the
crane was stable enough to function. The coding was more difficult, but it was still fairly easy.
We basically only had to duplicate previous code and synthesize it into one unit. Overall, it was
a good experience and laid the groundwork for future projects.

You might also like