ZX Distance and Gesture Sensor

The ZX Distance and Gesture Sensor is a touchless sensor that is capable of looking for simple gestures. Developed in conjunction with XYZ Interactive, the sensor uses their GestureSense® technology to recognize the distance of an object away from the sensor up to about 10 inches (~25cm) and the location of the object from side to side across the sensor in about a 6 inch (~15cm) span. You will be able to use I2C or UART to communicate with the ZX Sensor via an Arduino-based microcontroller as well as a computer.

On board each ZX Sensor you will find two IR LEDs (inside the brass tubes) and one IR receiver (in the middle). The brass tubes that protect the IR LEDs are actually to block any infrared light going directly from the LEDs to the receiver (we want the light to bounce off an object first). With these IR pieces you will easily be able to ascertain both the Z axis and the X axis of an object (hence the name). In addition to providing Z- and X- axis data about an object, the ZX Sensor is also capable of detecting simple gestures. We have also clearly labeled all the pin outs on the board as well as signifying if they are needed in I2C or UART communication.

Note: Be sure to check out the Hookup Guide in the Documents section below for instructions on how to get your ZX Sensor started, load the code and library, and a list of supported gestures.

  • Operating Voltage: 3.3V - 5V
  • Z-Axis Recognition Range: 10 Inches (~25cm)
  • X-Axis Recognition Range: 6 Inches (~15cm)
  • 4 Supported Gesture Commands
  • I2C or UART Communication

ZX Distance and Gesture Sensor Product Help and Resources

I2C Communications Error

If you see this error output using the I2C_ZX_Demo.ino code:

SparkFun/GestureSense - I2C ZX Demo
ZX Sensor initialization complete
Error reading model version number
Model version needs to be 1 to work with this library. Stopping.

Make sure that you are connected to the I2C pins correctly. If you have any loose connections, you will have issues communicating with the sensor through I2C. If you are using an Arduino Mega, make sure that you are connecting to the correct I2C pins https://www.arduino.cc/en/Reference/Wire .

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1 Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels

Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

3 Programming

Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels

Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

2 Electrical Prototyping

Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels


Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #944768 / about 7 years ago / 1


    Someone knows where I can find the Fritzing file of this sensor? I can not find it anywhere.

    Thanks in advance !

  • Member #822248 / about 8 years ago * / 1

    Hi Shawn or any one else could offer me this help,I would like to use ZX Distance and Gesture sensor (I2C protocol) to get the Z-pos streamed at the highest sampling rate. But I'm wondering Is this feature (continuous streaming) feasible with this hardware? What would be the maximum sample rate? Are you aware of any Arduino-like library that does the job?Any suggestions would be very much appreciated, thanks in advance!

    • The ZX sensor provides up to 50 X and Z coordinate samples per second, so it refreshes every 20 msec. What you could do is check the I2C status register of this sensor for new data at a polling rate that exceeds 50 Hz. Another approach is to check the Data Ready or DR line of the sensor (in the I2C group next to DA and CL) for a HIGH reading indicating new data. If you go to the GestureSense.com website we can provide you with a simple script to do I2C polling for this data.

    • The folks at XYZ Interactive wrote the firmware for the sensor, so I don't know the refresh rate. However, I will try to find out. The Arduino library listed in the Documents section should get you started.

  • Member #804923 / about 8 years ago / 1

    Can someone confirm the max distance for gesture sensing?

  • I'm wondering if you would suggest this module for use as a proximity sensor. I'm racing RC cars and want a pre packaged device for measuring when they pass a checkpoint. Lighting conditions will be bright daylight.

    • It works well as a proximity sensor, but keep in mind that it can only sense objects up to about 1 foot away. If the RC car is beyond that, it won't detect it.

      • Thanks for the help! They will follow a strict bottleneck near the checkpoint so I don't think this will matter. Best.

  • BBB / about 8 years ago / 1

    how much power does this thing draw?

  • Member #690643 / about 8 years ago / 1

    What is the smallest distance this sensor can read?

  • Member #103000 / about 8 years ago / 1

    I recently tried this sensor and get very erratic readings from the X axis, but the Z axis seems fairly stable. If I use a narrow object, like a finger instead of my palm, it seems slightly better, but still too erratic to drive a feedback control loop. I'm using the I2C interface, for what that's worth. Has anyone else seen this behavior, or know what might cause it?

    • There have been a few sensors where one of the brass LED shield caps have come up slightly (you can check by looking at the board from the side - see if one of the brass caps is slightly lifted from the board). This causes IR light bleeding from the LED to the sensor and messing up the readings. If you think this is the case, I recommend talking to our Tech Support, and they'll help troubleshoot the problem and get you a new one if necessary.

  • Electrumpet / about 9 years ago / 1

    Did anybody measure the actual latency of this product? It seems a little slow in the video but that can be the video update as well. How long will it take before a change in distance is visible in the I2C (or UART) connection?

  • Member #739507 / about 9 years ago / 1

    I got the error "Error reading model version number. Model version needs to be 1 to work with this library. Stopping." Does anyone can help me with this? Thanks!

    • Sounds like it is either a wiring issue or you have a bad ZX Sensor. I recommend contacting Tech Support. They should be able to help you and get a replacement if necessary.

      • Member #739507 / about 9 years ago / 1

        Thanks for replying! But actually I ordered two of them, and both of them returned me this error

        • Double-check your I2C wiring. That error returns if there is a problem communicating with the ZX Sensor over I2C. Also, which microcontroller board are you using?

          • Member #739507 / about 9 years ago / 1

            And I've tried both arduino Uno and Mega, and got same error

          • Member #739507 / about 9 years ago / 1

            Yes I did notice in the tutorial that I can set those jumpers at the back of the sensor. Do I need to change them from the default status? Thanks

            • No, you should not need to change them. If you haven't had much luck with either sensor on the Uno or Mega, definitely reach out to tech support. They can help you figure out what's going on.

  • Member #406006 / about 9 years ago / 1

    After using this sensor, I noticed that it will not work through a clear glass or acrylic window. If I only place a window over the detector at the center, it still works fine, however when a place a window in front of either LED it will nor work. The LEDs emit at about 950nm, so they should transmit through glass and acrylic well enough. Does anyone know what the issue is, or how to get around it?

  • tedspark / about 9 years ago * / 1

    EDIT: looked at the datasheet for the receiver and it uses pulsed light so I answered my own question. "Does this use pulsed light to discriminate against ambient light or is this sensitive to ambient light? Can it be used out in the sunlight?"

  • Macman1223 / about 9 years ago / 1

    Could I have the dimensions for the brass caps used so I could 3d print a replacement? I got this in a Ding and Dent production build, and it shipped without them(along with a missing part which was the reason it was a ding and dent)

  • Member #716655 / about 9 years ago / 1

    Hi, I purchased this sensor. I have followed the guide. i installed the downloaded demo from the tutorial. the zx I2C demo works. i can see the numbers changed when my hands are detected but using the interrupt demo, it can't recognize gesture. it keeps saying no gesture. help please..

    • Just to make sure, are you connecting a wire from DR (on the ZX Sensor) to pin 2 on the Arduino? If you are still having issues, I recommend reaching out to our Tech Support staff who can help troubleshoot your specific issue.

  • CitoNinja / about 9 years ago / 1

    I wish I could post pictures on here. I used this sensor to create a gear indicator for a 5 speed manual transmission. I'm using it to help teach my wife how to drive a manual.

    • Sweet! I definitely recommend creating a project and uploading some photos to Hackster. We're...exploring some sharing options, but you can at least share the link of your project here :)

      • CitoNinja / about 9 years ago * / 1

        I'll check it out... Started the project... I'll have to complete it later... https://www.hackster.io/CitoNinja/shift-indicator

  • Hi, how long you say this sensor would last? I will use it 7x24. Do you know the Life Expectancy of this product? LEDs have a general life expectancy of 50.000 hrs, is that correct? Thanks

    • There should not be any issues running the sensor 7x24. I've tested it for a few hours, but I have no way of determining the life expectancy. The LEDs are TSAL6100s, if you would like to look into their life expectancy (it is not listed in the datasheet).

  • Member #421734 / about 9 years ago / 1

    Hello, Your product I think is very interesting. Currently I wanna create a head display like Oculus or Samsung Gear, and I wonder if this product could work like Leap Motion or Kinect for gesture control. My project is based in Android. Could you give me information about this? Where do I can get tutorial or information for my project with the use of this product?

  • myHalici / about 9 years ago / 1

    One of three boards burned today. I simply connect it to arduino, morning, some testing, And at evening, dont work.

  • Rick Chung / about 9 years ago / 1

    Would it be possible for Sparkfun to provide a more detail information about the I2C register map and data format? Seems the manual from the upon link focus on the UART mode usage, and there's no way to find the "GestureSense ZX Sensor I2C Register Map spreadsheet" shown at the end of the manual : )

  • Very simple and nice quality. Small form factor is great too!

  • Member #421734 / about 9 years ago * / 1

    Hello, this sensor could work in a device Android ARM?

    • As long as you can communicate over UART or I2C from the ARM, then you can use this sensor. The library used in the hookup guide was written for just Arduino, but it should not be very difficult to port to ARM.

  • RobotRacer / about 9 years ago / 1

    Is there any issue with having two or more of these units in close proximity with each other?

    • For the most part no. We have seen multiple sensors on the same device used in Hackathons and other projects without issue. What kind of configuration were you thinking of?

      • tedspark / about 9 years ago / 1

        or the most part no. We have seen multiple sensors on the same device used in Hackathons and other projects without issue. What kind of configuration were you thinking of?

        How about an array of 3 of them on the front of a robot for obstacle detection?

  • Brother Theo / about 9 years ago / 1

    Excellent product! I wonder, will there be an XY version?

    • We are working on a version of the same sensor design with three emitters. This will give XY and Z, as well you can do circular gestures, and other cool features. What do you have in mind?

      • diz / about 9 years ago / 1

        I want to use one as a replacement for a touch interface for a pcDuino running Android in my shop. The most applicable use would be moving through a document (such as a PDF) being displayed on the LCD TV in my shop by using gestures. I recently picked up a ZX and a Leap Motion. I'll soon see how well each is up to the task. I may use both of them.

  • Member #390482 / about 9 years ago / 1

    What's the maximum sensing distance?

  • bwhitman / about 9 years ago / 1

    Does anyone know the minimum sensing distance of this?

  • Could you hook up an OpenLog board directly to it?

  • Member #453216 / about 9 years ago / 1

    Any thoughts on embedded this in a waterproof enclosure of some sort? I have an awesome use case for this sensor, but it's outdoors and I'm not sure if there would be interference from an enclosure.

    • So long as the piece over the LEDs and receiver is clear, it will work just fine (I just tried it with some clear acrylic). If it gets dirty or something causes reflection back into the receiver, it will start to work less effectively.

      • Member #453216 / about 9 years ago / 1

        Awesome! That's exactly what I was hoping for. I'm ok with dirt ruining things, if the user lets their device get dirty it's not surprising that a light based sensor would stop working... :)

  • Mure / about 9 years ago * / 1

    Nice looking product. I was wondering, how does this work actually? How does the sensor measure distance, by measuring how much time it takes for light to travel and bounce back after transmitting? Is this PIC on board fast enough to do that? Or the receiving TSOP is some kind of analog type, which outputs received signal strength that PIC interprets to distance. There is no Datasheet for this TSOP, you didn't provide good document. The X-motion is easy to understand once Z-axes is understood :-)

    Edit: I just read from schematics that this is the TSOP used: http://www.vishay.com/docs/82434/tsop572.pdf and it outputs digital information, not analog. From this it must be that they are measuring time of flight, of the light :-) Correct?


    • It's most likely just tracking the amount of power it takes for the IR receiver to detect the signal (by varying the LED power with the PIC DAC); the power required corresponds to the distance to the object. This is done with each LED separately and then the results are combined to calculate the X and Z positions.

      • Mure / about 9 years ago / 1

        Wow I didn't see it that way, but that's excellent! Thanks!

    • It's actually the BRM-2A18 (the TSOP is an optional SMD part that was not used). But yes, you are correct, the receiver demodulates the 38 kHz IR signals and sends that information to the PIC. It's the same type of IR receiver used in TVs and other AV equipment.

Customer Reviews

4.5 out of 5

Based on 4 ratings:

Currently viewing all customer reviews.

3 of 3 found this helpful:

This thing makes a very cool RGB light switch. Very cool !!!

I started testing this ZX sensor with my Arduino and wired to an RGB LED to control switching and colour changes. The gestures can switch the device and the depth changes can control colour. I can't do this with any single device any other way. Love it. Thanks !!!

2 of 2 found this helpful:

Sensor Works Great

Works exactly how I wanted it to. I did notice that Voltage changes have an effect on the distance readings.

Thank you SparkFun and Maker community

We have tested out both the delivery and support from SparkFun on these sensors and are very happy. We have also sponsored some Hackathons and continue to be impressed with some of the creative applications of our sensor technology that is coming from the crowd. If anyone has suggestions for improvements or additions to future sensor modules, please send to makers@xyzinteractive.com

Good at distance, side-to-side is a little sketchy.

Very easy to setup, managed to get it working on the FreeSoC2 and used the distance reading to set the frequency of a generated tone. Returned distance value is nonlinear, more resolution farther from the sensor. I tested the raw readings for side-to-side and it was a little hard to predict when the sensor would start reading my hand, however the fact that it can do it at all, especially at this price, is a decent reason to get one.