Automatic Toilet door for Handicapped using Arduino Uno

Automating Toilet doors for Handicapped or Paraplegic patients is the sole purpose of this project. Using toilets can really be a nightmarish task for handicapped people and majority of it comes from opening and closing the toilet door. So this project is focused to build automated/ easy to operate toilet for handicapped people and make toilets wheelchair accessible. This is one of the modified variant of Electronic door locks which uses Arduino Uno to work. I believe this Arduino project will help handicapped to make use of toilet facilities without much help from others. Let’s take a look at this project and its working.

SCHEMATIC DIAGRAM:

INTERFACES INVOLVED IN THIS AUTO TOILET DOOR SYSTEM:

Outside Activator:

This interface is mounted on outside of bathroom to open the door. Interfaces such as a push button, a no touch magic switch, a motion sensor, access tags or cards are  few of the possible options you can consider for this. Alternatively remote buttons can be used. This is going to be a simple push button in my project.

Facility Operator:

Mounted within the facility to lock or unlock the door. Options are limited to push button, no touch magic switch and access tags or cards.

Panic Device:

Used to alert others encase of emergency and to open the door to provide access for the response. Options are an additional button on the remote or near the user inside the facility or an emergency door release break glass unit. The panic status resets when this option is activated second time. Then the facility returns to normal available status. There will be two Panic outputs are available in this Auto toilet door opener system, timer and constant. These together can drive sirens, strobes or interface with third party building management systems, security panels etc. The timer output is adjustable internally for approximately 5 to 60 seconds. High power and loud sirens need to be used here, hence you can use the additional relay unit connected to pin 9 of Arduino.

Override:

This is mounted outside the facility to provide access for emergency personal and facility maintenance staff. Here the available options are a remote button, an emergency door release break glass unit, key switch, or third party systems. Important thing here is that it should be only available for only Facility staff or emergency crew in case of any emergencies.

Prank Sensor:

This is a precautionary device installed that does not allow the facility to be set in locked status while the gate is open. This is to prevent pranksters from setting the door to lock status and leaving the facility before the door closes and locking others out. In this project a reed switch will act as a door lock sensor.

INDICATOR LED’s:

Mounted inside and outside facility to indicate the status of the Restroom/ Toilet/ Bathroom. These indicators are meant to indicate the current status about this toilet door opener system to the users.

GREEN – Indicates that the facility is vacant and available.

RED – Indicates that the facility is occupied and will not open from Outside Activator.

RED/GREEN – Fast fading and flashing indicates that the facility is in emergency status.

ORANGE/GREEN – One second pulse indicates that the door has been overridden to remain open.

The facility can not be put into Panic Status if unoccupied.

HOW IT WORKS:

You’re outside and the indicator light is green. Activate and the toilet door, it opens enough time for you to enter the facility even with the Wheelchair. You’re inside and the indicator light is green. Activate the internal button and the indicator light turns red indicating that the facility is occupied. So this prevents the door from being opened by Outside Activator.

You’ve washed your hands so then activate the internal device/ button. Then the indicator light turns green and the door will be open long enough to allow you to exit. So here are some unforeseen circumstances. You are inside and need help, the door is locked and the light is RED! Activate the Panic Device then the indicator lights go wild, a siren may sound, lights may flash and the door opens and provide access for those to assist you. Reactivate the Panic Device to reset the facility to green and set to normal state.

Consider another scenario where you are inside and need help. But the door is locked and the light is RED but you are unable to get to the Panic Device but were able to call for help! There is an override button or activator for the assistance to open the door from outside. But as described above only corresponding personal should have access to Override button and should only be used in these kind of circumstances.

CODE: 

/*
Paraplegic toilet automatic door controls code by Anthony Kenny
*/

// these constants won't change
const int InsideButton = 6; // inside push button
const int Activator = 2; // remote, card reader, button etc. 
const int DoorClosed = 3; // mag reed switch to see if door is closed, door must not lock if open
const int Panic = 4; // panic button
const int EmergencyOpen = 5; // overide to open door
const int RedLED = 11; // Toilet Occupied indicator
const int GreenLED = 12; // Toilet Vacant indicator
const int Open = 10; // Open Toilet
const int Siren = 9; // Siren signal

// Vaiables that will change

int DoorState = 0; // Door leaf open/closed
int ToiletState = 0; // Toilet Locked/Unlocked/Emergency
int activate = 0; // Open Signals
int panic = 0; // Panic button
int Button = 0; // inside button
int flipflop = 0; // flip flop to activate deactivate panic status
long sirenruntime = 4700; // siren on time
int LEDredbrightness = 0; // how bright the red LED is
int LEDgreenbrightness = 255; // start brightness of green LED
int REDfadeAmount = 5; // how many points to fade the red LED by
int GREENfadeAmount = 0; // how many points to fade the green LED by
int Overide = 0; // external overide
int OverideState = 0; // overide status

void setup() {
// initialize inputs
pinMode(InsideButton, INPUT);
pinMode(Activator, INPUT);
pinMode(DoorClosed, INPUT);
pinMode(Panic, INPUT);
pinMode(EmergencyOpen, INPUT);

// initialize outputs
pinMode(Siren, OUTPUT);
pinMode(RedLED, OUTPUT);
pinMode(GreenLED, OUTPUT);
pinMode(Open, OUTPUT);

Serial.begin(9600); // initialize serial communication for probing

analogWrite(GreenLED, LEDgreenbrightness); //initial status

}

void loop() {


/*
Outside toilet activation
*/

activate = digitalRead(Activator); // read the activation signals input pins:
// ToiletState = digitalRead(DoorClosed);
// LockSignal = digitalRead(InsideButton); 
Button = digitalRead(InsideButton); // check inside button
DoorState = digitalRead(DoorClosed); // is door closed
panic = digitalRead(Panic); // is panic button pressed

if (activate == HIGH) { // open door if activated, remove later
if (ToiletState == LOW) { // if toilet unoccupied
digitalWrite(Open, HIGH); // open door
delay(1000); //so a short open pulse to operator
digitalWrite(Open, LOW); // close door
Serial.println("opened"); // probe opened
}
}

/*
External Overide
*/
Overide = digitalRead(EmergencyOpen); // read emergency open signal

if (Overide == HIGH) { // if overide is active
if (OverideState == LOW) { // if door is not already over riden
OverideState = 1; // set to overide status
digitalWrite(Open, HIGH); // open door
analogWrite(GreenLED, 255); // make leds orange
analogWrite(RedLED, 100);
delay(2000); // delay for push button signal
} 
}

Overide = digitalRead(EmergencyOpen); // read emergency open signal

if (Overide == HIGH) { // if overide is active
if (OverideState == HIGH) { // if door is not already over riden
OverideState = 0; // set to overide status
digitalWrite(Open, LOW); // open door
analogWrite(RedLED, 0); // turn off red LED
delay(2000); // delay for push button signal
} 
}
/*
Inside toilet button
*/

if (Button == HIGH) { // if inside button pressed
Serial.print("Inside Button "); // probe that inside button is pressed
Serial.println(Button);
if (DoorState == LOW) { // if door is closed
if (flipflop == LOW) { // check if not in emergency status
if (ToiletState == LOW) { // if door is unlocked
ToiletState = 1; // lock the door
analogWrite(GreenLED, 0); // change LED from green to red
analogWrite(RedLED, 255);
Serial.print("Toilet State "); // probe toilet state
Serial.println(ToiletState);
Serial.print("Door State "); // probe Door State
Serial.println(DoorState); 
delay(1000); // delay for push button signal
}
}
}
} 

// inside button pressed
Button = digitalRead(InsideButton); // re-read inside button
if (Button == HIGH) { // if button is pressed
Serial.print("Inside Button "); // probe that inside button is pressed
Serial.println(Button);
if (flipflop == LOW) { // check if not in emergency status
if (DoorState == LOW) { // if door is closed
if (ToiletState == HIGH) { // if door is locked
ToiletState = 0; // unlock door
analogWrite(GreenLED, 255); // set green LED to full
analogWrite(RedLED, 0); // set red LED to off
Serial.print("Toilet State "); // probe toilet state
Serial.println(ToiletState);
Serial.print("Door State "); // probe door State
Serial.println(DoorState);
digitalWrite(Open, HIGH); // open door
delay(1000);
digitalWrite(Open, LOW); // close door
}
}
}
}
/*
Panic activation
*/
int potValue = analogRead(A0); // declare and get pot value

panic = digitalRead(Panic); // is panic button pressed
if (panic == HIGH) { // check panic button
if (flipflop == LOW) { // check if already in emergency state
if (ToiletState == HIGH) { // check if the toilet is in use <locked> no need for emergency if toilet is not locked and occupied.
flipflop = 1; // change to emergency state
sirenruntime = (potValue * 12) + 600; // set siren run time
digitalWrite(Open, HIGH); // open door
Serial.println("Emergency Opened"); // show door open on emergency
delay(1000); // delay for button
}
}

}
panic = digitalRead(Panic); // is panic button pressed
if (panic == HIGH) { // check panic button
if (flipflop == HIGH); { // check if already in emergency state
flipflop = 0; // change to safe state
Serial.println("door closed"); // show door closed after emergency
digitalWrite(Open, LOW); // close door
delay(1000); // delay for button
ToiletState = 0; 
analogWrite(GreenLED, 255); // power up green LED
analogWrite(RedLED, 0); // power down red LED
Serial.print("Toilet State "); // show toilet state
Serial.println(ToiletState);
Serial.print("Door State "); // show Door State
Serial.println(DoorState);
digitalWrite(Siren, LOW); // switch off siren
}
}

/*
Siren and LEDs effects in emergency
*/


if (flipflop == HIGH) { // if in emergency state


analogWrite(RedLED, LEDredbrightness); // set the brightness of RED
LEDredbrightness = LEDredbrightness + REDfadeAmount;

analogWrite(GreenLED, LEDgreenbrightness); // set the brightness of GREEN
LEDgreenbrightness = LEDgreenbrightness + GREENfadeAmount;

if (LEDredbrightness == 255) { // if red LED brightness is at 255 then 
REDfadeAmount = 0; // stop the red's fade in and 
GREENfadeAmount = 5; // start the green's fade in
}

if (LEDgreenbrightness == 255) { // if green LED brightness is at 255 then 
REDfadeAmount = -5; // start to fade out red and
GREENfadeAmount = 0; // stop the green's fade in
}

if (LEDredbrightness == 0) { // if red LED brightness is at 0 then 
REDfadeAmount = 0; // stop the red's fade out and
GREENfadeAmount = -5; // start to fade out green
LEDredbrightness = 5; // set red brighness to five for the next loop < if (LEDredbrightness == 0) >
} 

if (LEDgreenbrightness == 0) { // if green LED brightness is at 0 then 
REDfadeAmount = 5; // then start to fade in red and
GREENfadeAmount = 0; // stop green's fade out
LEDgreenbrightness = 5; // set greens brighness to five for the next loop < if (LEDgreenbrightness == 0) >
}
delay(1); 
if (sirenruntime > 0) { // if time has not run out
tone(13, 3000); // 3kHz to Piezo
digitalWrite(Siren, HIGH); // siren is on
sirenruntime = sirenruntime - 5; // siren decrement
Serial.print("siren run time "); // probe run time left
Serial.println(sirenruntime);
}
if (sirenruntime <= 0) { // if sirentime is 0 or less
noTone(13); // stop piezo
digitalWrite(Siren, LOW); // stop siren
}
}
}

NOTE: 

  1. You need to build two individual relay units for activating door and siren respectively. A single relay unit is shown in circuit diagram for the sake of simplicity.
  2. Substitute the Transistor and relay as per your Current and Voltage requirement, since different activators and siren’s operate under different rating.
  3. Do add bias resistor between Arduino pins and transistor base.
  4. Door activator mechanism/ unit is not within the scope of this project article and you need to work on a way to activate or deactivate it using the relay unit.

Hope this project was useful to you guys. Do provide your feedback in the below comments section. If you see any ways to improve this system, am looking forward to hear it. Thanks for reading, happy making 🙂