Using the 3D Gesture Sensor

3D gesture sensor

I recently got my hands on a 3D gesture sensor from DFRobot and honestly, my brain is ringing with the possible projects I can do with it. Basically, it is a device that can sense hand movements in different directions. Imagine controlling anything just by waving your hands! Let's get a closer look after the jump.

How 3D Gesture Recognition Work

The process seems magical at first but everything is explained with the help of electromagnetic theory. Let’s look at this diagram below:

This diagram is from the datasheet of MGC3130 which is the driving force behind DFRobot’s sensor module. As you can see, the electric field at the surface of the sensor maintains a distinct pattern with no conductive material (such as a human hand) is present. When the hand goes near the sensor, the electric field is distorted and the field lines are drawn to the hand. Four receiving electrodes detect this distortion and attraction of the field lines, determining the position of the hand, tracking its movements, and even classifying the movement pattern.

DFRobot’s 3D Gesture Sensor

As mentioned, DFRobot’s 3D gesture sensor contains the MGC3130 IC with added external circuitry and electrodes:

The electrodes are grouped into five: up, down, left, right, and center. The sensor can determine which direction is your hand moving, whether in a straight line or circular.

Here is an example application of the sensor: controlling a servo motor:

Using the 3D Gesture Sensor with Arduino

The sensor communicates via I2C which is a good thing because we will only need a few wires and the sensor can use either 3.3 V or 5 V. Here is an example wiring diagram with the Arduino UNO:

As for the sketch, you’ll need the 3D Gesture library first.

The library contains two example sketches, one that gives out the hand movement and another that makes the sensor work like a proximity detector.

Here’s the example sketch on gesture recognition:

#include <DFRobot_Gesture.h>
#include <Wire.h>

int testPin= 7;
unsigned char cmd;

DFRobot_Gesture myGesture;

void setup()
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  pinMode(testPin, INPUT);  
  Serial.write("3D Gesture sensor is now running....\r\n");  

void loop()
    myGesture.I2C1_MasterRead(md.buf,26,0x42); //The address is:0x42
    cmd = myGesture.mgcProcMsg();     //process the message
          if(cmd != GI_NOGESTURE )
                    case GI_FLICK_R:

                    case GI_FLICK_L:

                    case GI_FLICK_D:

                    case GI_FLICK_U:

                    case GI_AIRWHEEL_CW://Clockwise in circles

                    case GI_AIRWHEEL_CCW://Counterclockwise circles

                    default: break;
 else  {};


Upload this sketch to your Arduino UNO using the wiring diagram shown above. Then, open the Serial Monitor and move your hands above the sensor electrodes. The monitor should display your movements (e.g. LEFT, RIGHT, CCW, etc.).

In Conclusion

While this sensor would be a great addition to a maker's collection, it is hard to find an actual industrial application for it; I think the size and sensitivity of this sensor is not that conducive for such environments. Nevertheless, makers will have fun with this sensor.

Also Read: What is a Transducer Used For?

Leave a Reply

Your email address will not be published. Required fields are marked *