Project tutorial
Gest-R: A Multi-Purpose No Touch Switch

Gest-R: A Multi-Purpose No Touch Switch © Apache-2.0

Gest-R is state of the art gesture switch made to elegantly replace normal electrical switches.

  • 1,832 views
  • 0 comments
  • 3 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Introduction

We often come across situations where we have to switch on and off devices in a public space, like fan in an office or lights in your class room. Having such common switches to touch can have a negative impact on our efforts to counter corona. That is why I thought of a gesture switch that can be operated exactly as a traditional switch but comes with some bells and whistles. Gest-R (pronounce it as 'gesture') is a multi purpose 'no touch' switch in the same form factor of an electrical switch. It can be regarded as a premium switch but is in fact very affordable and unlike other non-contact solutions (like IR distance sensors) extremely power efficient.

Working

It is very easy to use Gest-R. All you have to do is pretend Gest-R is a toggle switch and try to toggle it. Gest-R recognizes your gesture. If you are pulling down (the imaginary toggle switch) Gest-R will turn on the device and if you are pulling up Gest-R will turn off the device for you. So without touching the switch you can control your devices in style. Premium, right ?!!

See the video for a better understanding how Gest-R works:

Now, hearing my claims of this exotic device you might have wrongly assumed that this is one super high tech device. No ! In fact Gest-R is super simple. Any one having a soldering iron and an Arduino can implement it. I will explain.

Do More!

Now what if you made a downward when Gest-R is already on ?

A timer is initiated that will turn off Gest-R after 5 minutes (or after a user predefined time period). So you are going to bed and want to turnoff the lamp 5 minutes after you enter the room, Gest-R will come to your aid. Just turn on the lamp twice (2 down gestures) and you are good to go.

Similarly you can turn on Gest-R automatically after a predefined interval by switching off Gest-R when it is already off, although I don't know why you want to do that. May be scare your friend with it !

How it's Made

Before explaining about the circuit go take a peek at the schematic.

See, it is super simple. Gest-R makes use of two capacitive proximity sensors, TTP223. The advantage is it is cheap, and being a passive sensor very power efficient.

TTP223 is connected to the two external interrupt pins(pin 2 and 3) of an Arduino Pro Mini here. You can also use an Arduino Nano or Attiny if you want to make it more smaller.

Once the connections are made open your Arduino IDE. Start by attaching interrupts in void setup().

void setup() {
// initialize Pins.
pinMode(Output, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
// Defining Interrupts
attachInterrupt(digitalPinToInterrupt(2), prox1, RISING);
attachInterrupt(digitalPinToInterrupt(3), prox2, RISING);
}

Output is Digital pin 5 in my circuit. You have to define it in the beginning of the code:

#define Output 5

Prox1 and Prox2 are functions to be called when the Interrupts are invoked.

The main loop of the function simply consists of a switch statement:

void loop() {
switch (GestR){
case 1:
digitalWrite(LED, HIGH);
break;
case 0:
digitalWrite(LED, LOW);
break;
case 2:
blinkled();
digitalWrite(LED, LOW);
GestR = 0;
break;
case -1:
blinkled();
digitalWrite(LED, HIGH);
GestR = 1;
}
}

To-Do

  • Use solid state relays and add dimming/ power regulation feature
  • Add a pot to adjust the timer delay
  • Make PCB for the circuit

This is my first Hackster project and I am pretty sure that there are plenty of room to improve. Thank you.

Code

Full codeArduino
Copy the code and burn into a uC
/*
  Code written by Nafih Ahammed in accordance with Hackster 'Touch Less, Do More' challenge.
  Gest-R is state of art multifunction capacitive Gesture switch.
 */


#define Output 5
bool state1 = false; // State of first capacitive proximity sensor.
bool state2 = false; // State of 2nd capacitive proximity sensor
int GestR = 0; // Gesture 1 implies downward motion and 0 implies uoward motion. 2 means start 'OFF-Timer' and -1 means start 'ON-Timer'.
int t = 5; // determines the delay of timer

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize Pins.
  pinMode(Output, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);

  // Defining Interrupta
  attachInterrupt(digitalPinToInterrupt(2), prox1, RISING);
  attachInterrupt(digitalPinToInterrupt(3), prox2, RISING);
}

// the loop function runs over and over again forever
void loop() {
  switch (GestR){
    case 1:
      digitalWrite(Output, HIGH);
      break;
    case 0:
      digitalWrite(Output, LOW);
      break;
    case 2:
      blinkled();
      digitalWrite(Output, LOW);
      GestR = 0;
      break;
    case -1:
      blinkled();
      digitalWrite(Output, HIGH);
      GestR = 1;
  }
}

void prox1() {
  if (state2) {
    if (GestR == 0)
      GestR = -1;
    else
      GestR = 0;
      
    state2 = false;
  }
  else
    state1 = true;
}

void prox2() {
  if (state1) {
    if (GestR == 1)
      GestR = 2;
    else
      GestR = 1;
      
    state1 = false;
  }
  else
    state2 = true;
}

void blinkled() {
  for (int t = 0; t<5; t++){
      digitalWrite(LED_BUILTIN, HIGH);
      delay(1000);
      digitalWrite(LED_BUILTIN, LOW);
      delay(1000);
    }
}

Schematics

circuit diagram
Schematic gestr 2020 08 30 11 15 28 qjcwcnz7hn

Comments

Similar projects you might like

Touch Less Touch Switch - A touch alternative UI

Project tutorial by Jithesh Thulasidharan

  • 3,149 views
  • 2 comments
  • 7 respects

IR Remote Controlled Power Switch for Rapsberry Pi 3

Project tutorial by Vilém Kužel

  • 5,982 views
  • 1 comment
  • 11 respects

Smart Soft Switch

Project tutorial by Vishwas Navada

  • 2,597 views
  • 0 comments
  • 6 respects

Integrated Solar ChargeController, Inverter, PowerBank, Lamp

Project tutorial by Shahariar

  • 19,633 views
  • 28 comments
  • 57 respects

Programmable Pocket Power Supply with OLED Display

Project tutorial by Shahariar

  • 13,377 views
  • 11 comments
  • 47 respects

I Made A Cap That Doesn't Allows You To Touch Your Face!!!

Project tutorial by Dynamic Innovator

  • 12,641 views
  • 41 comments
  • 57 respects
Add projectSign up / Login