Before I open an enhancement “issue” on github I wanted to ask if it is already possible to use an external PWM signal (1000 ys to 2000 ys) to control presets or effects.
I am flying model planes and there is a standard where a PWM signal controls the servos of the control surfaces. There are more of those PWM outputs available from the model plane receiver which could be wired to the ESP32.
My thought was that I can setup WLED (which I already have), but it into the model airplane without WIFI (the range would be an issue to control it via smartphone) and control the effects via an PWM connection from my receiver in the plane to the WLED ESP32.
So is there already a possibility to do that?
As I understand it it is possible to change settings/effects/brightness (?) from an analog voltage input?
Check out the KB: Macros and Buttons for analog buttons and the various aspects you can control.
It should be possible to convert your PWM signal to an input for WLED.
The “crudest” method would be with a simple resistor capacitor network to create a variable voltage input.
Cherry picking the values and experimentation should give you some kind of control.
A more sophisticated (and better IMO) method would be to decode the PWM into output channels that could be connected to multiple WLED buttons. Google will find a number of projects using Arduinos and the like to do that, for eg: ATTiny decode RC PWM.
It might be possible to integrate some of that code into WLED, but I’m initially dubious given some of the timing constraints at the 1000uS range. Given the ability to create a small Arduino based decoder that could easily give 4 outputs, I’m of the mind it’s better to offload the decoding into something dedicated rather than potentially add bugs into WLED.
What kind of lighting cases do you have in mind?
Thanks for the fast reply!
I checked the Macros und Buttons section and I think I found an easy solution for a first try.
As I have an RC ON/OFF Switch I can emulate a button witch it.
Then I will have a look what I can control with it.
I am just at the beginning and I would be happy if I could manage to change Effects in-flight by my radio controller for the plane.
The ultimate lighting case would be to have an ESP32 with battery and LEDs on the plane and being able to have it react to music that is playing on the ground. When the music starts at the ground I want to give a signal (emulated button?) that the music startet on the ground. Then the ESP32 should take that as a trigger and start a lightshow matching the music.
But that would take several things to accomplish this:
- being albe to trigger an input (maybe solved witch the solution I described above)
- being able to play music on the plane, or better feed music digitally into the controller, best case without the need of a speaker and then the digital microphone on the ESP32
I think the first problem I can solve. Witch the second one I have absolutely no idea at the moment
If you can add adequate RC filter (or appropriate PWM DAC) then you can use analog input/button.
I was thinking about this from a slightly different angle.
I wondered if it might be possible to establish some kind of live link even if it’s just serial data.
It lead me to wonder about the links used for drone video footage and whether that technology could be used? What kind of range do you realistically need?
Now that you mention the sound part of this, one simple(?) solution might be to add an mp3 player into the plane so that the audio could be triggered to play on board at the same time as you trigger it on the ground. You shouldn’t need an actual speaker, just an audio input to the correct place. There are many tiny mp3 player boards out there.
That seems like a reasonable kludge to keep things in sync.
Range should be around 500m.
There already is a very good link from the radio to the receiver. And in Addition to that there is already an Bus-Output called SBUS, which sends up to 16 PWM channels from 1000uS to 2000 uS.
But I don’t think that Bus is supported by WLED.
I thought about that MP3 player solution too, but i don’t know how to trigger the start of the MP3 player.
Are there already input pins for analog audio input on the ESP32?
The trigger would be something like the Arduino PWM decoder I mentioned earlier.
There are a number of analog inputs on the ESP32, although the SR (Sound Reactive) folks have had varying degrees of success with audio in.
From my 1st look at the S.BUS system, it’s ESP32 based so it leads me to think there may be a way of getting some kind of data in/out of there. Need more research.
Just FYI, @blazoncek has a sound-reactive branch that works well. Should get into main soon.
Thanks for all the information!
I manged to get the following things done:
- got the LEDs on the wings
- soldered connectors on all sides
- configurated WLED to work with my home WIFI and the standalone access point
- now use two output channels to make wiring easier on the wings
- configured a “pushbutton” in WLED and tested it with wires => works; the rc switch should arrive tomorrow
So one big (for me) step is done. The other thing will be to get sound-reactiveness on the plane, I think I will have a look into the work from @blazoncek.
Is there any information on that topic, maybe a documentation?