Artnet, WS2812 and ESP8266 (Lua)
From my previous post on Artnet ESP8266, I had some feedback about some trouble. I decided to make it again but with the WS2812.
- Flash the ESP8266 with the correct library. You will need:
- Nodemcu flasher
- Esplorer
- Compile a new firmware using: Nodemcu Custom Builds
Once compiled you will receive an email with a link to download the firmware.
Upload the firmware with Nodemcu flasher and change the path to point to the custom firmware
With Esplorer, upload this program:
wifi.setmode(wifi.STATION) wifi.sta.config("*****","*****",1) tmr.delay(5000000) -- wait 1,000,000 us = 1 second print(wifi.sta.getip()) print("Running") gpio.mode(4, gpio.OUTPUT) ws2812.init() tmr.delay(1000000) ws2812.write(string.char(0,0,0):rep(100)) s=net.createServer(net.UDP) s:on("receive",function(s,c) ws2812.write(string.sub (c, 19, 318)) end) s:listen(6454)
I am driving a Matrix (10*10) of 100 pixels.
In the UDP loop, I am extracting the 300 bytes (19 to 318) corresponding to each RGB values of each pixels; 3 * 100. Bytes 1 to 18 are the Artnet header.
The led stripe is connected to PIN D4 of my NODEMCU Board
Forgot to mention that a fast wifi router is needed.
Enjoy…