Skip to main content

Gesture and Touch Sensor Module

As the name suggests the Gravity Gesture & Touch Sensor from DFRobots offers both gesture recognition and touch detecting functionalities in a single module. The module offers a configurable gesture detection range with in 0-30cm. The module features 5 touch pads which can be used directly or with external wires/touch pads. In terms of gesture recognition this module is capable of recognising 7 kinds of gestures: move left, move right, move forward, move backward, pull up, pull down, pull and remove. Along with these functionalities the module offers auto-sleep and wake up. The module’s Gesture recognition algorithm makes it easy to interface with a wide range of microcontrollers using UART protocol.

 

Gravity Gesture & Touch Sensor Module Pinout Configuration

Pin

Name

Type

Description

1

TXD

I/O

TX pin for transmitting data.

2

RXD

I/O

RX pin for receiving data.

3

VCC

P

Power supply positive.

4

GND

P

Power supply negative.

 

Gesture and Touch Sensor Features 

  • Power Supply: 3.3V - 6V (recommend 5V)
  • Output Voltage: 0 - 3.3V
  • Operating Current: about 56.3mA
  • Sleep Mode Current: about 40uA
  • Output: TTL serial port
  • Adapter Plate Size: 35mm×22mm/1.38×0.87”
  • Interface: Gravity
  • Serial Protocol Format: 9600 band rate; 8 data bits, no parity bit, 1 stop bit

 

Other Popular Gesture sensors

APDS9960, APDS9500, PAJ7620,

 

How does Gesture sensing works?

Gravity Gesture & Touch Sensor Module

The gravity gesture sensor module uses infrared diodes and receivers to detects the motion. The Infrared LED will light up and shine infrared light. When our hand is placed in front of the sensor the light will reflect back to the receiver. The module will monitor this reflected IR light and will detect the gesture based on how these changes.

 

Interfacing Gravity Gesture and touch module with Arduino.

The following image shows how to interface the Gravity gesture and touch module with Arduino Uno board.

Gravity Gesture & Touch Sensor Module

Connect the VCC pin to the 5V pin of Arduino and GND pin to the GND pin of Arduino. The TX pin is connected to the D11 and RX is connected to D10 pins of the Arduino Uno.

 

Gesture and Touch Sensor Arduino Code

Here is the sample code for the interface. Make sure to download and install the Gesture and Touch Library.

#include "DFRobot_Gesture_Touch.h"
#ifdef __AVR__
  SoftwareSerial    mySerial(/*RX*/10, /*TX*/11);
#elif defined ESP_PLATFORM
// ESP32:IO16 <--> TX:sensor
// ESP32:IO17 <--> RX:sensor
HardwareSerial mySerial(1);
#endif
// init sensor object, request write and read function
DFRobot_Gesture_Touch   DFGT(&mySerial);   
void setup()
{
  Serial.begin(115200);
  // suggest default value
  DFGT.setGestureDistance(20);
  // enable all functions
  DFGT.enableFunction(DFGT_FUN_ALL);
  // disable function test
  DFGT.disableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT);
  // enable function test
  // DFGT.enableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT);
  // set auto sleep time out, in sleep mode, something approach will wake it up
  // DFGT.setSleep(4);
  Serial.println("simple Gesture!");
}
void loop()
{
  // get an event that data saved in serial buffer
  int8_t rslt = DFGT.getAnEvent();
  if(rslt != DF_ERR)
  {
    // disable auto sleep
    // DFGT.setSleep(DFGT_SLEEP_DISABLE);
    switch(rslt)
    {
      case DFGT_EVT_BACK:
        Serial.println("get event back");
        break;
      case DFGT_EVT_FORWARD:
        Serial.println("get event forward");
        break;
      case DFGT_EVT_RIGHT:
        Serial.println("get event right");
        break;
      case DFGT_EVT_LEFT:
        Serial.println("get event left");
        break;
      case DFGT_EVT_PULLUP:
        Serial.println("get event pull up");
        break;
      case DFGT_EVT_PULLDOWN:
        Serial.println("get event pull down");
        break;
      case DFGT_EVT_PULLREMOVE:
        Serial.println("get event pull and remove");
        break;
      case DFGT_EVT_TOUCH1:
        Serial.println("get event touch1");
        break;
      case DFGT_EVT_TOUCH2:
        Serial.println("get event touch2");
        break;
      case DFGT_EVT_TOUCH3:
        Serial.println("get event touch3");
        break;
      case DFGT_EVT_TOUCH4:
        Serial.println("get event touch4");
        break;
      case DFGT_EVT_TOUCH5:
        Serial.println("get event touch5");
        break;
    }
  }
}


Gravity Gesture and Touch Sensor Applications

  • Smart Home
  • Automation
  • Touchless device control
  • Virtual reality

 

2D-Model and Dimensions

Below is the 2D CAD drawing of Gravity gesture sensor module along with its dimensions in millimetres. The dimensions can be used to create custom footprints of the module and be used for PCB or CAD modelling.

Gravity Gesture & Touch Sensor Module

Related Post



Join 20K+subscribers

We will never spam you.

* indicates required

Be a part of our ever growing community.