ESP-8266 Art-Net NeoPixel module

As explained in a previous post, for the EEGsynth we want to use a neopixel array that can be controlled wirelessly using the DMX512 protocol. I purchased a number of Adafruit neopixel rings with 12, 16 and 24 elements respectively. Each RGBW pixel contains a red, green, blue and white LED. For the 24-pixel ring that means that there are in total 4*24=96 LEDs of which the intensity can be set.

The ESP-8266 module is a versatile WiFi module that comes in many versions. During development I especially like the NodeMCU version, which mounts the ESP-12 module on a development board with USB connection, and the even smaller Wemos D1 mini board. The Wemos D1 mini is hardly more expensive on Ebay than the simpler bare-bone ESP-8266 modules.

The hardware connection is simple: I connected Vcc and GND directly to the Wemos D1 mini board, and connected pin D2 to the data-in of the first pixel. Although the Neopixels are specified for 5V, in my experience the Adafruit rings also work fine at 3.3V, both for power and for the serial control signal. Each LED can take up to 20 mA when fully bright, which means that all LEDs of the 24-pixel RGBW ring can take up to 24*4*20 = 1920 mA, or close to 2 A. However, not all LEDs will be at full intensity at the same time, and driving them with 3.3V rather than 5V further reduces the current. I encountered no issues powering them over the USB port of my MacBook.

For the EEGsynth we want to map a small number of control signals to aesthetically pleasing light effects. E.g. it can control the hue, the frequency with which the array flashes, or the speed with which a bright bar rotates along the ring.

I implemented the firmware as an Arduino sketch that combines a number of features. It incorporates ConfigManager for the OTA (over-the-air) configuration of the WiFi network to which it should connect. Once connected to the local wifi network, he ConfigManager also allows updating specific settings in EEPROM over a POST call to a specific URL. Settings include the number of pixels of the attached Neopixel array, whether they are RGB or RGBW, and most importantly: the mode with which the controller maps the control signals onto the LED behaviour.

The firmware listens to the Artnet protocol messages that it receives as UDP packets. The Artnet packets can be sent by the EEGsynth outputartnet module, but also by general purpose Artnet software, such as JV Lightning DmxControl, LightKey or QLC+.

The first mode that I implemented allows for full control of all LEDs. It maps the DMX512 channels like this

mode 0: individual pixel control
channel 1 = pixel 1 red
channel 2 = pixel 1 green
channel 3 = pixel 1 blue
channel 4 = pixel 1 white
channel 5 = pixel 2 red
etc.

The simplest overall uniform color mode is implemented like this:

mode 1: single uniform color
channel 1 = red
channel 2 = green
channel 3 = blue
channel 4 = white
channel 5 = intensity

This allows 3 channels (for RGB) or 4 channels (for RGBW) to control the color, and one channel to control the intensity. The intensity channel is in principle redundant, but makes the control much easier.

I implemented many more modes, including blinking/flashing of one or two colors, segments that can be moved over the ring (of which the color and position can be controlled), segments that automatically move around the ring (of which the color and speed can be controlled). The modes are all documented in code and in the README document included with the Arduino sketch in my Github repository.

The video below demonstrates one of the modes, controlled by the launchcontrolXL module of the EEGsynth. This shows the ESP-8266 Artnet neopixel module connected both to a 24-pixel Neopixel ring, and to a 144-pixel LED strip. I will document the hardware details of the LED strip in a follow up post.

On my YouTube channel you can find more examples, including a special Christmas tree mode 😉

16 thoughts on “ESP-8266 Art-Net NeoPixel module

  1. Kgreene

    This is great..
    Were is the actually code for the project. I’m just getting used to github…… Are there any libraries I need?

    Reply
    1. Robert Post author

      The specific code is included in a larger repository with Arduino code which is here, where the specific code is here. There are indeed a number of libraries that you need, which you can install using the “manage libraries” option in the Arduino IDE. Look at the includes at the top of the sketch (i.e. in the *.ino file). You also need to install the ESP-8266 board using the “additional boards manager” in the Arduino preferences.

      Reply
  2. Sean

    Feeling kind of stupid here. I got the code loaded, even connected to my wifi. However when I attempted to CURL the config. curl -X PUT -d ‘{“universe”:1,”offset”:0,”pixels”:13,”leds”:3,”white”:0,”brightness”:100,”hsv”:0,”mode”:1,”speed”:8,”position”:1,”reverse”:0}’ 192.168.1.254/json
    I got an error in the serial monitor. I re-flashed the Wemo and now I get
    loadConfig
    Failed to open config file
    *WM:
    *WM: AutoConnect
    *WM: Connecting as wifi client…
    *WM: Using last saved values, should be faster
    I am unable to return to AP mode, no longer see the Wemo on the network and cannot update it on the fly. When I reflashed I included the data folder in the upload, missed that the first time. What am I missing?

    Reply
    1. Robert Post author

      If you have a Neopixel LED strip attached and if it were decently configured, the color of the first LED indicates the status (connecting, connected, http-access). But more robust is to look in the serial monitor. After the “*WM” messages there should be more printed in the monitor (such as the IP address). Please have a look at that. If it does not get further than the “Using last saved values” message, something is wrong. I recommend you refresh the firmware and the SPIFSS data.

      Reply
  3. Sebastian

    loadConfig
    Failed to open config file
    *WM:
    *WM: AutoConnect
    *WM: Connecting as wifi client…
    *WM: Using last saved values, should be faster
    *WM: Connection result:
    *WM: 3
    *WM: IP Address:
    *WM: 192.168.1.13
    connected
    setup done
    But I cannot get to the config page…I uploaded data to spiffs what I done wrong ??

    Reply
    1. Robert Post author

      there will be something appearing on screen when you connect to http://192.168.1.13. If it is “cannot connect” then there is something wrong with your network settings. If it is “file not found” then there is something wrong with the SPIFFS upload.

      Reply
  4. Thomas

    Hi Robert, you did a nice job which will helped me to start with these types of LED stripes.
    I have modified your code to use E1.31 re sACN i/o ArtNet as this is the protocol I used in my other projects.
    In addition I am using APA102 i/o NeoPixel.
    As I am not able to add this to your project on GitHub, I have created project in my account. If you would like to intergate this into your project , I will delete this: https://github.com/ThomasH-W/esp8266_e131_DotStar

    Other than that I had to create the file config.json in the data directory to overcome “file not found” issue.

    Reply
    1. Robert Post author

      Hi Thomas,
      Thanks for the feedback, glad you like it! I don’t think it is likely that I will soon integrate the changes you made for E1.31 and for APA102. Both would require some studying and testing. I appreciate that you are sharing your version of the code on github, please keep it there. I do hope that in the future I’ll find the time and opportunity to look at it in detail.
      Best regards, Robert

      Reply
  5. Pingback: APA102 LED Stripe controlled by ESP8266 using E1.31 – Thomas Höser

  6. Horst

    Hi Robert!
    Great work, this exactly what i need.
    But i am a totally newbee with esp8266 and not able to compile your code. It always ends with exit code 1.
    Can you please tell me the versions of the libraries you used?

    best regards
    Horst

    Reply
    1. Robert Post author

      Thanks for the compliments. I am using the latest versions of all libraries, which I install and regularly update using “Sketch -> Include Library -> Manage Libraries”. Specifically, I am using

      Using library ESP8266WiFi at version 1.0 in folder: /Users/roboos/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/ESP8266WiFi
      Using library ESP8266WebServer at version 1.0 in folder: /Users/roboos/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/ESP8266WebServer
      Using library ESP8266mDNS in folder: /Users/roboos/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/ESP8266mDNS (legacy)
      Using library WiFiManager at version 0.14 in folder: /Users/roboos/Documents/Arduino/libraries/WiFiManager
      Using library DNSServer at version 1.1.0 in folder: /Users/roboos/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/DNSServer
      Using library ArtnetWifi at version 1.1.0 in folder: /Users/roboos/Documents/Arduino/libraries/ArtnetWifi
      Using library Adafruit_NeoPixel at version 1.1.7 in folder: /Users/roboos/Documents/Arduino/libraries/Adafruit_NeoPixel
      Using library ArduinoJson at version 5.13.2 in folder: /Users/roboos/Documents/Arduino/libraries/ArduinoJson

      Oh, there is one library that is not the latest: for ArduinoJson I am using 5.13.2, whereas the latest version is 6.7.0-beta. I tried the 6.x branch once for another project, but had problems and reverted. According to the ArduinoJson documentation here, it is also recommended to use the 5.x version over the 6.x-beta version.

      Reply
  7. Peter Leibold

    This is fantastic, Robert. Thank you for sharing.
    I’ve had good luck with most of it, but I have a couple of questions if you don’t mind! I will admit that I’m not an expert programmer, so I hope this isn’t too basic. I’m a theatrical lighting designer, running 16 pixels of RGB on a WeMos D1 Mini Clone, and sometimes it works beautifully.

    For some reason I am unable to update over the air. When I get to the Change Settings page, I put in new information and then click save, but receive an error that the unit sent no data back. If I go to the [IP address]/json, I see that the updates have not happened and that it’s still running the settings I loaded in on the initial firmware flash. Do you have any thoughts as to why this could be?

    Secondly, at times the pixels appear choppy as though it’s having trouble processing the information. It doesn’t seem to be related to distance from the router. Do you have any thoughts as to changes I could make to help speed it up?

    And finally, what does the Offset setting do in the code? I thought it might start the addressing at universe 1 address 101 when I put 100 in there, but that doesn’t seem to be the case.

    Thanks again, you’ve created something fantastic here.

    Reply
    1. Robert Post author

      Hi Peter, thanks for the feedback!

      With “update over the air” you mean “change settings” (2nd option) or “update firmware” (last option)? The code underneath “update firmware” is copied from somewhere, but it never reliably worked for me. That still needs to be debugged. The “change settings” however should work… I cannot check it myself right now, but perhaps you can give more details.

      The choppy behavior of the pixels surprises me; I used it with LED strips of up to 300 pixels and that runs smooth, i.e., the moving and blinking patterns are smooth. See e.g. https://www.youtube.com/watch?v=zGxAIAKqi04. I could imagine that a generally busy WiFi environment taxes the ESP chip, which constantly has to switch between the Arduino code that drives the neopixels and the wifi handling. Or is it that the updates you send for mode 0 (individual pixel control) are not immediately processed? I don’t have much experience with that, but could give it a try with a 12 pixel LED ring.

      Offset (minus one) should behave as you describe, i.e., the first 99 items of the received DMX packet should be ignored so that DMX packet value 100 ends up on pixel 1. But I see on line https://github.com/robertoostenveld/arduino/blob/080945494c4f9903c10332dbad0eda696e98cef7/esp8266_artnet_neopixel/esp8266_artnet_neopixel.ino#L73 that it is ignored. I’ll file this as issue, you can follow it at https://github.com/robertoostenveld/arduino/issues/13.

      best regards,
      Robert

      Reply
  8. Sam Chez

    Hi Robert,
    First of all, this project is awesome! Thankyou for sharing, I’ve been looking for something like this for a long time and only just happened across this by chance.
    I’m currently experiencing an issue when trying to change settings, similar to what another user recently described. When I make changes on the ‘change settings’ page, and hit save, it takes me to a blank page with ‘ERR_EMPTY_RESPONSE’
    In serial monitor I can see the update trying to push through, but I receive an error of file not found.
    This is the log I’m getting from serial monitor.

    handleJSON
    04:28:56.488 -> HTTP Request
    04:28:56.488 ->
    04:28:56.488 -> URI: /json
    04:28:56.488 -> Method: POST
    04:28:56.488 -> Arguments: 12
    04:28:56.488 -> universe: 1
    04:28:56.488 -> offset: 0
    04:28:56.488 -> pixels: 16
    04:28:56.488 -> leds: 4
    04:28:56.488 -> white: 0
    04:28:56.488 -> brightness: 255
    04:28:56.488 -> hsv: 0
    04:28:56.488 -> mode: 1
    04:28:56.488 -> reverse: 0
    04:28:56.488 -> speed: 8
    04:28:56.488 -> split: 1
    04:28:56.488 -> plain: universe=1&offset=0&pixels=16&leds=4&white=0&brightness=255&hsv=0&mode=1&reverse=0&speed=8&split=1
    04:28:56.488 ->
    04:28:56.488 -> handleStaticFile
    04:28:56.562 -> File Not Found

    If possible are you able to assist?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *