Capstone Minion Design Complete

Design Capstone Project which included the Arduino Mega, Relays, DC Brushless Drive Motor, Clear Elevator, LCD 7.5″ Display W/Music, Buttons, Resistors, Dual 555 ICs, Capacitors, and Switches.

Schematics:
2_CHANNEL_5V_10A_RELAY_MODULE

1157

Honeywell_MicroSwitch (ZV Series)

lm555

LCD Schematic

Source Code Download

Source Code: (available for download above)

/* Daniel D. Wilcox & Jenat A. Awad,
               
          ---- Group 1 ----
*/
// ------------------ Global Variables ---------------------------------- //

/*  "configuration" is used to designate which floor the elevator car
 *  should go to. The configuration designations are saved in the
 *  "configurations()" functions. 
 */
int configuration = 0; // Reset to Null Movement Condition

int level = 1; // First Floor level for seven segment display, DEFAULT

// Floor Switches for Elevator Car
const int floor_sw_1 = 12;
const int floor_sw_2 = 11;
const int floor_sw_3 = 10;
// -------------------------------



// Floor Buttons for users to select which floor they require elevator car
const int floor_btn_1 = 4;
const int floor_btn_2 = 3;
const int floor_btn_3 = 2;
// -----------------------------------------------------------------------


// Relay Module Commands for Elevator Car Movement
const int car_up = 5;
const int car_dn = 6;
// -----------------------------------------------


// LED Directional Lights for Elevator Car
const int led_up = 44;
const int led_dn = 42;
// --------------------------------------- 


// Seven Segment Display Floor Numbers
const int a = 23;
const int b = 25;
const int e = 27;
const int f = 29;
const int g = 31;
const int h = 33;
const int i = 35;
// ------------------------------------

// LCD Picture Frame Constant
const int LCD_PWR = 50;



void setup() {
// Floor Switches for Elevator Car designated as inputs
pinMode(floor_sw_1, INPUT);
pinMode(floor_sw_2, INPUT);
pinMode(floor_sw_3, INPUT);
// ---------------------------------------------------


// Floor Buttons designated as inputs
pinMode(floor_btn_1, INPUT);
pinMode(floor_btn_2, INPUT);
pinMode(floor_btn_3, INPUT);
// -----------------------------------


// Relay Module Elevator Car as outputs
pinMode(car_up, OUTPUT);
pinMode(car_dn, OUTPUT);
// ------------------------------------

// LED Directional Lights for Elevaltor Car
pinMode(led_up, OUTPUT);
pinMode(led_dn, OUTPUT);
// ------------------------------------


// Seven Segment Display as OUTPUTS
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
pinMode(h, OUTPUT);
pinMode(i, OUTPUT);
// ----------------------------------

//  Turns  ON  &  OFF  LCD 
pinMode(LCD_PWR, OUTPUT);
//------------------------

// Activates Elevator Music
pinMode(ELV_MUSIC, OUTPUT);
//-------------------------


} // END of void setup()



void loop() {
floor_num(); // Detects which floor number to display
// Turns on LCD 
digitalWrite(LCD_PWR, HIGH);
digitalWrite(ELV_MUSIC, HIGH);

// Car on First Floor, Second Floor Button Pressed. Car Rises
if (digitalRead(floor_sw_1) == HIGH && digitalRead(floor_btn_2) == HIGH){
         configuration = 1;
         configurations();
}

// Car on First Floor, Third Floor Button Pressed. Car Rises
else if(digitalRead(floor_sw_1) == HIGH && digitalRead(floor_btn_3) == HIGH){
        configuration = 2;
        configurations();
}

// Car on Second Floor, Third Floor Button Pressed. Car Rises
else if(digitalRead(floor_sw_2) == HIGH && digitalRead(floor_btn_3) == HIGH){
        configuration = 3;
        configurations();
}

// Car on Third Floor, Second Floor Button Pressed. Car Lowers
else if(digitalRead(floor_sw_3) == HIGH && digitalRead(floor_btn_2) == HIGH){
        configuration = 4;
        configurations();
}

// Car on Third Floor, First Floor Button Pressed. Car Lowers
else if(digitalRead(floor_sw_3) == HIGH && digitalRead(floor_btn_1) == HIGH){
        configuration = 5;
        configurations();
}

// Car on Second Floor,First Floor Button is Pressed. Car Lowers
else if(digitalRead(floor_sw_2) == HIGH && digitalRead(floor_btn_1) == HIGH){
        configuration = 6;
        configurations();
}



} // END of void loop()







// Movement Configurations for Each Floor Combination
void configurations() { 

// BELOW: Elevator Rise From First to Second Floor.

if(configuration == 1){
       while(digitalRead(floor_sw_2) == LOW){ 
       digitalWrite(car_up, HIGH);
       digitalWrite(led_up, HIGH);
       level=0; // No LEVEL
       floor_num();
       }
configuration = 0; // Reset to Null Movement Condition
level=2; 
digitalWrite(car_up, LOW); // Cease car Movement
digitalWrite(led_up, LOW);
}

// BELOW: Elevator Rise From First to Third Floor
else if(configuration == 2){
        while(digitalRead(floor_sw_3) == LOW){
        digitalWrite(car_up, HIGH);
        digitalWrite(led_up, HIGH); 
        level=0; // No LEVEL
        floor_num();
        }
configuration = 0; // Reset to Null Movement Condition
level=3; 
digitalWrite(car_up, LOW); // Cease car Movement
digitalWrite(led_up, LOW);
}

// BELOW: Elevator Rise from Second to Third Floor
else if(configuration == 3){
        while(digitalRead(floor_sw_3) == LOW){
        digitalWrite(car_up, HIGH);
        digitalWrite(led_up, HIGH);
        level=0; // No LEVEL
        floor_num();
        }
configuration = 0; // Reset to Null Movement Condition
level=3; 
digitalWrite(car_up, LOW); // Cease car Movement
digitalWrite(led_up, LOW);
}

// BELOW: Elevator Lowers from Third to Second Floor
else if(configuration == 4){
        while(digitalRead(floor_sw_2) == LOW){
        digitalWrite(car_dn, HIGH); 
        digitalWrite(led_dn, HIGH); 
        level=0; // No LEVEL
        floor_num();
        }
configuration = 0; // Reset to Null Movement Condition
level=2; 
digitalWrite(car_dn, LOW); // Cease car Movement
digitalWrite(led_dn, LOW);
}

// BELOW: Elevator Lowers from Third to First Floor
else if(configuration == 5){
        while(digitalRead(floor_sw_1) == LOW){
        digitalWrite(car_dn, HIGH); 
        digitalWrite(led_dn, HIGH);
        level=0; // No LEVEL
        floor_num();
        }
configuration = 0; // Reset to Null Movement Condition
level=1; 
digitalWrite(car_dn, LOW); // Cease car Movement
digitalWrite(led_dn, LOW);
}

// BELOW: Elevator Lowers from Second to First Floor
else if(configuration == 6){
        while(digitalRead(floor_sw_1) == LOW){
        digitalWrite(car_dn, HIGH);
        digitalWrite(led_dn, HIGH);
        level=0; // No LEVEL
        floor_num();
        }
configuration = 0;  // Reset to Null Movement Condition 
level=1; 
digitalWrite(car_dn, LOW); // Cease car Movement
digitalWrite(led_dn, LOW);
}

}// End of VOID configuration() function






void floor_num() {
// Displays middle led, signifying in motion
if (level == 0){
digitalWrite(a, HIGH);
digitalWrite(f, HIGH);
digitalWrite(b, HIGH);
digitalWrite(e, LOW);
digitalWrite(h, HIGH);
digitalWrite(i, HIGH);
digitalWrite(g, HIGH);
}

else if(level == 1){
// First Floor 7-segment display
digitalWrite(a, LOW);
digitalWrite(f, LOW);
digitalWrite(b, HIGH);
digitalWrite(e, HIGH);
digitalWrite(h, HIGH);
digitalWrite(i, HIGH);
digitalWrite(g, HIGH);
// -----------------------------
}

else if(level == 2){
// Second Floor 7-segment display
 digitalWrite(a, LOW);
 digitalWrite(b, LOW);
 digitalWrite(e, LOW);
 digitalWrite(h, LOW);
 digitalWrite(i, LOW);
 digitalWrite(f, HIGH);
 digitalWrite(g, HIGH);
// ------------------------------
}

else if(level == 3){
// Third Floor 7-segment display
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
digitalWrite(i, HIGH);
// ----------------------------- 
}
} // END of Floor_num()

4 Comments

  1. chota_scientist

    code

    Reply
    1. Daniel D. Wilcox (Post author)

      Code has been pasted upon your request. Keep in mind that this design is unique, in that dual 555 timers were used (with an independent PSU), relays do drive the brush-less D.C. motor, etc. Take a close look at the design, the code will make more sense.

      Reply
      1. Ong

        Hi
        Thank for you elevator code and design
        Anyway sorry to said im a retire old man age 57year
        Try to buit these a a hobby project.

        May i use arduino uno for these job cause i have 3 pcs of these.

        May i have a full drawing on the wiring dirgram from arduino to 7segment display and the level switch of each floor

        May i know if there is a door opening mode and a buzzer sound on each floor when it reach

        Thank you
        So much

        Reply
  2. ong

    hi
    thank for your elevator code
    i try but not really working
    maybe if you are able to provide me with the circuit diagram with the floor switch and floor button .
    please
    thank you

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *