Things used in this project

Hardware components:
DFRobot Relay Shield 2.1
×1
DFRobot 16*2 LCD Display Shield
×1
DFRobot Screw Shield Wing
×1
ADAFRUIT Switchable 110v Outlet
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
11026 02
Jumper wires (generic)
×1
Hand tools and fabrication machines:
A4kb1xynkid5ebvjyil7
Digilent Screwdriver

Schematics

Kevino Museum Interface
Generic minimum configuration platform for kiosk / exhibit automation.
Img 0557 pfkubzbiai
Adafruit Switched outlet powerbar
Img 0507 dyh9k0soe1

Code

ESCAPE ROOM 2.1.1Arduino
/*  DFRobot 4 relay shield and Hitachi 16 * 2 LCD Display.       
 *  Relays are reassigned as made necessary by the inclusion of the display,                             
 *  D2,D3,D11, and D12 are used to drive the 4 coils.                                                     
 *  A1,A2,A3, and A4  are loosely associated with the corresponding relay...                              
 *  A1 thru A4 are configured active low with internal pullups enabled.                                  
 *  The basic loop structure incorporates debouncing.                              
                              
 *  Escape V2.1- Input 1 (A1) triggers Relay A for 0.5 sec, Relay B for 20        seconds.                       
           RelayA- BRIGHTSIGN Video Playback,  RelayB Effect Output                                
 */

// set pin numbers:
const int buttonAPin = A1;     // the number of the pushbutton pin
const int buttonBPin = A2;     // 
const int buttonCPin = A3;     // 
const int buttonDPin = A4;     // 
const int ledPin =  13;      // the number of the LED pin
const int RelayA =2;      // the number of the relay coil drive pin
const int RelayB =3;      // 
const int RelayC =11;      // 
const int RelayD =12;      // 
// Variables will change:

int buttonAState;             // debouncing variables
int lastButtonAState = HIGH;   // 
 
int buttonBState;             // 
int lastButtonBState = HIGH;   // 

int buttonCState;             // 
int lastButtonCState = HIGH;   //

int buttonDState;             // 
int lastButtonDState = HIGH;   // 

// the following variables are long's because the time, 
// measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.

long lastDebounceTimeA = 0;  // the last time the output pin was toggled
long lastDebounceTimeB = 0;  // the last time the output pin was toggled
long lastDebounceTimeC = 0;  // the last time the output pin was toggled
long lastDebounceTimeD = 0;  // the last time the output pin was toggled
long debounceDelay = 50;     // the debounce time; 
long loopdelayA =1000       //  1 second 
long looptriggerA;
long loopdelayB =20000;     //  20 seconds
long looptriggerB;

#include <LiquidCrystal.h>

// Select the pin used on LCD
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// define the button
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

//read the button value
int read_LCD_buttons(){

adc_key_in = analogRead(0);          // read analog A0 value  
// when read the 5 key values 
// By setting different threshold, you can read the one button
  
  if (adc_key_in < 50)   return btnRIGHT;  
  if (adc_key_in < 250)  return btnUP; 
  if (adc_key_in < 450)  return btnDOWN; 
  if (adc_key_in < 650)  return btnLEFT; 
  if (adc_key_in < 850)  return btnSELECT; 
  return btnNONE; 
}

void setup(){
  
  lcd.begin(16, 2);                
  lcd.setCursor(0,0);
  lcd.print("KEVino 2017");
  lcd.setCursor(0,1);
  lcd.print("Escape Room");
  delay(1000);
// scroll 16 positions (string length) to the left 
// to move it offscreen left:
  for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayRight(); 
    // wait a bit:
    delay(300);
  }
  { 
    lcd.begin(16, 2); 
    lcd.setCursor(0,0);
    lcd.print("ESCAPE 2.1.1"); 
  }
  
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);   
  // initialize the Relay drive pin as an output:
  pinMode(RelayA, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(buttonAPin, INPUT_PULLUP);  
   pinMode(RelayB, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(buttonBPin, INPUT_PULLUP);  
   pinMode(RelayC, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(buttonCPin, INPUT_PULLUP);  
   pinMode(RelayD, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(buttonDPin, INPUT_PULLUP);  
 
}

void loop() {
  
    lcd.setCursor(13,0);
    lcd.print(millis()/1000);
  
  // read the state of the switch into a local variable:
  int readingA = digitalRead(buttonAPin);
    
  // check to see if you just pressed the button 
  //  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (readingA != lastButtonAState) {
    // reset the debouncing timer
    lastDebounceTimeA = millis();
    looptriggerA = millis();
    looptriggerB = millis();
  
  } 
 if ((millis() - lastDebounceTimeA) > debounceDelay) {
    // whatever the reading is,it has been there for longer than the               // debounce delay, so take it as the actual current state:

    // if the button state has changed:
    if (readingA != buttonAState) {
      buttonAState = readingA;
      
      
    // only toggle the LED if the new button state is LOW
      if (buttonAState == LOW) {
       
         lcd.setCursor(0,1);
         lcd.print("A1"); 
   
        digitalWrite(ledPin, HIGH); 
        digitalWrite(RelayA, HIGH);
       
        lcd.setCursor(7,1);
        lcd.print("D2");
        lcd.setCursor(13,1);
        lcd.print("R1");
       
        digitalWrite(RelayB, HIGH);
        lcd.setCursor(4,1);
        lcd.print("D3");
        lcd.setCursor(10,1);
        lcd.print("R2");
      }  
    }
          if ((millis() - looptriggerA) >loopdelayA ) {  
         lcd.setCursor(0,1);
         lcd.print("  " );
         lcd.setCursor(7,1);
         lcd.print("  ");
         
         lcd.setCursor(13,1);
         lcd.print("  ");
          digitalWrite(ledPin, LOW); 
          digitalWrite(RelayA, LOW); 
    }
      if ((millis() - looptriggerB) >loopdelayB ) {  
         lcd.setCursor(0,1);
         lcd.print("  " );
         lcd.setCursor(4,1);
         lcd.print("  ");
         lcd.setCursor(10,1);
         lcd.print("  ");
         digitalWrite(ledPin, LOW); 
         digitalWrite(RelayB, LOW); 
      }
  }   
  // save the reading. Next time through, it'll be the lastButtonState:
  lastButtonAState = readingA;
  
  lcd.setCursor(0,1);  
  lcd_key = read_LCD_buttons();  // read key

 switch (lcd_key)               // display key
 {
 /*  case btnRIGHT:
     {
     lcd.print("RIGHT ");
     break;
     }
   case btnLEFT:
     {
     lcd.print("LEFT   ");
     break;
     }
   case btnUP:
     {
     lcd.print("UP    ");
     break;
     }
   case btnDOWN:
     {
     lcd.print("DOWN  ");
     break;
     }
     */
   case btnSELECT:
     {
    lcd.begin(16, 2); 
    lcd.setCursor(0,0);
     lcd.print("dont touch");
     delay(3000);
     lcd.begin(16, 2); 
    lcd.setCursor(0,0);
     lcd.print("KEVino 2017");
     break;
     }
    /* case btnNONE:
     {
     lcd.print("       ");
     break;
     }
     */
 }
 }
 


 

Credits

Kevinmcarthur
KevinMcArthur
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login