Contactless Switchboard
1419 30
Manav Thakkar

Contactless Switchboard

In these pandemic times, it has become very important to keep social distancing and avoid contact...

Description:-

In these pandemic times, it has become very important to keep social distancing and avoid contact as much as possible and this becomes very crucial in public places, hence i developed a prototype of a contact less-board which can help to avoid direct contact while toggling on/off appliances. With this, appliances of the premise can be controlled just by hovering the finger on the switch-board. It can be implemented in indoor public places like hospitals, gyms, etc. This device can help to stop the spread of deadly corona-virus.

Contactless Switchboard Circuit

Project Used Hardware

IR sensors, Arduino Uno (for prototyping), jumper wires, LEDs, 220-ohm resistors

Contactless Switchboard Hardware

Project Used Software

Arduino IDE, Tinkercad Circuits

Project Hardware Software Selection

Arduino UNO was selected for prototyping purposes as it is readily available, but for the final version of the project, a PCB can be designed with an ATmega328p micro-controller to shrink its size further and reduce the cost. Arduino IDE software was used to program the board. IR sensors were used for detecting the presence of the hand and toggle (on/off) the appliance. A seven segment display shows the state of current appliance, which is being toggled. For demonstration purpose, LEDs are shown, but it can be replaced by relays to control the AC appliances like lights, fans, etc. As IR sensors are used in the project, and they do not work in presence of direct sunlight, this contact-less switchboard cannot be used outdoors, but works perfectly fine for the indoor environment.

Arduino based Contactless Switchboard

Circuit Diagram

Contactless Switchboard Circuit Diagram

The pins a, b, c, d, e, f, and g of 7-segment are connected to 220-ohm resistors in series and are connected with the 2,3,4,6,7,8 and 9 pins of the Arduino UNO, respectively. If you are using a single digit, then connect the common pin of the 7-segment with the Arduino GND. The cathode (shorter leg) of all LEDs is connected to the negative rail of the breadboard which is connected to the Arduino GND. Anode (longer leg) of all LEDs is connected in series with 220-ohm resistor and then is connected to the A0, A1, A2, A3, A4 pins of the Arduino UNO. Changes can be made in the code to use other pins. The GND and VCC pins of the IR sensors are connected to the GND and +5V pin of the Arduino UNO. The OUT1 and OUT2 pin is connected to pin 10 and 12 of the Arduino UNO. The first IR sensor is used to change the number of appliance to be controlled and the second IR sensor is used to toggle ON and OFF that appliance. You can change the number of appliances by changing variables in the code. Also, if you want to use a third IR sensor to increase and decrease the number on the 7-segment display uncomment the lines related to ir2 in the code.

Code

int count = 0;
int NoOfRelays = 5;
int ir1 = 10;        
//int ir2 = 11;
int toggleIR = 12;
int relay1 = A0;
int relay1status = false;
int relay2 = A1;
int relay2status = false;
int relay3 = A2;
int relay3status = false;
int relay4 = A3;
int relay4status = false;
int relay5 = A4;
int relay5status = false;
// bits representing segments A through G (and decimal point) for numerals 0-9
const byte numeral[10] = {
 //ABCDEFG /dp
 B11111100, // 0
 B01100000, // 1
 B11011010, // 2
 B11110010, // 3
 B01100110, // 4
 B10110110, // 5
 B10111110, // 6
 B11100000, // 7
 B11111110, // 8
 B11100110, // 9
};
// pins for decimal point and each segment
                         // dp,G,F,E,D,C,B,A  // common to 5v
const int segmentPins[8] = { 5,9,8,7,6,4,3,2};
void setup()
{
 pinMode(ir1,INPUT);
// pinMode(ir2,INPUT);
 pinMode(relay1,OUTPUT);
 pinMode(relay2,OUTPUT);
 pinMode(relay3,OUTPUT);
 pinMode(relay4,OUTPUT);
 pinMode(relay5,OUTPUT);
 Serial.begin(9600);
 for(int i=0; i < 8; i++)
 {
 pinMode(segmentPins[i], OUTPUT); // set segment and DP pins to output
 }
}
void loop()
{
 showDigit(count%10);
 int num = count%10;
 if(digitalRead(toggleIR) == 0){
    switch (num){
      case 1:
         relay1status = !relay1status;
         digitalWrite(relay1,relay1status);
         break;
         case 2:
         relay2status = !relay2status;
         digitalWrite(relay2,relay2status);
         break;
         case 3:
         relay3status = !relay3status;
         digitalWrite(relay3,relay3status);
         break;
         case 4:
         relay4status = !relay4status;
         digitalWrite(relay4,relay4status);
         break;
         case 5:
         relay5status = !relay5status;
         digitalWrite(relay5,relay5status);
         break;
    }
 }
while(digitalRead(toggleIR)==0);
delay(50);
if(digitalRead(ir1)==0){
  count++;
  delay(50);
  Serial.println(count);
   if(count>NoOfRelays){
    count = 1;
   }
}
while(digitalRead(ir1)==0);
delay(50);
//if(digitalRead(ir2)==0){
//  count--;
//  delay(50);
//  Serial.println(count);
//
//    if(count<=0){
//      count = 1;
//    }
//  
//}
//
//while(digitalRead(ir2)==0);
//delay(50);
}
// Displays a number from 0 through 9 on a 7-segment display
void showDigit( int number)
{
 boolean isBitSet;
 for(int segment = 1; segment < 8; segment++)
 {
 if( number < 0 || number > 9){
 isBitSet = 0; // turn off all segments
 }
 else{
  // isBitSet will be true if given bit is 1
 isBitSet = bitRead(numeral[number], segment);
 }
 //isBitSet = ! isBitSet; // remove this line if common cathode display
 digitalWrite( segmentPins[segment], isBitSet);
 }
}