Help needed for Laser Rangefinder for PTZ cameras

Hi All,

This is my first post. I have been using HA for a while now and my latest project is going to be using a laser rangefinder like this: https://www.robotshop.com/uk/sf30-c-laser-rangefinder-100m.html to control three PTZ cameras along a 100m access road.

I already have HA controlling the PTZ cameras by using REST commands to change their position, now I would like to use a rangefinder to tell HA how far along a 100m road a car is and move the PTZs to any of 10 zones to “track” it.

I am thinking I will need to use an arduino to take the PWM input from the rangefinder and output to one of 10 pins that will be connected to a NodeMCU for HA. The arduino will output pin 1 if the vehicle is 0-10m away, pin 2 if it’s 10m-20m away etc.

I would appreciate any advice anyone could give me especially as the rangefinder is 5v and the NodeMCU is 3.3v.

Thanks in advance,
Ben

That seems overly complicated. Without reading the documentation in detail, why not connect it to a esp8266 of esp32 through a logic level shifter and output the distance, rather than a range. BTW esphome seems a good place to start.

Thanks for your suggestions. Would you mind elaborating as I have no experience with esphome? How would HA read the distance and react to it?

I have read the specifications of the sensor and it says: “The analog interface on the main connector produces a linear voltage of between 0.00 V and 2.56 V that is proportional to the
measured distance”.

Can I just connect this to A0 on a NodeMCU?

Thanks

I believe you could, but you’d need a voltage divider as A0 reads voltage between 0 and 1.0v.

https://esphome.io it is probably a bit to get your head around, but it is a programming framework to program an esp8266 or esp32 to end up with a device that will read sensors, respond to attached switches and integrate with home assistant, and indeed anything that uses mqtt. You simply write a yaml file, click upload, and it writes a completed firmware to your device.

An analog sensor example is here https://esphome.io/cookbook/temt6000.html.

I have to say that device you pointed to is very expensive! There may be cheaper alternatives. I’ll look around.

Thanks. I really appreciate your help

Not on the Wemos D1 mini. It takes in 0-3.3V on A0. ESPHome scales it to 0-1V.

The NodeMCU-32 can take up to 3.9V using the built in attenuator (ESPHome supported).

Hi,

I have found this much cheaper 100m rangefinder: https://www.unmannedtechshop.co.uk/product/benewake-tf03-lidar-led-rangefinder-ip65-100-m/

It outputs “Hexadecimal distance value; Character string;” via UART

What would my options be for connecting this to a esp8266?

Thanks

I have no idea how you monitor the incoming data for your string though.

I can’t find an arduino library for it. It is available from sparkfun and others.

You are right of course.

As for the benewake, this article shows how to get data - it uses one of their shorter range models, but it seems to use the same protocol. https://www.instructables.com/id/Benewake-TFmini-Inexpensive-LiDAR-With-Teensy-35/