logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Laser reflective sensor, lighting control

efi222 6981 8

TL;DR

  • A staircase lighting trigger uses a VL53L1x laser reflective sensor with an ESP03 to start sequential step illumination when someone enters from the top or bottom.
  • The VL53L1x runs in short mode over I2C, and the ESP03 compares measured distance against a set threshold, then outputs low or high to control the lighting.
  • The module makes about 50 measurements per second, with a maximum short-mode range of 135 cm.
  • An AP configuration mode lets the operating distance be calibrated in real time after installation, and the basic system includes the sensor waveform on GPIO01.
  • PIR sensors reacted too slowly at 1–2 seconds, and an IR barrier was fast at about 3 ms but awkward because the transmitter and receiver had to sit opposite each other.
Summary generated by AI based on the discussion content.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • 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).
    Attachments:
    • Czujnik_laserowy_schody_VL53L1x.zip (4.65 KB) You must be logged in to download this attachment.

    Cool? Ranking DIY
    About Author
    efi222
    Level 22  
    Offline 
    efi222 wrote 770 posts with rating 1211, helped 12 times. Live in city Toruń. Been with us since 2019 year.
  • ADVERTISEMENT
  • #2 20675652
    gradek83
    Level 43  
    Posts: 9105
    Help: 929
    Rate: 2097
    Would it be possible to make this work with SUPLA?
  • ADVERTISEMENT
  • #3 20675708
    madamsz1
    Level 42  
    Posts: 5861
    Help: 1053
    Rate: 1702
    In GG Supli there is support for VL53L0X.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #5 20677244
    dktr
    Level 26  
    Posts: 937
    Help: 45
    Rate: 729
    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 22  
    Posts: 770
    Help: 12
    Rate: 1211
    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 26  
    Posts: 937
    Help: 45
    Rate: 729
    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  
    Posts: 49
    Help: 2
    Rate: 25
    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 22  
    Posts: 770
    Help: 12
    Rate: 1211
    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 :)
📢 Listen (AI):

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 AI based on the discussion content.

FAQ

TL;DR: For DIY stair-lighting builders, a VL53L1X running at 50 measurements per second is a practical trigger choice: "PIR in such a system is a misunderstanding" because its 1-2 s delay and loose zone react too slowly, while the laser sensor gives fast, adjustable entry detection through an ESP03 setup page. [#20674854]

Why it matters: The thread shows how to get faster, more precise stair-entry detection without the placement problems of a classic IR barrier.

Option Reaction / update Practical range in thread Main drawback or benefit
PIR sensor 1-2 s Not stated Slow and has an unpredictable activation zone
IR barrier Approx. 3 ms Beam crossing Very fast, but needs transmitter and receiver on opposite sides
VL53L1X laser reflective sensor 50 measurements/s Up to 135 cm in short mode Fast enough and easier to calibrate after installation
HC-SR04 ultrasonic Not stated 20-80 cm used Worked reliably for 3 years in one build

Key insight: For animated stair lighting, the best trigger in this thread is the one you can calibrate in place. The VL53L1X wins because it balances speed, adjustable distance, and simpler mounting than an across-the-door IR barrier.

Quick Facts

  • The VL53L1X is used in short mode with a stated maximum range of 135 cm and communicates with the ESP03 over I2C. [#20674854]
  • The module updates at about 50 measurements per second, which the author considered fast enough to start sequential stair lighting promptly. [#20674854]
  • A classic PIR trigger reacted in 1-2 seconds, while the earlier IR barrier reacted in about 3 ms after beam interruption. [#20674854]
  • One alternative build used an HC-SR04 with a configured range of 20-80 cm, handled by an ATtiny85, and it had worked for 3 years. [#20683188]
  • The ESP-based configuration page is served from a file named "configuration_sensor.h" and built with HTML, CSS, Ajax, and ESP8266WebServer.h. [#20683445]

Why did PIR sensors perform poorly for staircase lighting control compared with an IR barrier or a VL53L1X laser reflective sensor?

PIR sensors performed poorly because they reacted too slowly and covered the wrong area. The author measured a practical delay of 1-2 seconds and called PIR here "a misunderstanding". In that time, a person can already climb up to three steps. The activation zone was also unpredictable, which caused trouble near a household passage about 1 m from the stairs. By comparison, the IR barrier reacted in about 3 ms, and the VL53L1X delivered about 50 measurements per second with more precise distance-based triggering. [#20674854]

How does the VL53L1X work in short mode for detecting a person near the stairs?

It measures distance repeatedly and lets the ESP03 decide whether someone is inside a chosen trigger zone. In this project, the VL53L1X runs in short mode with a stated maximum range of 135 cm and sends measurements over I2C. The controller compares the live distance with the configured threshold, then outputs a stable HIGH or LOW for the lighting logic. At about 50 measurements per second, the sensor is fast enough to detect entry near the stairs without using a separate receiver on the opposite side. [#20674854]

What is AP mode on an ESP03, and how is it used to configure a distance sensor after installation?

AP mode on the ESP03 is the setup mode used to change the trigger distance at the final installation point. The author uses this mode to configure the operating distance in real time, which makes calibration easier after the sensor is mounted near the stairs. That matters because nearby foot traffic can otherwise trigger the lights. "AP mode" is a wireless setup mode that lets the ESP act as its own access point, exposing a local configuration page without a central system. [#20674854]

How do you build a browser-based configuration page for an ESP8266 sensor using HTML, CSS, Ajax, and ESP8266WebServer.h?

Build it as a normal web page and serve it from the ESP8266. The author says the displayed page is the file "configuration_sensor.h", which becomes viewable in a browser after changing the extension to .html. 1. Create the interface in HTML and style it with CSS. 2. Add Ajax for real-time requests without a full refresh. 3. Serve and handle those requests with ESP8266WebServer.h. The same author reused one general template across other projects, including an NTP clock and a weather station. [#20683445]

Which is better for animated stair lighting triggers: PIR sensor, IR barrier, ultrasonic HC-SR04, or VL53L1X laser sensor?

In this thread, the VL53L1X is the best all-around trigger for animated stairs. PIR was too slow at 1-2 seconds and had an unpredictable zone. The IR barrier was faster at about 3 ms, but it needed transmitter and receiver placement on opposite sides of the stair entrance. The HC-SR04 worked for one user at 20-80 cm for 3 years, but the main project chose the VL53L1X because it combined fast updates, adjustable distance, and easier installation. [#20674854]

What does the GPIO1 output signal on a VL53L1X module indicate, and how can it be used in the program logic?

It indicates that a measurement has completed. The author states that the waveform on GPIO01 goes LOW to signal a finished VL53L1X measurement. Program logic can use that event as a timing cue, then read the new distance and decide whether to drive the output HIGH or LOW for the stair-light controller. That approach keeps the control decision tied to fresh sensor data rather than arbitrary delays. [#20674854]

In what way can a VL53L1X or VL53L0X sensor be integrated with SUPLA for home automation tasks?

The thread confirms only partial SUPLA information. One reply says GG Supli supports the VL53L0X, and another points to a SUPLA forum thread about laser sensors and their use. The author of the stair project could not help directly because there was no central system in that house. So the safe conclusion is this: SUPLA integration is discussed for laser sensors, and VL53L0X support already existed in that community conversation. [#20675708]

How should the detection distance be calibrated in real time on a stair sensor so it ignores nearby foot traffic but reacts quickly at the entrance?

Set the trigger distance only after the sensor is mounted in its final place. The author used the ESP03 in AP mode to adjust the operating distance in real time, specifically because a household communication path passed about 1 m from the stairs. That let the trigger ignore traffic outside the entrance zone while still reacting quickly when someone actually approached the steps. Calibrating on-site matters more than using a fixed default number. [#20674854]

What is Ajax in the context of ESP8266 configuration pages, and why is it useful for changing settings without refreshing the whole page?

Ajax is the part that sends page data to the device without reloading the full interface. The author describes it as real-time interaction, such as clicking a button and making an LED turn on immediately. "Ajax" is a web-page communication method that sends small requests between browser and device, keeping the page visible while only the changed setting is updated. That makes sensor calibration faster because you can adjust settings live instead of refreshing the whole page each time. [#20683445]

How can a VL53L1X sensor connected over I2C to an ESP03 send a stable HIGH or LOW output for a lighting controller?

The ESP03 reads the VL53L1X distance over I2C and converts that distance into a binary control signal. In this project, the controller receives measurement data, compares it with the configured operating distance, and then sends a LOW or HIGH state to its output. Because the module measures about 50 times per second, the logic can update quickly enough for stair lighting without waiting for a slow motion detector. The threshold is also adjustable after installation, which improves stability in the real location. [#20674854]

What practical detection range should you use for stair entry sensing with a VL53L1X, and how does it compare with the 20 to 80 cm range used on HC-SR04?

Use a range that fits the actual entrance zone, then tune it on-site. The VL53L1X in this build works in short mode with a stated maximum of 135 cm, while another user reported stable HC-SR04 use at 20-80 cm. For stair entry sensing, the practical choice is the smallest range that still catches a person at the threshold and ignores nearby passers-by. In this thread, the laser sensor offered a wider configurable envelope plus live recalibration after installation. [#20674854]

How fast does the VL53L1X measure distance in a staircase application, and why does that matter for sequential step lighting?

It measures at about 50 times per second, and that speed is enough to start the sequence promptly. Sequential stair lighting needs a trigger that reacts before the person has already climbed several steps. That is why the author rejected PIR with its 1-2 second delay. A faster measurement loop lets the controller decide quickly whether to launch the upward or downward animation when someone enters the stair zone. [#20674854]

What are common causes of false triggers or poor detection when a staircase sensor is installed near a household communication path?

The main causes in this thread were slow sensing and a badly defined detection zone. The author had a communication path about 1 m from the stairs, so a PIR sensor with an unpredictable activation area became hard to tune and triggered poorly. Fast movement also matters: during a 1-2 second delay, a person can already be several steps higher. Distance-based calibration after installation reduces those failures because the trigger zone becomes tied to a measured threshold instead of a loose motion field. [#20674854]

How can the same laser distance sensor data be reused for other automations like desk break reminders, room lighting, or power control?

You can reuse the distance data as a generic presence or position signal in other scripts. One participant used these sensors to detect how long they sat at a PC, then triggered a reminder after 50 minutes. The same user also used the data for lighting control and power supply logic in other rooms. That makes the sensor more than a stair trigger; it becomes a reusable input for time-based and distance-based home automations. [#20678040]

Where should a reflective laser sensor be mounted around the top or bottom of the stairs to get precise person detection without the placement issues of an IR barrier?

Mount it at the actual entrance zone at the top or bottom of the flight, then calibrate the distance there. The thread shows that the trigger systems were needed at both the bottom and top of the stairs, and it praises the reflective laser approach because it avoids placing a transmitter and receiver on opposite sides like an IR barrier. The practical goal is a one-sided installation that watches the approach area and can be tuned in place after mounting. [#20674854]
Summary generated by AI based on the discussion content.
ADVERTISEMENT