logo elektroda
logo elektroda
X
logo elektroda

Laser reflective sensor, lighting control

efi222 6285 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Electronic module with VL53L1x laser sensor, ESP03, LED, push button, and pin connectors on PCB.

    There is nothing groundbreaking in this mini-project, but maybe someone will find it useful.
    One day I decided to make animated stairs (steps) lighting.
    Illumination of steps sequentially up or down depending on the direction of entering the stairs. But that's not what we're talking about here.
    While the backlight control system was working properly, the trigger systems at the bottom and top of the flight of stairs needed development.
    At the beginning, the cheapest solution, i.e. PIR sensors. I will say right away that PIR in such a system is a misunderstanding. Very slow reaction time (1 - 2 seconds) and unpredictable activation zone. You can climb up to three steps in two seconds. I could not set it in any way, the more so that about 1 m from the stairs there is a home communication route.
    The next idea was an IR barrier. Amazing reaction speed. As far as I remember about 3ms from beam interruption. The disadvantage of this solution (at least in my case) was the placement of the transmitter and receiver on opposite sides of the entrance to the stairs.
    And finally I found a solution that is a compromise of response time and quite precise setting of object detection. Laser reflective sensor. The module takes about 50 measurements per second. This is sufficient to quickly start the lighting control system.

    System description:
    The VL53L1x laser module in this case works in the "short" mode (catalogue note) with a maximum range of 135 cm and communicates with the ESP03 via the I2C bus. The latter receives data about the measured distance and, based on them, sends a low or high state to the output. ESP in AP (configuration) mode is used to set the operating distance in real time, which facilitates calibration after installation of the system at the final location. Of course, the system can be extended with additional functions. Here is the basic version.

    The waveform at the GPIO01 VL53L1x output. Low status informs about the completed measurement.
    Oscilloscope screen showing the waveform of the GPIO01 output from VL53L1x with accompanying measurement data.

    Configuration menu:
    Screenshot of a laser sensor configuration panel with an activation distance set to 45 cm.

    Scheme and source code of the program.
    Electrical schematic of a reflective laser sensor using VL53L1X and ESP03 (ESP8266).

    Cool? Ranking DIY
    About Author
    efi222
    Level 19  
    Offline 
    efi222 wrote 529 posts with rating 963, helped 7 times. Live in city Toruń. Been with us since 2019 year.
  • ADVERTISEMENT
  • #2 20675652
    gradek83
    Level 42  
    Would it be possible to make this work with SUPLA?
  • ADVERTISEMENT
  • #3 20675708
    madamsz1
    Level 41  
    In GG Supli there is support for VL53L0X.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #5 20677244
    dktr
    Level 25  
    A very nice projection. I use these sensors to detect how long I sit in front of the PC :)

    A graph showing distance sensor data over time, used to monitor time spent in front of the computer.
  • #6 20678026
    efi222
    Level 19  
    Well, I would not have thought that you can register "sitting" in front of the computer :D Well, someone likes it.
  • #7 20678040
    dktr
    Level 25  
    I often forgot myself, so if I sit for more than 50 minutes, the system reminds me to take a break. Similarly, sitting in an unhealthy position, too close to the screen for a long time also causes an alarm :)
    The data from this sensor also includes other scripts for controlling lighting, power supply in other rooms, etc.

    Screenshot of a system interface showing ESP_TOF sensor data.
  • #8 20683188
    andrzej18k
    Level 13  
    Very cool idea with configuration via the browser.
    I once faced a similar problem. The solution for me were ultrasonic sensors HC-SR04.
    They are subordinated in a box soldered from a laminate oiled with veneer. The ATtiny85 handles the sensor.
    The operating range is set from 20 cm to 80 cm. It's been doing this for 3 years.

    A question for the author, maybe a very layman's one. How to make such a configuration page? Are there any generators for this?
  • #9 20683445
    efi222
    Level 19  
    I haven't heard of such GUI generators, but maybe there are :)
    The keywords for such a menu are html, CSS and if the page is to be interactive in real time, also Ajax. In other words, sending data from the page to the device without refreshing the entire page. For example, you click a button and it causes the LED in the device to light up, or some other operation.
    In this case, the displayed page is the file "configuration_sensor.h". After changing the extension to *html, you can view it in a web browser. This is typical html with a changed extension.
    Once I wrote such a fairly universal code and I change it as needed. Note that I am an amateur and I can probably do better.
    On ESP, use the ESP8266WebServer.h library.
    I suggest you trace the link between the website code and the device code. It can be a bit confusing at first :) , but with time you can master it and make your own template for different devices. Look at the design of an NTP clock or weather station. The menu is graphically identical, only the functions are different.
    And with such a GUI there is a bit of a paradox, because it almost always takes up more code than the device code :)

Topic summary

The discussion revolves around a mini-project for animated stair lighting control using sensors. The initial approach involved PIR sensors, which proved ineffective due to slow response times and unpredictable activation zones. The author then explored using an IR barrier, which demonstrated a significantly faster reaction time. Participants in the forum discussed the potential integration of the project with SUPLA, a home automation system, and mentioned the VL53L0X laser sensor as a compatible option. Other users shared their experiences with similar sensors for different applications, such as monitoring time spent in front of a computer and controlling lighting and power supply in various rooms. Additionally, there were inquiries about creating a web-based configuration interface for sensor management, with suggestions for using HTML, CSS, and Ajax for real-time interactivity.
Summary generated by the language model.
ADVERTISEMENT