About "wipe" effect and usermod stairway basic

I need to implement a very simple function, which is easy to implement in fasted. But when I wanted to implement it in WLED, I found it very difficult.
The function is similar to this: if you press button 1, led strips can be lit one by one.
If you press button 2, the LED strip will turn off one by one in the opposite direction.
In fasted, if the 2 button is triggered within a short time after the 1 button is triggered, the LED strips shows like a pluse effect.
However, in WLED, it is very difficult to achieve this effect. The effect I get is that after triggering 1, the LED strip will light up one by one, When half of the LEDs is on I triggering 2. At this time, the entire led strip will turn on first and then turn off one by one in the opposite direction.
I don’t know what good way to solve this problem?

I think there is already a usermod for this.

The usermod is design for using two pir sensor to trigger.But PIR can’t detect the directions of people pass through. In my porject, I use two TOF laser sensors to trigger. I test the usermod “stairway basic”,in some situations it’s not work perfect. When people just go into the stairway and then go back out immediately, the led strip couldn’t do anything. I made some changes to the original code, but still can not achieve better results. The LED strip will have a full lighting process before the reverse start.

The effect in this video is what I want. I have finished testing the sensor part, and they are working very well. But the LED band part, when I use WLED to do development, always can not achieve the desired effect.

1 Like

One PIR can’t be used, but two can. :wink:

No,for example, two people go into stair form both side, PIR can’t works fine.

PIR at top and PIR at bottom can detect direction because direction is implied.
Just be on the lookout for PIR top (or bottom) going ON, followed by any of these states:

  • Off, and no matching ON at opposite end of stairs to note leaving the stairs

  • Off, back on again, with or without an opposite end of stairs ON which meant they changed their minds

  • Off, back on again, and opposite end of stairs ON once or twice as either 1 or 2 people come out of the stairs

  • Stays on, followed by opposite end of stairs ON, as one person walked up/down the stairs and the other person watched or waited

Trick is to use the timing of the ON/OFF/ON of one end to trigger the chase off effect to start after the last ON->OFF transition, and if it stays on, the chase off effect does not get triggered.

And, the first OFF->ON starts the chase ON in either direction, meaning it can react to both up and down movement at the same time.

Hope this helps.

I did a lot of tests on PIR sensor, but in the end I chose TOF laser sensor as trigger. And this part of the algorithm has been written. TOF laser sensor can accurately know the direction and number of people on both sides of the stairs through the algorithm. This will allow you to calculate the number of people in the stairs and also know the direction of the first person to enter (and the last to leave).

The problem I’m facing now is to use the effect in usermod. When a person enters the stairs and turns away immediately, “Stairway basic” doesn’t respond well. I try to change some code, but there are still some problems.

This is what I want to achieve.
For example, there are 256 LEDs in my whole LED strip, which are lit one by one when someone enters.
In this process, the person turns around and leaves from the direction of entry. At this time, the LED strip just lights up to the 100th led. Then the next effect I hope is that the LED strips will be extinguished one by one from the 100th led in the opposite direction.
But I don’t have a good way to implement it through WLED.

Hi, I solved a similar thing with air sensors like you. I used the mentioned usermod for that and I didn’t have to modify it, but I solve everything in node red, where it works. It’s not perfect and there’s a video here.

Many things still need to be fine-tuned and the wled itself freezes from time to time or does not work properly and must be restarted. But that’s when I’m playing a lot with other settings.
And otherwise I agree, it can’t be done with pir sensors and whoever says yes, then didn’t try. Pir won’t recognize if you’re coming back or if someone else has entered the stairs. I can share my node red flow anyway and I would like to work on it with someone who solves the same, so you :slight_smile:

Glad to hear that.If it’s convenient, can you send a copy of your node red flow to me. I also plan to use node red to process mqtt messages from sensors, and then send corresponding mqtt messages to WLED to trigger corresponding effects. But I’ve tried many times, and I can’t use WLED to achieve the perfect effect. When a person enters and immediately turns around and goes out, the LED can not be extinguished one by one in reverse direction. It must first fill the whole LED strip, and then it will extinguish one by one from the other end to the entrance. I don’t know how to solve this problem. If you have a good idea, please let me know. Thank you very much.

Do you use TOF sensors with esphome? I can send flow but I’m still reworking it, it’s still neat and I’m fine-tuning the features and effects. How much do you understand Node RED?

I use TOF sensors with my own code run with esp32.I just use Node RED for some simple home automation.

Now I have the main lighting of the wiping effect running, following the effect of the side rails.

I could send a flow in the evening.
I use esphome on TOF, the implementation has already been done on it and it works reliably.
Did you write the code yourself for TOF? Does it communicate with the Home Assistant?

Yes,it sends current state to mqtt broker.

Here you will find the flow with the settings as I have the best so far. Sometimes it causes mistakes and I have to tweak it. The mistakes are that if you go one way, then you change your mind and go back and then go up the stairs again, so the standby effect is combined with the trigger effect and it stays cut. I need to debug it with the STOP function when something happens that doesn’t. The problem is that it can’t be timed well enough. I will be happy for help. If you want a link to esphome TOF, I’ll send it too. I don’t know if you build it autonomously or within the Home Assistant.

edit: I fixed it yet, so now it kind of works. Let me know.
edit2: there is still a mistake, if you test the entrance and exit to the stairs quickly, then it may happen that the WIPE is stuck and then goes around all the time. but it’s probably more for modifying the user mode.

Thanks!I’ll check your flow later, and this video is what I want to achieve. I don’t think it can be achieved only by calling WLED through nodded, so I’ve been trying to modify usermod myself. But so far, as I mentioned above, it hasn’t been perfect.

1 Like

exactly according to this video i did it … it can only be achieved by calling wled via usermod … you found that in the description of usermod there is no mention of one command that will make it easier and i used it. It is a call U0 = 0

I’ve looked at your flow and it seems that nodered is calculating the sensor data to calculate the number of people. I didn’t do that. My own firmware has allowed the sensor to calculate the current people status through esp32. Now I just need to call WLED through the corresponding state. I was able to use the original version of WLED to achieve 95 percent of the above video. However, what the remaining 5% does not achieve is that when an LED strip is gradually lit up, it receives a message of reverse extinction (U0). At this time, WLED can not extinguish gradually from the current LED, but it needs to wait for the lighting effect to complete before it starts to extinguish.

I don’t understand why he receives a shutdown message? What is a trigger?
Do you have your firmware implemented in wled, or do you use another esp32? I have it on two esp32, one is wled and the other is esphome.
Is your fw part of the Home Assistant, or does it run on its own and cannot be easily set up? If you share it, I can try the behavior.

I have two esp32 too.One for wled and one for vl53l1x tof sensor.For now,It’s running on its own,and send the people status through MQTT. I haven’t complete this fw for easily setting. So I can’t share the code right now:(
The shutdown message comes from one person go pass through the senson(on),and soon he turns back(off). You can see that in 59 seconds of the video which I shared.