31 August 2013

DMXBridge, a wireless DMX sender and receiver

There are situations where DMX cables are unwanted or just not practical. This project implements a wireless transfer of a DMX signal in the 2.4 GHz band using the Arduino platform and the popular transceiver module nRF24L01+ from nordic semiconductor.

The DMX protocol

Receiving and sending the DMX protocol from the ATmega chip is done by using the DMXSerial library and the built-in serial port. This implementation is using interrupts and is a good base for implementing a second protocol on the same chip.

The DMX Serial library has a built-in 512 byte buffer for a DMX universe that is accessible using the functions provided by the library. After initializing the library and starting the communication the interrupts ensure the communication in the background.

You can find a lot of details in the article about the DMXSerial library.

The Wireless protocol

The 2.4GHz RF Transceiver is connected to the Arduino board or ATmega processor by using the SPI interface. The library for driving this chip I used is the library from Greg Copeland that you can find at https://github.com/gcopeland/RF24. After initializing the library it is possible to send and receive data by using the provided functions of the library. The library transfers all the commands and data to the nRF24L01+ chip will also handle all the transfer details in the background.

Implementation

Because the libraries handle most of the communication details the implementation of this project only has to close the gap between the 2 protocols. The main differences between them are

Frame size: DMX is using a max. 512 byte long frame for sending all the values of all channels at once. The Transceiver uses a much shorter protocol that can transfer up to 32 bytes in one frame. I have seen controllers that do not send all the 512 bytes when only some channels are used in the setup.

Transfer speed: DMX is constantly using a 250 kBaud serial transfer speed on the DMX wire. There may be longer gaps between the frames and also between the individual bytes of a frame but it is common to use the maximum possible transfer speed. The Transceiver is supporting 3 different transfer modes

The solution I found and implemented here is to break up the 512 channels of the DMX information into smaller packages.

The sender

There are 2 buffers of DMX values. One contains the values I have received lately from the DMX protocol. The DMXSerial library is used to listen to the DMX protocol and fill this buffer.

The second buffer contains the values that have been sent over the wireless.

The values of both buffers are compared to find the recent changes and to send them with priority. If there is no difference between the 2 buffers no priority data will be sent.

To enable the addition of new receivers and to heal dropped packages all the DMX data is sent from time to time regardless whether there are changes on not.

The package transferred wirelessly contains a start-address and the actual 8 values starting at this address. The sender just sends the package without requesting any handshake from the receiver. This is called the broadcast mode of the nRF24L01+ modules that enables to use multiple receivers.

The receivers

The receiver only needs a single DMX buffer. All data from the incoming packages is directly taken into this buffer.

The DMXSerial library is used to send this information using the DMX protocol.

Setup the hardware

Both, the sender and the receivers need the DMX interface hardware attached to the serial interface and a nRF24L01+ module attached to the SPI bus. A prototype for this setup I used is the DMX Shield I published and a hand-soldered nRF24L01 adapter. The DMX shield is not forwarding the ICSP pins yet so this will only work on the Arduino UNO and older boards. (See discussion in Arduino Shield for NRF24L01+ post).

You need 2 of these at minimum.

Setup the software

Now you should be able to open and compile the provided sketches and upload them to the Arduino hardware.

The sketches I can provide for now are working in my environment and are not yet optimal for rough environments like stages. There are still some optimizations to do like sending smaller or larger packages and testing different transfer speeds. I like to get feedback from you.

Links

26 August 2013

DMXSerial Update

I just updated the Arduino Library for DMX with some improvements in memory and speed as well as some minor changes.

Thanks to Jenny for the hints.

If you use this library please download the newest version from: http://www.mathertel.de/Arduino/DMXSerial.aspx

24 August 2013

Arduino Shield for NRF24L01+

Here is the picture of a brand new Arduino Shield for the NRF24L01 on top of an Arduino UNO:

NRF24L01Shield.v01

It’s the first version and it works :-) so I finally soldered a transceiver directly onto it.

Signal layout

The signals for the SPI bus come from the ICSP connector to make it compatible to Arduino boards that do not have the classic ATmega328 (2009, UNO) but use other processor ICs like Leonardo, Mega. Here the MIIS, MOSI and SCK signals are not D12,D11 and D9. Using the ICSP connector is compatible.

The CSN and CE signals can be connected to pin D7 and D8 by using little solder drops on top of the shield that you can see on the right. Using these 2 pins because they do not conflict with other cards I use (Ethernet, SDCard). Initialize the RF24 radio class by using:

RF24 radio(7,8);

If other pins must be used, the 2 solder pads can be kept open and some wires can be used to pass the signals.

The IRQ signal is available on pin D3 the same way, but I don’t use it yet.

The rest of the shield has a permanent breadboard layout for small robust implementations.

In the back you can see another connector for I2C bus that I use to connect other hardware like LCD panels.

Prototypes:

Before I had 2 versions in place that I made. The first one was a “flying” transmitter that was perfect for finding the right pins and setup. The second one is sitting on top of an DMX shield.

NRF24L01_Proto1NRF24L01_Proto2

See also:

Hints on using NRF24L01+ with Arduino

This is a first version of a NRF24L01 shield, especially the breadboard it not perfect. I ordered more than I need so if you are working on a NRF24L01 project and like to have one – let me know. (first come first serve)