Skip to content
Jun 9 / Greg

ESP8266 Wemos To Control WS2812 Neopixels


First a big shout out to this link, which provided me the tools to get started.

The instructions there under requirements give you the first steps. First you add the ESP8266 file uploader plugin to the Arduino IDE. This allows you to add new files the webserver can utilize.

Next you need to install the awesome WebSockets library.
Type Ctl+shift+i. This pulls up the library manager. From here you type websockets and choose ArduinoWebsockets by Gil Maimon.

Next you need to grab the FastLed library from the library manager just like above.

Add the ESP8266 package from the library manager.

Now grab the code from here. This is a great set of webserver files that are uploaded with the ESP8266 uploader and the ardunio sketches to be modified and uploaded.

Now open the ESP-8266.ino arduino IDE file found in the above github. First issue I hit was that I needed to change the flash size of my esp8266 in the IDE. So I choose generic ESP8266, then set the flash size as shown, and last clicked upload. This will get the webserver files in place.

Once the files are uploaded you should modify the IP address, wifi, pixel count, and pixel control pin info.

If you are controlling more than 255 LEDs like me, you have to modify the code, otherwise it will crash on you. In the led_effects.ino file, several variables are defined as uint8_t format which is an 8 bit number, which means it maxes out at 255. I modified the following:

1
2
3
4
5
6
7
8
//these are all towards the top
//uint8_t idex = 0; //индекс текущего пикселя    
uint16_t idex = 0; //индекс текущего пикселя    
//uint16_t TOP_INDEX = uint8_t(LED_COUNT / 2); // получаем середину ленты
uint16_t TOP_INDEX = LED_COUNT / 2; // find the middle
 
//  for(uint8_t i = 0 ; i < LED_COUNT; i++ ){
  for(uint16_t i = 0 ; i < LED_COUNT; i++ ){


As you can see I changed then from 8 bit to 16 bit numbers which allows for 65k pixels…way more than this little micro can reasonably control.

Good luck and happy lighting.

4 Comments

leave a comment
  1. Brad Buhrkuhl / Jun 9 2020

    Always a bit surprised to see anyone still using the terrible Arduino “IDE” (it isn’t really an IDE imo). VS Code + PlatformIO makes it completely obsolete.

  2. Greg / Jun 9 2020

    @Brad
    Thanks for the tip, I’ll give it a go!

  3. Marcel / Jun 15 2020

    You could try this aswell, have a few in my house and office works like a charm
    https://github.com/Aircoookie/WLED

  4. Greg / Jun 15 2020

    @Marcel, Awesome dude! I’m going to give it a go.

Leave a Comment

 

*