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.
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.
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”.
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.