r/WLED • • 4d ago

Using presets with input pins

Post image

Good afternoon. I am trying to set up the WLED program to use one of five presets based on the input pin going HIGH. After quite some time, I still cannot figure out how to assign the preset to a specific GPIO via the WLED web interface. FYI, all outputs are the same, just multiple 12v strips for the inside of my truck shell.

2 Upvotes

18 comments sorted by

2

u/Substantial_Goat6969 4d ago

You set presets are set with led numbers. If you have three outputs with 200 leds each, you would make one group 1 - 200, second group 200 - 400 third group 400 - 600. After you can make your groups, you can individually select those and change effects on just that section.

1

u/Embarrassed-Lab6622 4d ago

So the resistors are to pull down the input until the 3.3v signal is received, just a precaution to keep the GPIO from floating. I am not interested in groups as I want all the LEDS to do the same, based on my selection of the five different input pins going HIGH.

2

u/saratoga3 3d ago

Your resistors pull 5v down to ~2v, which is probably too low to trigger a GPIO pin. Try removing R11 so that you pull up to 2.5v and see if that works better.

1

u/Embarrassed-Lab6622 3d ago

Good catch. I will delete R11 and replace R1-5 with 5.56k

1

u/Individual_Nobody739 3d ago

You don’t need a separate LED segment for each input if all the strips should run the same effect. First, save one preset and select it manually to make sure it does what you want across all the outputs.

Then configure one GPIO as a Switch under Config → LED Preferences. The preset assignment is on a different page: Config → Time & Macros → Button Action Presets. A switch has separate actions for Off to On and On to Off. Test which action fires when your input goes HIGH, and assign the preset to that action. Test the return transition too: a value of 0 uses WLED’s default action, so don’t assume it means “do nothing.”

Once one input works, check that your installed build exposes five button slots before setting up the other four. If it doesn’t, check your WLED version and build first; creating more LED segments won’t add input slots.

1

u/Embarrassed-Lab6622 3d ago

Thanks for the response. I did all of that but could not get it to work. I had extra output pins so that I could reduce the load on a single output pin. My default action (ON to OFF) is supposed to be "OFF".
I will mess with the hardware tomorrow and see if anything changes.

1

u/[deleted] 3d ago

[removed] — view removed comment

1

u/Embarrassed-Lab6622 3d ago

Thanks for the comment. I am hoping you can explain why I would need bulk filter capacitor(s) for a 12v battery being dropped to 5v.
I also read where ESP32 can run up to 700 LEDs on a single output pin so I am not sure why I would need a buffer transceiver. Thoughts?

1

u/saratoga3 3d ago

Many ESP32 boards have poor regulation and have poor stability without bulk capacitance. If you aren't crashing however then you don't need to add any.

The ESP32 puts out 3.3V data but your LED strips expect 5V. They may or may not be ok with 3.3v. Similar to the bulk capacitance, my advice would be to check if you get glitching when running patterns, and if so fix the voltage levels. If you don't, it is probably ok to leave.

1

u/Embarrassed-Lab6622 3d ago

fair enough, thanks for the explanation. I am an ME, so this kinda of stuff is new to me and I am learning one project at a time. 😄
Once I get the single strip working, then I will expand to the 4 strips and keep you posted.

1

u/Embarrassed-Lab6622 2d ago

I am still having issues with the WLED program but I was able to write some code in Arduino that appears to be working.
Regarding the output voltage levels, is the TPS4H160BQPWPRQ1 the same thing as you were suggesting? I guess I am not sure what the output looks like on pin 16 - PWM or ???

1

u/saratoga3 2d ago

That is not a good choice. See: https://kno.wled.ge/basics/compatible-hardware/

While there are countless ways to turn 3.3v logic into 5v logic, unless you know what you're doing you should stick to the recommended options.

1

u/Embarrassed-Lab6622 1d ago

I have used that chip before on another ESP32 project. But I went with the 74AHCT32PWR as it was easy to wire with provided examples.

1

u/Embarrassed-Lab6622 1d ago

Another question: I am using INPUT_PULLDOWN in the code, so do I really need the pull down resistors on the input? I was also using them as part of a voltage divider from 5v but can easily use the 3.3v output from the ESP32 as input to the switch (instead of the 5v).

1

u/saratoga3 1d ago

That's a better choice, but don't forget the output resistor. If the cable is more than a few meters, take the impedance of the cable and subtract 30. If you keep the cable short, then 50-100 ohms is reasonable.

1

u/Embarrassed-Lab6622 1d ago

Do you mean a pulldown resistor on DIN (pin 16)? Everything is going to inside the rear of an old suburban to replace the dome light. LED strip is a total of 440" (10x 44" strips) with a 12v power injection on every 2 strips. The data cable will be maybe 3' long prior to the LED strip.

2

u/saratoga3 1d ago

No, I mean the missing resistor on the level shifter output pin. If it's only a few feet long it will probably work without it but I would still put 50-100 ohms to be safe.

If the pins you're using have internal pull downs then you don't need to add your own. I would use 3.3v regardless if you have that option.