Thore Aalvik, Brian Nguyen and Kevin Robinson


Pages
Description
  •     Our team built a crane that has 2 ranges of motion, one being the pivotal axis and the second being linear motion.  The crane is made of rolled paper and it is extremely strong for its weight. We also recycled some metal supports along the outside stanchions.  We have a base that is wood and put one arduino board,that controls the pivotal axis, on the wood base with Velcro. The other arduino board, that controls the linear motion, is on the top part of the crane and secured with Velcro.  Both the arduino boards control a DC Motor with an H-Bridge that we will explain later.

Problems

  • Some problems we encountered were that we had the wrong code, and it took many different tries to fix it and finally create the correct code.  Another problem we encountered was trying to figure out the light sensitivity.  It was too sensitive at first and then we made it so it wouldn't turn at all, and then we figured it out.
Arduino H-Bridge with DC motor circuit board


We used two arduinos using the same code

Arduino code for H-Bridge and DC motor with potentiometer

int motor1Pin = 4; // H-bridge leg 1
int motor2Pin = 5; // H-bridge leg 2
int enablePin = 9; // H-bridge enable pin
int sp;
int potPin = 2; //Analogue input from Potentiometer
int val = 0; //Value being read from Potentiometer

void setup() {

Serial.begin(9600); //Beggin serial communication



// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
}

void loop() {

val = analogRead(potPin); //Read pot value
Serial.println(val); //print value to debugg

// if the switch is high, motor will turn on one direction:
if (val< 500) {
digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
sp =map(val, 0, 500, 0,150);
analogWrite(enablePin, sp); //Write to speed pin to change speed
}
// if the switch is low, motor will turn in the other direction:
else if(val> 525) {
digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge high
digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low
sp =map(val, 525, 1023, 0,150);
analogWrite(enablePin, sp); //Write to speed pin to change speed
}
else{analogWrite(enablePin, 0); //Write to speed pin to change speed
}
delay(10); //Delay before next loop
}

Media

Arduino crane with H/Bridge and Dc motor 1


Arduino crane with Dc motor and H-Bridge 2



Photos (Click to make bigger)











Subpages (1): Journal
č
MOV00286.AVI
(3451k)
Unknown user,
May 21, 2009, 9:27 AM
č
MOV00291.AVI
(2589k)
Unknown user,
May 21, 2009, 9:28 AM
Comments