ZX Distance and Gesture Sensor is mute,

Hello,

I have four ZX Distance and Gesture Sensor SMD (SEN-13162), orders number available on request, and none of them responds on I2C.

the unmodified I2C_ZX_Demo prints Error reading model version number. A raw I2C scanner using only Wire, no sensor library, finds no device at any address from 0x01 to 0x7E.

What I have ruled out:

  • The bus and master are proven good: on the same bus, two ADS1115 answer at 0x48 and 0x49 while the ZX stays silent.
  • Three different controllers, same result: Olimex ESP32-PoE-ISO, Arduino Uno, Arduino Giga R1. Tested at both 3.3 V and 5 V.
  • The wiring is ok by ohmmeter, measured from the master’s own SDA and SCL pins to VCC, I read 3.8 kΩ — the module’s onboard 4.7 kΩ pull-ups seen from the far end of the cable. VCC, GND, DA and CL are all connected, and the supply was checked at the module’s own pins.
  • Solder jumpers in factory state, library version 1.0.1.
  1. Is anything required to bring these boards up on I2C that is not in the hookup guide?
  2. Is there a known batch issue, for instance units shipped with unprogrammed PIC firmware?

Pershaps i have forgotten somethong, but i was on this problem during many hours at this time… and the example looks very simple, i don’t understand,

i have tested 3 sensors , and the problem is the same.. .

I send you pictures for the wiring for the simple exemple i followed to make it work , before i go further and also the prints i have from the console

…

Thank you very much for your help

Bertrand

22:58:23.556 -> -----------------------------------

22:58:23.588 -> SparkFun/GestureSense - I2C ZX Demo

22:58:23.621 -> -----------------------------------

22:58:23.654 -> ZX Sensor initialization complete

22:58:23.687 -> Model version: 1

22:58:23.719 -> Error reading register map version number

22:58:23.752 -> Register map version needs to be 1 to work with this library. Stopping.

The soldering looks ok…but the log posted disagrees with the " I2C_ZX_Demo prints Error reading model version number", as the serial output actually shows:

ZX Sensor initialization complete
Model version: 1
Error reading register map version number

Which means it is likely being detected, though that may be a stale log :-/

Make sure there is only one gesture sensor on the bus before powering, then power an MCU and re-test from scratch. It might be worth adding a small delay early in the sketch adding a 200–500 ms delay before the i2c scan and re-test. You might also benefit from lowering the clock speed used, but that isn’t the main issue IMO

hi,

Thanks for your answer, I did all three. One sensor only, connected before power. 500 ms delay at start, 300 ms before the scan, clock at 10 kHz.

Still nothing. Both lines idle HIGH (read on the Uno pins), so the sensor’s pull-ups are connected and it is powered — but it never answers. Same with the four sensors.

Could these have shipped without firmware? How do I get replacements?

you can see in the code below, its the example code modified :

/*

* Minimal variant of SparkFun's I2C_ZX_Demo, with the three suggestions

* from the forum applied:

*   - only one sensor on the bus, connected before powering the board

*   - a delay early in the sketch, before the I2C scan

*   - a lowered I2C clock (clock stretching)

*

* No while(1) on the version checks, so the sketch keeps running and

* reports what it sees.

*

* Arduino Uno. Serial monitor at 9600.

* Wiring: VCC, GND, DA -> A4, CL -> A5. DR not connected.

*/

#include <Wire.h>

#include <ZX_Sensor.h>

const int ZX_ADDR = 0x10;

const uint32_t I2C_CLOCK = 10000;   // 10 kHz, deliberately slow

ZX_Sensor zx_sensor = ZX_Sensor(ZX_ADDR);

uint8_t x_pos;

uint8_t z_pos;

// Plain I2C scan, no library involved.

void scan() {

    Serial.print("I2C scan:");
    
    uint8_t n = 0;
    
    for (uint8_t a = 1; a < 127; a++) {
    
    Wire.beginTransmission(a);
    
    if (Wire.endTransmission() == 0) {
    
        Serial.print(" 0x");
        
        Serial.print(a, HEX);
        
        n++;
  
    }
    
    delay(2);
    
    }
    
    if (n == 0) {
    
        Serial.print(" nothing found");
    
    }
    
    Serial.println();
  
}

void setup() {

    Serial.begin(115200);
    
    Serial.println();
    
    Serial.println("--- ZX test, slow clock ---");
    
    delay(500);                       // delay early in the sketch
    
    // Bus lines at rest, read on the pins. Both should be high.
    
    pinMode(SDA, INPUT);
    
    pinMode(SCL, INPUT);
    
    Serial.print("idle lines: SDA=");
    
    Serial.print(digitalRead(SDA) ? "HIGH" : "LOW");
    
    Serial.print(" SCL=");
    
    Serial.println(digitalRead(SCL) ? "HIGH" : "LOW");
    
    // init() calls Wire.begin() internally, which resets the clock,
    
    // so setClock() has to come after it.
    
    zx_sensor.init();
    
    Wire.setClock(I2C_CLOCK);
    
    Serial.print("I2C clock: ");
    
    Serial.print(I2C_CLOCK);
    
    Serial.println(" Hz");
    
    delay(300);                       // delay before the scan
    
    scan();
    
    uint8_t ver = zx_sensor.getModelVersion();
    
    Serial.print("model version: ");
    
    if (ver == ZX_ERROR) {
    
        Serial.println("no answer");
    
    } else {
    
        Serial.println(ver);
    
    }
    
    ver = zx_sensor.getRegMapVersion();
    
    Serial.print("register map version: ");
    
    if (ver == ZX_ERROR) {
    
        Serial.println("no answer");
    
    } else {
    
        Serial.println(ver);
    
    }
    
    Serial.println("--- reading, wave your hand ---");

}

void loop() {

    if (zx_sensor.positionAvailable()) {
    
        x_pos = zx_sensor.readX();
        
        z_pos = zx_sensor.readZ();
        
        if (x_pos != ZX_ERROR && z_pos != ZX_ERROR) {
        
            Serial.print("X: ");
            
            Serial.print(x_pos);
            
            Serial.print("  Z: ");
            
            Serial.println(z_pos);
      
        }

    }

delay(50);

}

And this is the result i have on the console

--- ZX test, slow clock ---
idle lines: SDA=HIGH SCL=HIGH
I2C clock: 10000 Hz
I2C scan: nothing found
model version: no answer
register map version: no answer
--- reading, wave your hand ---

And after , nothing, no mater what i do… gestures etc …

thanks very much for your help, i have only 10 days to have this sensor to work,

we have to ship a complete interactive installation with this sensors inside a kind of musical instrument to a festival,

so i really have to fix hthis problem …

or to have sensors, that work

Bertrand

Given the time constraints, do you want to try modifying the plan to run UART instead? It requires an FTDI but it might save time for testing/shipping

Unfortunatly it is not very handy , because we already have a shield on an esp32 poe iso, for the installation, there is only i2c on it and other stuff, but no uart, so i can try uart also this evening to see if it work but it’s not really easy to use it. perhaps, …

i don’t know,

i ll make you a reply for that :slight_smile:

and for the i2c have you got another idea, what’s happening with the sensors ?

No, unfortunately I’m sort of out of ideas other than an exchange…the default sketch doesn’t use interrupts but maybe you can try other i2c one that does (also, wire that 5th DR/data-ready wire). We haven’t had any other reports of issues :-/

If the above ideas don’t work: Was it purchased from us? If so head over to Return Policy - SparkFun Electronics (contact vendor if purchased elsewhere) and we’ll get ya squared away

TS-Russell thank you very much for your fast answers :slight_smile:

so i have tried the uart with this programm :

/*
 * uart_uno -- read the ZX sensor over UART instead of I2C.
 *
 * The sensor sends data on its TXO pin at 115200 baud, continuously,
 * whenever it detects a reflecting object. I2C and UART work at the same
 * time on this board, so this also tells us whether the sensor is alive.
 *
 * Frame format (XYZ Interactive datasheet): each message starts with a code
 * above 0xF0, followed by its payload.
 *   0xFA = X position (1 byte)
 *   0xFB = Z position (1 byte)
 *   0xFE = ranges     (2 bytes)
 *   0xFF = end of frame
 *
 * Serial monitor at 9600.
 *
 * Wiring:
 *   Uno 5V     -> sensor VCC
 *   Uno GND    -> sensor GND
 *   Uno pin 10 -> sensor TXO    (sensor talks, Uno listens)
 *   nothing on RXI
 */

#include <SoftwareSerial.h>

SoftwareSerial zx(10, 11);      // RX = 10, TX = 11 (unused)

const uint8_t ZX_X      = 0xFA;
const uint8_t ZX_Z      = 0xFB;
const uint8_t ZX_RANGES = 0xFE;
const uint8_t ZX_END    = 0xFF;

unsigned long total = 0;        // bytes received since start
unsigned long lastReport = 0;
uint8_t x_pos = 0;
uint8_t z_pos = 0;


void setup() {
  Serial.begin(115200);
  delay(500);
  zx.begin(115200);

  Serial.println();
  Serial.println("--- ZX over UART ---");
  Serial.println("Any byte received means the sensor is running.");
  Serial.println("Wave your hand in front of it.");
}


void loop() {
  while (zx.available()) {
    uint8_t c = zx.read();
    total++;

    // Decode the frame codes. SoftwareSerial at 115200 on a 16 MHz AVR is
    // not reliable, so bytes may be garbled -- the counter is what matters.
    if (c == ZX_X && zx.available()) {
      x_pos = zx.read();
      total++;
      Serial.print("X: ");
      Serial.println(x_pos);
    } else if (c == ZX_Z && zx.available()) {
      z_pos = zx.read();
      total++;
      Serial.print("Z: ");
      Serial.println(z_pos);
    }
  }

  // Byte count every 2 s, so silence is obvious.
  if (millis() - lastReport > 2000) {
    lastReport = millis();
    Serial.print("bytes received: ");
    Serial.println(total);
  }
}

and i have this result, so nothing,

--- ZX over UART ---
Any byte received meathe sensor is running.
Wave your hand in front of it.

--- ZX over UART ---
Any byte received means the sensor is running.
Wave your hand in front of it.
bytes received: 0
bytes received: 0
bytes received: 0

i wired it this way

Uno 5V       →  VCC sensor
Uno GND      →  GND
Uno pin 10 →  TXO sensor

tell me if i miss something about the uart ?

now i have spend approximatevly 8 hours trying to make this sensors work,

So i’m affraid if order new ones or if you replace it the result will be the same,

i have now , 4 units, that are mute, so i really don’t know why the next one should work ?
and the people i work with want zx sensors for the instrument, so what can i do ?

can you ensure me that if i order new ones to be faster, they can be well tested, and wil work 100% or not ?

Sorry , I don’t want to look too angry, but at this, time i really don’t know what to do… I m a bit traped .

thanks for your answers and for the next move we can do

regards

Bertrand

I apologize. I think those might be DoA and we do not have a way to test units individually before sending (in addition to the added shipping time) - I hate to say but it might be best to simply refund them (or, if you happen to have a 4th MCU it might not hurt to try except for more potential wasted time & effort on your end if nothing changes… Do other sensors work well with the setup?)

:frowning:

Were they purchased from us? If so head over to Return Policy - SparkFun Electronics (contact vendor if purchased elsewhere) and we’ll get ya squared away

Thanks for your honesty, I appreciate it.

The installation currently runs with two ZX sensors and we are building a v2, so I need something working quickly. I will look for another solution.

I would like a refund for these units rather than a replacement. They were purchased from you — could you tell me the steps? Order numbers on request.

Thanks again for your time,
Bertrand

Simply click that blue ‘returns’ link above to file an RMA and you can put a short description stating you’d like a refund for 4x of 'em for being defective and that we’ve completed troubleshooting here on the forums…attaching a link to this thread in the description can help a bit on their end :slight_smile:

Best of luck with the rest of the project!