Вы находитесь на странице: 1из 4

1)

Prelab

a) We used a potentiometer control LEDs. We had to learn to control the map function in reverse relationships. We used one mapping method to have an inverse relationship with the two leds. So as one LED would light up, the other was turn down. This was a simpler introduction to potentiometers and mapping it

2)

to a servo because mapping to a light is a easier task to handle before we started controlling four servos with four potentiometers. Challenge

a)

To be able to design a crane arm using the arduino, servos and potentiometer.

3)

Approach

a)

We first established the code for the project rather than making the crane

4)

physically. We then designed a base plate to support the structure and then finally making the crane itself and then attaching it to the base plate. Programming

#include<Servo.h>

//creates servos

ServoservoZ; ServoservoY1; ServoservoY2; ServoservoGrip;

//creates analog for potentiometer

intpotentZ = 0; intpotentY1 = 1; intpotentY2 = 2; intpotentGrip = 3;

//values for mapping

intvalZ;

intvalY1;

intvalY2;

intvalGrip;

voidsetup() {

Serial.begin(9600);

//attaches servos to digitalPort

servoZ.attach(6);

servoY1.attach(9);

servoY2.attach(10);

servoGrip.attach(11);

}

voidloop() { //As you rotate the potentiometer, each section of the code below is responsible for rotation the individual motor on the crane arm.

//Map Z valZ = analogRead(potentZ); //makes the bottom rotation portion of the crane equal to the value of the potentiometer that is read in the analogIn port. valZ = map(valZ,0,1023,0,179);//changes potentiometer value from 0-1023 to 0-179 which will allow the motor to read the values properly. servoZ.write(valZ); //rotates the motor

//Map Y1 valY1 = analogRead(potentY1); valY1 = map(valY1,0,1023,0,179);

servoY1.write(valY1);

//Map Y2 valY2 = analogRead(potentY2); valY2 = map(valY2,0,1023,0,179);

servoY2.write(valY2);

//Map Grip valGrip = analogRead(potentGrip); valGrip = map(valGrip,0,1023,0,179); servoGrip.write(valGrip);

delay(15);

}

5)

Building

a)

b)

c)

The overall building process of the arm was not too challenging. There was a lot of hot glue involved as well as popsicle sticks. We used the most amount of popsicle stick on the base, 14 in total. We did this to ensure a secure and sturdy base that would be able to withstand the weight of the arm and its distribution in various different positions. The rest of the joints were connected with about half a popsicle stick on each side of the servo, and then another popsicle stick firmly glued to the servo horns.

then another popsicle stick firmly glued to the servo horns. One issue we encountered during the
then another popsicle stick firmly glued to the servo horns. One issue we encountered during the
then another popsicle stick firmly glued to the servo horns. One issue we encountered during the
then another popsicle stick firmly glued to the servo horns. One issue we encountered during the

One issue we encountered during the build process was that we didn’t pass the provided screw through the popsicle stick and the servo horn. This screw is meant to secure the horn to the servo, so in our case the horn is permanently glued to the popsicle stick and can be removed from the servo. This provides some modular properties to the design, but reduces the structural integrity at each joint. We had an issue with the amount of power received by the arduino which caused the motors to be jittery and not refined. We also had problems with the potentiometer not plugging in deep enough and the values would be rapidly changing. The physical wire management was not challenging.

6)

How those were resolved

a)

We had to plug an external battery to supply enough power towards the arduino.

7)

We used duct tape to push the potentiometer deep into the circuit board to keep it stationary. Summary of synthesizing all the parts of this project together (building/programming/designing)

a)

This design particularly made us physically design something and create software for it as well. We have had previous experiences creating code and boards with 1 and 2 servo-potentiometer combos, but here, we coordinated 4 total potentiometers and 4 total servos. This allowed us to essentially create something with a purpose, a crane arm and claw that can hold things and move them. Having this amount of servos and potentiometers gave is the freedom to create something like this, whereas something like 1 or 2 servo-potentiometers

8)

does not provide a lot of flexibility for creation. Most of the previous projects with these components were simply tests and learning opportunities to gain experience with potentiometers and the like. Using map code, we can finely control the servo rotation with each potentiometer. Reflection of the project

a) I enjoyed this project but I think the programming was still very easy. It would have been more challenging to try to create some autonomous and have it do a challenge or something fun. All we did was create a mechanism but never actually tested it with any object or challenge.