ESP32 build an optical/light barrier

Hi everyone,
I would like to make a laser barrier like the one in this project,


but instead of the Arduino uno board I would like to use an Esp 32 wroom
with Home Assistant’s ESPHOME, do you think it is
possible?, thanks

Yes it is possible.

thanks, could you tell me the parameters to insert in esphome to make them work?

Not without knowing about your sensor.

my sensor is an AM312AM312

That’s a PIR not a break beam sensor. It does not need an illumination source, it works passively by detecting moving infrared signals emitted from bodies.

sorry so much, that is for another project, the sensors are these,
Laser Transmitter Module KY-008
Laser Receiver Sensor Module


Thank you

Instead of thinking about the sensor or whatever it Is and overcomplicating it, thinnk about what it does. So, it’s a laser and when it’s beam is broken it acts like a switch which is on or off. That’s all this is a fancy way of triggering a switch and it sends a signal to the esp board that sais On or Off just like the switch on the wall. In esphome this is called a binary sensor or an ON/OFF sensor. If you look on their website there is a section for how to make a binary sensor.

Going to need more detail than that to determine how to interface it to the ESP GPIOs. Part number? Website link? Datasheet?

I am afraid that the laser module will not have a long life.
I read somewhere that it is not suitable for continuous operation.
The 5mW module needs cooling after 10 hours of operation for 1 hour of shutdown to guarantee the maximum lifetime specified by the manufacturer.
It could be solved with two modules that will light up in one place and switch over time.

thanks to all for the replies, now I have clearer ideas, I will follow your advice, thanks again

I have just done something similar using a V53L0x time is flight module and got good results up to 750-800 mm.

I ended up going with a cheap Ali Express Reflective Photoelectric Switch which works very well over the distance I need and even operates fine from 3.3V.

1 Like

hi Tom, these are the laser modules links, thanks.