Build my own 'Artnet to WS2812b Neopixel' boxes for lighting in a club. Working fine. I have 20 stripes with 50 pxls each. One ESP8266(NodeMCU) is feeding 6 stripes, so it gets 2 DMX universes via Artnet. Depending on the FPS(~20-40FPS) i'm sending, thats about 200-300kbp/s constant bitrate for each of the ESPs. Every 4-8h one of my boxes freezes randomly. No pinging possible anymore. The other boxes continue working as usual. Only chance of resetting is to disconnect the power. First, i thought the ESP gets to hot (installed at the clubs ceeling and the power supply is also in such a box) or the humidity is to high, but it must be a software problem (tested it in the oven, dont laugh ;)). So why isn't the watchdog resetting? I am not able to provoke any of those freezes at home (only waiting)
The code is pretty straight forward:
test the leds
connect to wifi (if no wifi, go to 1)
Loop:
check UDP packets for Artnetdata
update the WS2812 with the fastled-lib
any ideas?
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <FastLED.h>
// ARTNET CODES
#define ARTNET_DATA 0x50
#define ARTNET_POLL 0x20
#define ARTNET_POLL_REPLY 0x21
#define ARTNET_PORT 6454
#define ARTNET_HEADER 17
WiFiUDP udp;
#define NUM_LEDS 50
CRGB leds[NUM_LEDS];
CRGB leds2[NUM_LEDS];
CRGB leds3[NUM_LEDS];
CRGB leds4[NUM_LEDS];
CRGB leds5[NUM_LEDS];
CRGB leds6[NUM_LEDS];
unsigned long previousMillis = 0;
int offset=0;
uint8_t uniData[514];
uint8_t maxuni=0;
uint16_t uniSize;
uint8_t hData[ARTNET_HEADER + 1];
const char* ssid = "*";
const char* password = "*";
IPAddress local_ip(192, 168, 0, 111);
IPAddress gateway_ip(192, 168, 0, 1);
IPAddress subnet_ip(255, 255, 255, 0);
void setup() {
WiFi.begin(ssid, password);
WiFi.config(local_ip, gateway_ip, subnet_ip);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
delay(2000); // sanity delay
FastLED.addLeds<WS2812, 1, GRB>(leds, NUM_LEDS);
FastLED.addLeds<WS2812, 2, GRB>(leds2, NUM_LEDS);
FastLED.addLeds<WS2812, 3, GRB>(leds3, NUM_LEDS);
FastLED.addLeds<WS2812, 4, GRB>(leds4, NUM_LEDS);
FastLED.addLeds<WS2812, 5, GRB>(leds5, NUM_LEDS);
FastLED.addLeds<WS2812, 6, GRB>(leds6, NUM_LEDS);
initTest();
}
udp.begin(ARTNET_PORT); // Open ArtNet port
}
void loop() {
if (udp.parsePacket()) {
udp.read(hData, ARTNET_HEADER+1);
if ( hData[0] == 'A' && hData[1] == 'r') { //checking first two letters, if its Artnet data
if ( hData[8] == 0x00 && hData[9] == ARTNET_DATA) {
uniSize = (hData[16] << 8) + (hData[17]);
udp.read(uniData, uniSize);
if(hData[14]>maxuni){maxuni=hData[14];}
switch(hData[14]+1-maxuni){
case 0: //for each DMX universe updating the pixels
for (int j=50; j--;){
leds[j].setRGB(uniData[j*3+offset],uniData[j*3+1+offset],uniData[j*3+2+offset]);
leds2[j].setRGB(uniData[j*3+150+offset],uniData[j*3+151+offset],uniData[j*3+152+offset]);
leds3[j].setRGB(uniData[j*3+300+offset],uniData[j*3+301+offset],uniData[j*3+302+offset]);
}
break;
case 1:
for (int j=50; j--;){
leds4[j].setRGB(uniData[j*3+offset],uniData[j*3+1+offset],uniData[j*3+2+offset]);
leds5[j].setRGB(uniData[j*3+150+offset],uniData[j*3+151+offset],uniData[j*3+152+offset]);
leds6[j].setRGB(uniData[j*3+300+offset],uniData[j*3+301+offset],uniData[j*3+302+offset]);
}
break;
}
}
}
}
FastLED.show();
}
void initTest()
{
//only at Startup checking the LEDs, so nothing special here....}