Unable to use LIDAR sensor with Photon Shield Shield

Hello everyone,

I’ve just bought a super-cool Shield Shield. I’m currently looking to connect a LIDAR sensor to it.

Currently, I have the LIDAR sensor connected to the 5V output and ground. What I would like to do is get a continuous reading (every second) to display in the serial monitor. I currently have the Shield Shield powered by USB, with the monitor and trigger pins connected to pins 12 and 11 on the Shield Shield, respectively. They map to D3 and D2 on the Photon respectively, according to https://docs.particle.io/datasheets/particle-shields/#shield-shield-pin-mapping

However, I can not get a reading from the Photon to appear in my serial monitor (the returned pulseWidth is always 0). Does anyone know why this might be the case?

Previous testing:

  1. I connected the 5V and ground pins to an Arduino, and connected the monitor and trigger pins to the Photon (without the Shield Shield) at D3 and D2 respectively, and was able to get an accurate reading Photon’s serial monitor.
  2. I connected the 5V and ground pins to the Photon’s Shield Shield (powered by USB), and connected the monitor and trigger pins to an Arduino at D3 and D2 respectively, and was able to get an accurate reading on the Arduino’s serial monitor.

My code:

SYSTEM_MODE(AUTOMATIC);
#include "application.h"

unsigned long pulseWidth;

void setup()
{
  Serial.begin(9600); // Start serial communications
  pinMode(D2, OUTPUT); // Set pin 2 as trigger pin
  pinMode(D7, OUTPUT);
  digitalWrite(D2, LOW); // Set trigger LOW for continuous read
  pinMode(D3, INPUT); // Set pin 3 as monitor pin
}

void loop() {
    
      pulseWidth = pulseIn(D3, HIGH); // Count how long the pulse is high in microseconds
      
    Serial.print("pulseWidth ");
    Serial.println(pulseWidth);
    // If we get a reading that isn't zero, let's print it
    if(pulseWidth != 0) {
        pulseWidth = pulseWidth / 10; // 10usec = 1 cm of distance
        Serial.println(pulseWidth); // Print the distance
        digitalWrite(D7, HIGH);
        delay(500);
        digitalWrite(D7, LOW);
    }
    delay(1000);   
}

Thanks in advance!

Are your LIDAR connected to ground and 5v on The shield shield? Can you take a picture so we can see your wiring?

Yes, it is connected to both the 5V and ground pins on the Shield Shield.

Please disregard the green LED on the Photon. Sometimes it disconnects/reconnects to my router.

Any ideas you have would be much appreciated!

D2 - 11 on Shiedl Shield does not look connected to LIDAR.

It is via this ominous resistor, but I don’t quite understand how this is supposed to work.
D2 (via the resistor) and D3 are connected to the same yellow LIDAR wire and D2 is permanently kept LOW so how would the LIDAR create a clean HIGH on D3?

@zerous The yellow wire is connected to pin 12 and the red wire is connected to pin 11, according to page 3 of the datasheet:

@ScruffR From the datasheet:
“Pulling the mode control pin low will trigger a single measurement, and the device will respond by driving the line high with a pulse width proportional to the measured distance. A 1k ohm resistor is required to prevent bus contention.”

It’s hard to see, but is this really a 1k resistor there?
It looks like 100Ohm to me.

Does this mean pull and hold LOW or pull and let go?

I can confirm it is a 1000 Ohm resistor.

According to the datasheet, it also doesn’t seem to matter how long the device is pulled LOW for. Pull and let go results in a single measurement, whereas a held LOW results in repeated single measurements (i.e. multiple measurements).

I’m still unsure as to why it still won’t work with the Shield Shield, though. I’m pretty sure I have it all plugged in correctly, it just won’t register a reading.