Tag Archives: esp8266

Art-Net to DMX512 with ESP8266

Update 26 May 2017 – added photo’s of second exemplar and screen shots of web interface for OTA.

Professional stage and theatre lighting fixtures are mainly controlled over DMX512. To allow a convenient interface between the EEGsynth and this type of professional lighting systems, I built an Artnet-to-DMX512 converter. It quite closely follows the design of my Artnet-to-Neopixel LED strip module.

Let me first show the finished product. It has a 5 pin XLR connector, a 2.1 mm power connector, and a multi-color status LED:

Here is the working prototype based on a NodeMCU board

Art-Net to DMX512 prototype

It consists of the following components :

  • NodeMCU Lua ESP8266 development board (replaced by a Wemos D1 mini in the final version)
  • MAX485 Module TTL To RS-485
  • common cathode RGB led
  • 2x 220 Ohm and 1x 100 Ohm resistors
  • 2-24V to 5V DC-DC Boost-Buck converter (not in the prototype)

I was first planning to follow the design of Matthias Hertel, which includes an optical isolation between the MCU board and the DMX output. But I realised that the costs of the isolation transformer and optocoupler are more than the ESP8266, so I decided to keep it simple and not  to add over-voltage protection. I would have added protection in case it had been directly coupled to the USB port of a computer, but in this case the computer connects over WiFi.

Another consideration is the voltage to drive the RS485 output. While testing, my Stairville LED flood panel seems quite happy with the 3.3V provided by the NodeMCU board. Driving the whole  MAX485 module at 3.3V is therefore an option.  But I figured that the MAX485 module can also be powered with 5V (causing a 5V differential signal on its output) while the TTL input to the module is at 3.3V.

In principle it would be possible to provide power on the micro-USB port of the NodeMCU. However, the wall of the enclosure in which I’ll put it is quite thick. This would result in the micro-USB  being too deep for some cables/chargers. Furthermore, my experience is that it is not so easy to mount the ESP8266 board firmly enough to prevent it from moving when connecting/disconnecting the cable. Hence I opted for a 5.5 x 2.1 mm panel mount DC jack connector to provide 5V power. Since there are power adapters (wall warts) with 9 and 12 Volt, I included a 2-24V to 5V DC-DC power converter.

The source code is available from github. It is based on the code for my Artnet Neopixel controller. It was especially convenient to reuse the part for initially configuring the wifi, for configuring the settings, and for over-the-air updating.

The repository on github  includes the details on how to wire the components.

Update 26 May 2017

Per Huttner asked me to make one for the next EEGsynth performance. The only change compared to the first one (see above) is that I used a 3-pin XLR connector.

Here you can see the web interface upon initial startup (while connected to the ARTNET access point). As access point it sends this “captive” configuration screen automatically, just like a login screen on a public wifi network. The wifi configuration is based on WiFiManager.

Following WiFi setup it resets and after some 10 seconds the led shoudl turn green. At that point you can connect to the web interface. If you are using OS X with bonjour or Linux with zeroconf, you can connect to http://artnet.local. If your computer does not support zeroconf (e.g. on windows) you will have to log in on your router to look up the IP address that your router has assigned to it.

In the settings you can configure the universe that is to be forwarded from Art-Net to DMX512 and the number of channels. Specifying fewer channels makes the DMX message shorter and hence allows for more frequent (and smoother) updates. The delay is the (approximate) time between DMX packets. The default is 25ms, i.e. 40 packets per second, which is approximately fastest that you can transmit with the full 512 channels.

The monitor window shows the firmware version, the uptime in seconds, the number of Art-Net packets received and the frame refresh. The frame refresh is actually not accurate, since reading from the web interface shuts down the refreshing. You can read more accurate numbers from http://artnet.local/json. 

 

 

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 😉

Scalable lighting systems

The X-mass holiday is always a nice time of the year to spend studying and tinkering on electronics projects. In the EEGsynth project we have identified that it would be cool to control light with brain and body signals, besides controlling modular synthesizers which we have focussed on so far. As it is not yet clear what kind of light and what kind of control will conceptually and aesthetically work well on the EEGsynth control signals, I have been studying both small and large lighting systems. We might for example want to use small and wearable lights on a performer, or control the stage light, or use a LED strip as indicator of the EEG-extracted control signals.

In theatrical and stage performance lighting there is a clearly dominant standard: DMX512. For lighting setups there are many fixtures (i.e. lamps rigged on ceiling mounted truss) that can be remotely controlled over DMX512, not only on-off, but they can be dimmed, the color can be changed, spotlights can be moved, etc. If you look on for example on Thomann, you’ll see that many light fixtures support DMX.

The Disco Biscuits – City Bisco – 10/5/12 – The Mann Center for the Performing Arts – Philadelphia, PA – Photo © Dave Vann 2012

Going to the smallest systems, I considered individual LEDs. Neopixels are a very interesting type of RGB LEDs, which combine a red, green and blue (and sometimes white) LED in a single few-mm small housing together with a controller chip. The controller chip allows the individual LED intensities of the neopixels to be addressed over a serial controller by a microcontroller such as an Arduino. Furthermore, multiple Neopixels can be daisy-chained, where each pixel in the array can be addressed. LED strips consisting of 30, 60 or even 144 pixels per meter can be purchased per meter, for example on Ebay.

Adafruit NeoPixel Ring with 16 x 5050 RGB LEDs with integrated drivers

For the the EEGsynth it is desirable to have a single control module that provides a uniform interface between ExG control signals and light control. An individual neopixel can be considered as an RGB lamp, just like a theatrical stage light. The intensity of the red, green and blue can be controlled, just like the DMX channels of a stage light. Controlling a small LED jewel worn by the performer should not be different than controlling the light of the stage on which the performer acts.

An important difference in the requirements for fixed stage lighting and a small wearable LED jewel is that the first must hook up to existing DMX512 cabling systems, whereas the second should be wireless. This is where Art-Net and the ESP-8266 come in. Art-Net is a protocol for sending the DMX control protocol over a network. The ESP-8266 is a small and low-cost microcontroller combined with a WiFi chip that is compatible with Arduino.

Further details on the hardware and firmware design for the actual light controller modules will come in a series of follow-up posts.

ESP-12 bootloader modes and GPIO state at startup

Since I encountered some initial difficulties in programming the ESP-12 version of the ESP8266 module using the Arduino IDE, let me here summarise some findings based on information from [1,2,3].

esp12-pinout

The ESP-12 module exposes 11 GPIOs. Three of them are especially relevant, as they determine the bootloader mode at startup or following reset.

                                  | GPIO 0 | GPIO 2 | GPIO 15
----------------------------------|--------|--------|---------
Flash Startup (Normal)            |   1    |   1    |   0
UART Download Mode (Programming)  |   0    |   1    |   0
SD-Card Boot                      |   0    |   0    |   1

Furthermore, CHPD should be pulled up and RESET should be pulled up or should be floating. If you connect RESET to ground, the module resets.

I have not yet figured out what the SD-Card boot means, so in my applications GPIO 2 should always be pulled up and GPIO 15 should always be pulled down. I am using 10k resistors, but smaller values (e.g. 3.3k) should also work.

To facilitate development, I connected two push button switches to the GPIO 0 and RESET pins, shorting them to ground when pressed. When the buttons are not pressed, they are both pulled up to 3.3V using a 10k resistor.

This allows me to do the following two-finger-action to restart in programming mode and allow the Arduino IDE to upload a new firmware:
– press reset button
– press programming button
– release reset button
– release programming button

References

[1] https://zoetrope.io/tech-blog/esp8266-bootloader-modes-and-gpio-state-startup
[2] http://www.instructables.com/id/Getting-Started-with-the-ESP8266-ESP-12/
[3] http://www.instructables.com/id/ESP8266-Using-GPIO0-GPIO2-as-inputs/