SwathiKarthick
Published © GPL3+

Smart Cabana at Swimming pool

People after taking swimming like to change their swim-suit the cabana at swimming pool will help and more to physically challenged persons.

IntermediateFull instructions provided8 hours57
Smart Cabana at Swimming pool

Things used in this project

Hardware components

Person Sensor
Useful Sensors Person Sensor
×1
Arduino UNO
Arduino UNO
×1
Grove – Chainable RGB Led V2.0
Seeed Studio Grove – Chainable RGB Led V2.0
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Grove - Relay
Seeed Studio Grove - Relay
×1
Grove - Touch Sensor SKU 101020037
Seeed Studio Grove - Touch Sensor SKU 101020037
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad

Hand tools and fabrication machines

Servo Motor, Premium Male/Male Jumper Wires
Servo Motor, Premium Male/Male Jumper Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Soldering Station, Hobbyist
Soldering Station, Hobbyist

Story

Read more

Schematics

Cabana door Open/Close

The program will help to open and close door when the sensor sense the person presence.

Code

Cabana door Open/Close

Arduino
The program will help to open and close door when the sensor sense the person presence. Especially for physically challenged people this will help a lot.
#include <Servo.h>

const int buttonPin = 7;  // the number of the pushbutton/Touch pin
const int ledPin = 12;    // the number of the LED pin
const int CamI = 8;		// number of Camera Pin
const int Red = 6;    	// RED color LED pin
const int Green = 5;	// GREEN color LED pin
Servo myservo;  // create servo object to control a servo
   

int buttonPushCounter = 0;	
int green = HIGH;
int red = LOW;
int ledState = LOW;        
int buttonState;            
int lastButtonState = LOW;  

unsigned long lastDebounceTime = 0;  
unsigned long debounceDelay = 20;    // debounce interval
unsigned long previousMillis; 
const long interval = 15000;		//Delay interval
unsigned long currentMillis = 0;

// initiliaze the Input/Output pins
void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(CamI, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(Red, OUTPUT);
  pinMode(Green, OUTPUT);
  myservo.attach(9);  
  digitalWrite(ledPin, ledState);
  myservo.write(0);
}

//Cabana door open and close based on person detection
void loop() {
 STArT: 
  //LED color red for no entry and green for entry
  digitalWrite(Red, red);
   	digitalWrite(Green, green);
  //If sensor detect the person presence then OPEN the door
 if(digitalRead(CamI) == HIGH){
    myservo.write(80);
     
   int run = 0;
  previousMillis = millis();
   // Two button press count and exit the loop
  while(run <= 1){ 
          int reading = digitalRead(buttonPin);
          currentMillis = millis();
    // After door opening person may not enter then the door will automatically CLOSE after 15 sec time
      if (run == 0 && currentMillis - previousMillis >= interval) {
                        previousMillis = currentMillis;
                        goto LasT;
                      }
      if (reading != lastButtonState) {
           lastDebounceTime = millis();
         }

      if ((millis() - lastDebounceTime) > debounceDelay) {
          if (reading != buttonState) {
                 buttonState = reading;
// Close the door if the person enter in and press the button to HIGH
             if (buttonState == HIGH) {
             	   ledState = !ledState;  
                   red = !red;
       			   green = !green;
                   digitalWrite(ledPin, ledState);
                   digitalWrite(Red, red);
               	   digitalWrite(Green, green);
                   run++;
              }
        if (ledState == HIGH) {
               myservo.write(0); //Door CLOSE
               }
// once the dress is changed the cabana door open on button press
       else  { 
       		myservo.write(80);  // Door OPEN
            }
          }
        }
  lastButtonState = reading;
  	}
  // once the door is OPEN for person exit wait 10Sec and CLOSE door
   delay(15000);
   	LasT: myservo.write(0); //Door CLOSE  
    	   goto STArT;
  
  }
  
  }

Credits

Swathi

Swathi

6 projects • 2 followers
Hobbyist
Karthick

Karthick

12 projects • 13 followers
Hobbyist

Comments