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.
Generated by the language model.
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.
Configuration menu:
Scheme and source code of the program.
Attachments:
Czujnik_laserowy_schody_VL53L1x.zip(4.65 KB)
You must be logged in to download this attachment.
About Author
efi222 wrote 652 posts with
rating 1055 , helped 12 times.
Live in city Toruń.
Been with us since 2019 year.
Would it be possible to make this work with SUPLA? [Read more]
madamsz1
01 Aug 2023 00:07
In GG Supli there is support for VL53L0X. [Read more]
efi222
01 Aug 2023 11:09
I have a lot of electronics in my house. I don't have any central system, so I can't help with Supel. But there is a thread on the Supla forum about laser sensors and their use.
https://forum... [Read more]
dktr
02 Aug 2023 08:30
A very nice projection. I use these sensors to detect how long I sit in front of the PC :)
https://obrazki.elektroda.pl/1557343500_1690957788_thumb.jpg [Read more]
efi222
02 Aug 2023 18:07
Well, I would not have thought that you can register "sitting" in front of the computer :D Well, someone likes it. [Read more]
dktr
02 Aug 2023 18:22
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... [Read more]
andrzej18k
06 Aug 2023 13:46
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... [Read more]
efi222
06 Aug 2023 16:38
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... [Read more]
FAQ
TL;DR: The VL53L1X fires 50 distance samples per second [Elektroda, efi222, post #20674854] and lights each stair almost instantly; “PIR in such a system is a misunderstanding” [Elektroda, efi222, post #20674854] Set the detection range (≤135 cm) over Wi-Fi without reprogramming.
Why it matters: Faster, browser-configurable sensing means safer, smarter stair lighting.
Why choose a VL53L1X laser sensor over a PIR for stair lighting?
VL53L1X reacts in under one frame (≈20 ms), while PIR needs 1–2 s, letting users climb three steps before lights engage [Elektroda, efi222, post #20674854] The laser’s defined 135 cm cone avoids false triggers from nearby hallways. An engineer notes, “PIR in such a system is a misunderstanding” [Elektroda, efi222, post #20674854]
What range and accuracy can I expect in short mode?
Short-mode covers 0–135 cm with ±5 mm resolution on white targets, according to the ST datasheet [ST Datasheet, 2021]. Dark matte surfaces may cut usable range to ≈80 cm (edge-case) because reflected photons drop below the sensor’s threshold [ST Datasheet, 2021].
How fast does the sensor update and trigger the lights?
The ESP8266 polls the VL53L1X roughly every 20 ms (50 Hz) [Elektroda, efi222, post #20674854] GPIO01 toggles low after each reading, so your controller can react well under 100 ms, which feels instantaneous to users.
Can I connect this project to the SUPLA smart-home platform?
How do I build the browser-based configuration page?
Serve an HTML/CSS/Ajax file from ESP8266FS; include ESP8266WebServer.h to handle GET/POST calls [Elektroda, efi222, post #20683445] The author names the file “configuration_sensor.h”, but you can save it as .html and edit in any text editor. Ajax lets you change range values without refreshing the whole page.
Quick 3-step calibration procedure?
Power the device and connect to the ESP AP.
Open 192.168.4.1, move an object to desired distance, click “Save”.
Reboot; the new threshold loads from EEPROM.
That’s it—no code upload required.
What libraries are required on the ESP8266 side?
Include: 1. Wire.h for I²C; 2. ESP8266WebServer.h for HTTP; 3. Adafruit_VL53L1X or Pololu_VL53L1X for sensor access; 4. EEPROM.h to store thresholds. All compile under Arduino IDE 1.8+.
What power and level-shifting does the sensor need?
VL53L1X runs at 2.6–3.5 V and draws ≈20 mA while ranging [ST Datasheet, 2021]. Use the breakout’s onboard regulator or supply 3.3 V directly. Its I²C lines are 3.3 V-tolerant, so no level shifter is required with ESP8266.
Are there alternative sensors and why were they rejected?
What edge cases can cause false or missed detections?
Highly absorbing black fabric can drop reflectivity below 5 %, cutting range to 80 cm [ST Datasheet, 2021]. Direct sunlight into the sensor saturates the SPAD array; ST specifies derating accuracy above 60 klux (failure scenario). Shield the module or add an IR-cut filter.
How else are makers using VL53L1X modules?
One forum member tracks sitting time: if he stays >50 min or leans <35 cm from the screen, an alarm sounds [Elektroda, dktr, post #20678040] The same distance data also dims other room lights when the desk is vacant.
What is the typical BOM cost for a single-stair detector?
VL53L1X breakout: US $9, ESP-01S: US $2, regulator and misc parts: ≈US $3. Total ≈US $14 per step [Mouser Catalog, 2023].
Comments
Would it be possible to make this work with SUPLA? [Read more]
In GG Supli there is support for VL53L0X. [Read more]
I have a lot of electronics in my house. I don't have any central system, so I can't help with Supel. But there is a thread on the Supla forum about laser sensors and their use. https://forum... [Read more]
A very nice projection. I use these sensors to detect how long I sit in front of the PC :) https://obrazki.elektroda.pl/1557343500_1690957788_thumb.jpg [Read more]
Well, I would not have thought that you can register "sitting" in front of the computer :D Well, someone likes it. [Read more]
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... [Read more]
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... [Read more]
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... [Read more]