LiDAR sensor not seeing through car windshield

Hello,

I've been working on a car sensor, to be mounted like a windshield GPS, incorporating both an accelerometer (GY-521 MPU-6050) and LiDAR sensor (TFmini Plus) and have been unable to have it get distance readings of the car in front of me when the device is sitting behind the windshield -- even if it's been cleaned. (Edit: By "unable to get readings", I mean that 0's are coming back for the sensor's distance reading.) Is this an inherent limitation of the sensor I'm using? If so, are there other sensors or better versions of the LiDAR sensor that I should use instead? I've considered placing the LiDAR itself outside of the car, near the license plate, and running four long(er) wires (9-10 ft. in length) back to the cabin where the Arduino is, but I've run into different issues with that approach.

First post here, so please let me know if the post's category is wrong or if more information (code, sample output, wiring, etc.) would be helpful!

1 Like

Your glass may be transparent at visible wavelengths, but reflective of IR.

I see. Does that mean that some of the newer cars with sensors near the rearview mirror have that small portion of the windshield transparent to IR?

This is indeed the case. UV block and IR block are built into the layers of safety glass to protect your eyes and reduce the sun's ability to heat the interior of your car.

What year was the car made?

It's a 2015 Honda Civic

Then that is most likely the case. Though you should post your setup so other can look for wiring and software issues. Try it elsewhere and see if it works as expected.
Perhaps you can mount the LIDAR array so it fires through the grill?
You can always mount it in a waterproof container that is IR transparent.

Also. do you have an IR transmitter and receiver perhaps?
You can use those to check your windshield.

Our 2013 VW Jetta has tinted windshield. They use tin particles for the tinting and this severely limits RF. Our 433 MHz gate controller only works really close up the gate if through the windshield. But if pointed through a door window, works from 40-50 ft.
Paul

Separating the transmitter diode from a spare remote and placing it in front of the radiator might be a fun project. Or just building one from scratch and learning the pattern from the current remote as an alternative.

I had tried that in the past -- specifically, nestling it within the top half of the "H" brand logo -- but when I use the four 9-10 ft. wires to connect it back to the Arduino in the cabin, I run into other issues. I thought I'd make another post to ask that question.

I do like that idea though if there aren't other practical options for distance-measuring sensors.

A logic buffer can boost the signal. I am not sure if the timing will come into play on a wire that long.
Not sure that you need a new post as it's part of the same issue and they don't like cross-posting here.

Okay, in that case, below is the diagram:

And here's an actual picture. Struggled finding an angle that's super helpful. (Ignore the servo motor & its orange/brown/red wire on the right.)

Are you powering this through the Arduino's USB port?

Yup, which then connects to my laptop so I can collect the accelerometer & LiDAR data.

Do you have a link to the data sheet for the LiDAR sensor?

Also, please post your code.

Here's the data sheet: https://acroname.com/sites/default/files/assets/sj-gu-tfmini_plus-01-a04-datasheet_en.pdf

Code's below:

#include<Wire.h>
#include<SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);

unsigned long time;
const int MPU_addr = 0x68; // I2C address of the MPU-6050
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;
int16_t Force;
int dist;   //actual distance measurements of LiDAR
int strength;   //signal strength of LiDAR
float temprature;
int check;   //save check value
int i;
int uart[9];   //save data measured by LiDAR
const int HEADER = 0x59;   //frame header of data package


void setup() {
  // put your setup code here, to run once:
  
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);

  Serial.begin(9600); //set bit rate of serial port connecting Arduino with computer
  Serial1.begin(115200); //set bit rate of serial port connecting LiDAR with Arduino
  
  Serial.println("time|AcX|AcY|AcZ|dist|strength");

}

void loop() {
  // put your main code here, to run repeatedly:

  if (Serial1.available())
  {
    if(Serial1.read()==HEADER)
    {
      uart[0]=HEADER;
      if(Serial1.read()==HEADER)
      {
        uart[1]=HEADER;
        for(i=2;i<9;i++)
        {
          uart[i] = Serial1.read();
        }
        check = uart[0] + uart[1] + uart[2] + uart[3] + uart[4] + uart[5] + uart[6] + uart[7];
        if (uart[8] == (check & 0xff)) //verify the received data as per protocol
        {
          dist = uart[2] + uart[3] * 256; //calculate distance value
          strength = uart[4] + uart[5] * 256; //calculate signal strength value

          Wire.beginTransmission(MPU_addr);
          Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
          Wire.endTransmission(false);
          Wire.requestFrom(MPU_addr, 14, true); // request a total of 14 registers
          AcX = (Wire.read() << 8 | Wire.read() / 16384) / 163.84; // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
          AcY = (Wire.read() << 8 | Wire.read() / 16384) / 163.84; // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
          AcZ = (Wire.read() << 8 | Wire.read() / 16384) / 163.84; // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
          Tmp = Wire.read() << 8 | Wire.read(); // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
        
          time = millis();
          Serial.print(time);
          Serial.print(" | ");Serial.print(AcX);
          Serial.print(" | ");Serial.print(AcY);
          Serial.print(" | ");Serial.print(AcZ);
          Serial.print(" | ");Serial.print(dist);
          Serial.print(" | ");Serial.println(strength);
          delay(250);

        }
      }
    }
  }
}

I'd remove the other sensor for the moment and make a new program that just tests the LiDAR, then verify that you can get proper readings first (not through the windshield).

Just to be sure.

I’ve run that code with the current setup (accelerometer included) and it appears to work. Moving my hand towards & away from the LiDAR sensor is reflected in the outputted data. It’s just that the second I mount it in my car behind the windshield the distance readings go from something non-zero to zero.

Excellent, then you have the issue in hand.
Best suggestion is the first.

Let's explore this then. Please explain the other issues.

Edit: you may have to slow down the baud rate of the sensor and the matching serial connection. The default setting for the UART connection is 115200.

Try this library which will help you lower the baud rate.