Sam SutherlandEthan Owens
Published

Air Ride Suspension Control

Using a particle, we connected it to an Air Ride suspension in a VW Rabbit and are able to control it through the phone.

IntermediateShowcase (no instructions)2 hours997
Air Ride Suspension Control

Things used in this project

Story

Read more

Schematics

Circuit Diagram

Relay Diagram

VU4 Switch Box Wire Harness Diagram

Code

Coding

ActionScript
int FrontUp =D6;
int RearUp =D5;
int FrontDown =D2;
int RearDown =D1;

void setup() {
   pinMode(FrontUp,OUTPUT);
   pinMode(FrontDown,OUTPUT);
   pinMode(RearUp,OUTPUT);
   pinMode(RearDown,OUTPUT);
   
    
    Particle.function("Lift", lift);
    Particle.function("Lower", Lower);
}

void loop() {

}
int lift(String command) 
{
    
    if (command=="1") 
    {
    digitalWrite(FrontUp,HIGH);
    delay(500);
    digitalWrite(FrontUp,LOW);
    digitalWrite(RearUp,HIGH);
    delay(650);
    digitalWrite(RearUp,LOW);
    return 1;
    }
    else if(command=="2") 
    {
    digitalWrite(FrontUp,HIGH);
    delay(1100);
    digitalWrite(FrontUp,LOW);
    digitalWrite(RearUp,HIGH);
    delay(1350);
    digitalWrite(RearUp,LOW);
    return 2;
    }
    else if(command=="3") 
    {
    digitalWrite(FrontUp,HIGH);
    delay(1800);
    digitalWrite(FrontUp,LOW);
    digitalWrite(RearUp,HIGH);
    delay(2300);
    digitalWrite(RearUp,LOW);
    return 3;
    }
    else {
        return -1;
    }
    
}
    
int Lower(String command) {
    
    if (command=="1") 
    {
    digitalWrite(FrontDown,HIGH);
    delay(650);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(900);
    digitalWrite(RearDown,LOW);
    return 1;
    }
    else if(command=="2") 
    {
    digitalWrite(FrontDown,HIGH);
    delay(1250);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(1500);
    digitalWrite(RearDown,LOW);
    return 2;
    }
    else if(command=="3") 
    {
    digitalWrite(FrontDown,HIGH);
    delay(2000);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(2500);
    digitalWrite(RearDown,LOW);
    return 3;
    }
    else if(command=="0") 
    {
    digitalWrite(FrontDown,HIGH);
    delay(1250);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(1250);
    digitalWrite(RearDown,LOW);
    digitalWrite(FrontDown,HIGH);
    delay(2000);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(2000);
    digitalWrite(RearDown,LOW);
    digitalWrite(FrontDown,HIGH);
    delay(2000);
    digitalWrite(FrontDown,LOW);
    digitalWrite(RearDown,HIGH);
    delay(2000);
    digitalWrite(RearDown,LOW);
    return 0;
    }
	else {
        return -1;
    }
}

Credits

Sam Sutherland

Sam Sutherland

1 project • 0 followers
Ethan Owens

Ethan Owens

1 project • 0 followers

Comments