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 😉
This is great..
Were is the actually code for the project. I’m just getting used to github…… Are there any libraries I need?
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.
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?
PS Thank you for this awesome code! It is EXACTLY what I was looking for!
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.
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 ??
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.
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.
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
[…] http://robertoostenveld.nl/esp-8266-art-net-neopixel-module/ […]
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
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.