Creating lighting patterns

barx

Well-Known Member
Licensed User
Longtime User
Hey everyone,

As part of refurbishment works to my daughters bedroom I am installing a 3.5m length (200 LED's or so) of addressible LED Strip. I am probably going to be using an ESP8266 as the controller and then create Android app for remote. Bit of a bummer is she has just changed from Android to IPhone so I may have to call on a god friend to do a conversion for me as I don't have the stuff to do IOS apps, but that's not the discussion here. My query is:

I am trying to think how to do different patterns / colour setting and what sort of protocol to use. MQTT, HTTP, POST, etc. and how to package the data.

In a perfect world she would be able to 'program' her own sequences but short of write an interpreter I can't think how to do this. The best I can come up with is to define a set of patterns. Then the app selects the pattern to use and set colours / timings / etc.

Has anyone dealt with this or got any ideas?

She is just about to start learning python at school and incorporating that some how would also have been a nice touch, but I think that is way beyond me.

Please discuss any thoughts / experience in such a subject. thanks
 

Cableguy

Expert
Licensed User
Longtime User
I would do it almost all on the wemos side...
A bit like the level editor from @wonder...
A text file using rgb, but using a workable fixed length, like 12 or 20 LEDs per sequence.
Then you could have the file sent by your iOS app to the wemos and it would save it and read it to set the sequence...

This is a "general" idea... But if you wish to discuss it further, I like the idea, and I may also use it in a smaller scale...
 

JordiCP

Expert
Licensed User
Longtime User
Some time ago I made THIS . I think that the code (B4A app + ESP arduino code) is still in my old PC, if you are interested I will search for it

Defining the 'transferable' data structure is the first thing I would do, since it will define how the "interpreter" in your ESP will work and also if the patterns you have in mind can fit in this structure

for instance, assuming the LED stripe is fixed length, a very basic structure would bebasic timing: tick time in absolute or relative units
  • initial_colors[]: array of initial RGB values for each (or each group of ) Led
  • n_shifts: number of (circular) shifts made to the array on each basic timing 'tick'
  • color_modulation: predefined modular operation that will be performed on each pixel after being shifted. Can just be the mask applied to system ticks. For instance, each pixel color would be modulated by
    • red(nth_pixel) = red0(nth_pixel)*(system_ticks&0x80) ' higher period
    • green(nth_pixel) = green0(nth_pixel)*(system_ticks&0x40) ' double frequency
    • blue(nth_pixel) = blue0(nth_pixel)*(system_ticks&0x40) ' double frequency
  • global intensity modulation: also global modulation can be a constant (255) multiplied by another predefined function which depends on ticks
    • for instance, modulation = (modulation0*(system_ticks & 0xFF))>>8;

just an idea :)
 
Top