Post topics, source code that relate to the Arduino Platform

User avatar
By MortenMoulder
#64258 Part one:

Hey! I am currently doing a project, where I need to control my ESP8266's LED strip (WS2812B individually programmable LEDs). I have two things I need to accomplish:

  1. Send a list/array of LEDs that needs to change
  2. Save the list/array in EEPROM so it remembers it next time I boot it up

What is the best way to do this? I am making a web panel, where I can basically select each individual LED on the strip (or a few of them) and select their color.

Let's assume there is a total of 100 LEDs. When I hit "submit", I would convert all the colors into an array.
Code: Select allarray[0]
would then be LED number 1. I would then send this off to the ESP8266, and the request would be something like
Code: Select all100 (LEDs) * 6 (hex color)
meaning ~600 byte that has to be sent. Is that correct? Would that be a "good way" to do it?

Part two:

I can save the array to the EEPROM quite easily. If I want to save the array to the EEPROM while also keeping the amount of LEDs (from my code), how would I store them? What would my starting address be? 0x000000 (or whatever) for the array and something like 0x0003E8 (basically just 1000) for the amount of LEDs? Just to keep them separated. Alternatively, I could, in theory, store the data somewhere externally (like Firebase) and make the ESP8266 request the data every second or so. That way I don't have to make my ESP8266 do a lot of processing and I always store the data externally.

Hopefully someone can share some experience with this!
User avatar
By Barnabybear
#64271 Hi, the WS2812b are only 8 bit addressing so you would only need 300 bytes to set the colour for 100 LEDs.
If cost isn't an issue I would store to SD card. The write life is greater, your not limted by memory size and in later stages if you decide to have some preset values, not only will it be easier to load them up (take out SD card and load files) but you could have some changing patterns by scrolling through an array.
User avatar
By MortenMoulder
#64305
Barnabybear wrote:Hi, the WS2812b are only 8 bit addressing so you would only need 300 bytes to set the colour for 100 LEDs.
If cost isn't an issue I would store to SD card. The write life is greater, your not limted by memory size and in later stages if you decide to have some preset values, not only will it be easier to load them up (take out SD card and load files) but you could have some changing patterns by scrolling through an array.


8 bit addressing? That doesn't really matter, as I only need to store the hex values for the colors. 6 characters total.

SD card is waaaay overkill for storing a few bytes. It's literally nothing and I have 4 megabyte to play with.