This sensor module integrates gesture recognition and touch detecting functions in one piece, and provides an adjustable detection range within 0~30cm. When connected to your microcontroller, it can detect 5-way touch signal and 7 kinds of gestures: move left, move right, move forward, move backward, pull up, pull down, pull and remove.

Besides, the sensor is also equipped with the function of auto-sleep and wake up. The module comes with the gesture recognition algorithm and provides simple and reliable data output. Use the sensor to directly communicate with upper computer or micro-controllers like Arduino and Raspberry Pi via serial port.

It works on the principle of infrared detection, the hand motion is monitored using an infrared led and sensing system. The infrared light strikes with hand and go to the sensing unit for proper interpretation. Infrared (IR) light is comes in invisible spectra and the sensor used in this mechanism is very selective because IR is also present in the sunlight that's why sensor is less effective in outdoors.

Application of gesture and touch:

The onboard 5-way touch pad on the sensor can be directly used to detect touch, or you can extend the touch pad with wires to make it perfectly fit in your application. The outer shield for the sensor retains the advantages of Gravity series as well as makes the sensor more durable. This sensor can be used to make smart lamp, DIY intelligent car, or used in interactive projects requiring gesture recognition.


  • 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
  • Serial Protocol Format: 9600 band rate; 8 data bits, no parity bit, 1 stop bit


Abnormality might occur when using the module in strong sunlight condition due to its working principle;

When powered down, the sensor will be initialized automatically and the previous setting will be invalid.

When sending byte continuously, there should be at least 200us time interval between the end of the last byte and the starting of the next byte; The sensor can receive/transmit data only in working state, while for processing data, we must make the sensor stay in non-working state. That is to say, if there is an object over the sensor when receiving/transmitting data, we need to move it away for completing the following settings.

Normal Settings and functions:

  • Default function when powered on: no sleep, 5-way touch, detecting height: 15cm.
  • The default detecting height is 15cm, higher height detection needs to be set by yourself.
  • Keep a normal speed when gesticulating to let the sensor better understand your gesture.

Code functions:

1) Set the sensing height (default 20cm when powered on)

Example: DFGT.setGestureDistance(20);---Unit(cm) Max height: 30cm

 2) Set the sleep enablement or enter auto-sleep mode (sleep mode disabled when powered on)

Example: DFGT.setSleep(4);---unit(s)

3) Set gesture sensing enablement (all the seven gestures can be recognized when powered on) 

Example(1) DFGT.enableFunction(DFGT_FUN_ALL);---enable all gestures sensing fuction

Example(2) DFGT.disableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT);---disable sensing function of part gestures

Example(3) DFGT.enableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT);---enable sensing function of part gestures

Components Required:

  • 220ohms resistor
  • Breadboard
  • Custom PCB design from JLCPCB

Circuit diagram:

The 4 red LEDs are connected to the digital pins of the Arduino NANO. The gravity sensor is connected to the digital pin 10 and 11. Rx of the sensor is connected to the Tx pin and Tx of sensor to Rx which is defined in the software serial of the Arduino. Different tasks are assigned to the LEDs based on the actions and functions defined in the Arduino program. The connections are very simple, to power up the circuit an external...

Read more »