Lowering Suspension Project(Arduino)
5914 Views, 21 Favorites, 0 Comments
Lowering Suspension Project(Arduino)
www.youtube.com/watch?v=Jg5-kPuDQrg
www.renanwebsites.com.br
This is my first project with arduino, the idea is to fill a bag of air and control its height from the floor, this is a project and can be deployed on larger scale, let's just follow the wiring diagram and transfer code for the Arduino:www.renanwebsites.com.br
components:
1 x engine pressure gauge mitsumi
1 x General purpose transistor (TIP 31C)
1 x air bag (cardiac pressure gauge)
1 x electric air valve
x x wires (jumpers)
4 push buttons
2 Generic diode (1N4407)
4 220ohm resistors
1 Arduino uno
1 breadboard
code:
/* suspencao a ar
criado por : Renan Rider
data: 08/01/2014
*/
int motor = 9;
int valv = 8;
int button_ar = 7;
int button_valv = 6;
int button_ar_all = 5;
int button_valv_low = 4;
void setup(){
Serial.begin(9600);
pinMode(motor, OUTPUT);
pinMode(valv, OUTPUT);
pinMode(button_ar, INPUT);
pinMode(button_valv, INPUT);
pinMode(button_ar_all, INPUT);
pinMode(button_valv_low, INPUT);
}
void loop(){
int estado_ar = digitalRead(button_ar);
int estado_valv = digitalRead(button_valv);
int estado_ar_all = digitalRead(button_ar_all);
int estado_valv_low = digitalRead(button_valv_low);
Serial.println(estado_ar);
Serial.println(estado_valv);
Serial.println(estado_ar_all);
Serial.println(estado_valv_low);
delay(10);
if(estado_ar == HIGH){ // enche o balao de ar por 3 segundos depois para
digitalWrite(valv, HIGH);
digitalWrite(motor, HIGH);
delay(3000);
digitalWrite(motor, LOW);
}
if(estado_valv == HIGH){ // aciona a valvula de ar esvaziando o balao para ajustar a altura correta
digitalWrite(valv, LOW);
delay(1000);
digitalWrite(valv, HIGH);
digitalWrite(motor, LOW);
}
if(estado_valv_low == HIGH){ // esvazia todo o balao abaixando a suspencao
digitalWrite(valv, LOW);
digitalWrite(motor, LOW);
}
if(estado_ar_all == HIGH){ // aciona o motor enchendo o balao ate a altura maxima por 6 segundos depois manten a altura
digitalWrite(valv, HIGH);
digitalWrite(motor, HIGH);
delay(6000);
digitalWrite(motor, LOW);
}
}
video:
http://www.youtube.com/watch?v=Jg5-kPuDQrg