Jim's
Tutorials

Fall 2011
course
navigation

Wireless Flex Sensor DMX Lighting Controller

Introduction

This piece was created during the Spring of 2011 as part of Hallways to Harbors, a live performance with site specific movement created in collaboration with choreographer Kenyon Acton. The initial idea was to have a dancer’s movement directly control lighting in the environment around them via sensors embedded in their costume. I decided early on to work with DMX protocol, because it was compatible with modular, reliable, inexpensive commercially available dimmer packs and eliminated the need for me to work directly with 120 volt circuitry. As the project evolved, xBee wireless transceivers became another logical tool to work with, given their (supposed) ease of use and their ability to perform analog to digital (ADC) conversions without additional components.

Parts

Transmitter

4x 4.5” SpectraSymbol Flex Sensor
1x xBee Series 1 Transceiver, 1mW w/ Chip Antenna
1x Sparkfun xBee Explorer Regulated
4x 33 K ohm resistors
1x 10 K ohm resistor
1x 18 K ohm resistor
8x screw terminal blocks
1x 3 AAA battery holder
1x small project enclosure (from Radioshack)
1x small PCB with a 15x15 grid of unconnected holes (from Radioshack)
10’ 22 gauge speaker wire
small scrap of flexible plastic (from orange juice bottle)

Receiver

1x Arduino Uno
1x Arduino Protoshield PCB
1x Sparkfun xBee Shield
1x xBee Series 1 Transceiver, 1mW w/ U.FL connection for antenna
1x RP-SMA to U.FL interface cable
1x 2.4 Ghz Duck Antenna RP-SMA
1x Texas Instruments Differential Bus Transceiver SN75176AP
1x DIP-8 IC socket
1x 100 ohm resistor
1x Metal Enclosure for Arduino
1x Green LED Panel Mount Indicator 5V
1x Red LED Panel Mount Indicator 5V
4x Amber LED Panel Mount Indicator 5V
1x rocker switch
1x Neutrik Female XLR plug (panel mount)
1x AC Adapter 9 VDC 650 mA

For assembly

assorted 22 gauge jumper wires
assorted heat shrink tubing
breakaway header, male & female, straight and 90°
stackable header for Arduino shields, 6 pin and 8 pin
FTDI USB to serial chip w/ header breakout or Sparkfun's xBee Explorer USB

DMX Gear

4 channel DMX dimmer pack
3 pin DMX cable
Note: While 3 pin DMX uses the same XLR connectors as microphone cable, it is different. Microphone cable may work for shorter runs, but because of how the wires are configured and insulated it is more susceptible to interference than cables that are designed to carry data.

Online Resources

DMX

DmxSimple Library - This is the library I used to output a usable DMX signal with Arduino. Very easy to work with.
Tomek Ness' DMX and Arduino Tutorial - Provides a brief (somewhat hard to follow) explanation of DMX, some sample code, and most importantly a schematic and some explanation on how to connect the DMX driver chip.

xBees

XBee Manual from Manufacturer
John Foster's "xBee Cookbook"
Rob Faludi's Page on Zigbee Networks

Flex Sensors & Voltage Dividers

Manufacturer's Datasheet on Flex Sensors
Protolab Tutorial on Sensors for Arduino - A good simple explanation of using voltage dividers with flex sensors to get useful readings with an Arduino. Scroll down to get to the section of flex sensors.
Wikipedia: Voltage Divider - A more in depth explanation of how voltage dividers work.
ITP Sensor Workshop - Much more in-depth info than I needed, but it might be worth looking into using op-amps to improve the accuracy and consistency of the sesnors.

Configuring the xBees

One of the first things to do is to configure the xBee modules. I assembled everything before doing this and ended up repeatedly tearing all of my hardware apart to troubleshoot the xBees.
When I ordered the xBees, most of the reviews I had read lead me to believe that they were a fairly straightforward "plug and play" sort of tool. This may be so if you're just using them as a serial line between two microcontrollers, but it was certainly not the case for this application. My confusion was amplified by the fact that many of the tutorials I read were either working with the more advanced series 2 xBees (which have slight differences in how they're configured) or working with the series 1 modules in API mode, which turned out to be unnecessary.
In order to enable the built-in analog to digital converters on the transmitter and change a few other settings, the xBees need to be connected to a computer. I used an FTDI USB to serial adapter along with the xBee explorer in my transmitter for this purpose, but it would be a lot easier to get something like Sparkfun's xBee Explorer USB which has the USB port, conversion chip, voltage shifters, and header for the xBee all built into a single piece of hardware.
Although the manufacturer of the xBee's provides a special piece of software to configure their modules it only runs in windows, I found it significantly easier to work with a basic terminal program. CoolTerm worked quite well for me.

Connecting to the xBees

  1. Connect one of the xBees to the USB explorer or whatever USB to serial device you're using and plug it into your computer. If the explorer has a power light, double check that it's on.
  2. Open a new terminal window in CoolTerm.
  3. Click the button at the top of the CoolTerm window to open the options dialog. Set the port to whatever USB port the xBee is connected to. Set the baudrate to 9600 (the default for new xBees) and enable local echo, which will make it so you can see what you type in the terminal.
  4. Type "+++" into the terminal window and hit enter. This is like saying "Hey, xBee, I'm talking to you." The xBee should reply "OK" on a new line in the terminal window and will continue listening for commands from the serial connection for 3 seconds.
  5. Before the 3 seconds is up, you can try just typing "AT" and hitting enter to see if the xBee is responding normally. It should reply "OK" again. All configuration commands start with "AT" and the xBee should always reply with an "OK" if everything is working and you are sending valid commands.
  6. Start configuring the xBees! Just type each of the commands below, followed by a return. Remember, if you wait more than 3 seconds between commands, you will need to type "+++" again or the xBee won't receive the next command you type.

Configuration Commands for the Transmitter xBee (chip antenna)

ATID3333 -Sets PAN ID. It doesn't really matter what the PAN ID is, as long s both modules are the set same.
ATMY2222 -Sets the source address. These should be different between the two xBees
ATCH03 -Sets channel. The 2 xBees need to be on the same channel.
ATD02 -Enables the analog to digital converter on input 0 (pin 20).
ATD12 -Enables the analog to digital converter on input 1 (pin 19).
ATD22 -Enables the analog to digital converter on input 2 (pin 18).
ATD32 -Enables the analog to digital converter on input 3 (pin 17).
ATWR -Saves the changes you just made so the xBee doesn't reset when you disconnect power.

Configuration Commands for the Reciever xBee (external antenna)

ATID3333
ATMY1111
ATCH03
ATWR

For more explanation of these commands the xBee user manual has a very nicely organized glossary of commands in chapter 3.

Assembling the Hardware

Transmitter

1. Prepare the xBee explorer board:

2. Prepare the bottom PCB:

3. Prepare the flex sensors:
I found that the sensors were quite flimsy at the connector end, right by the pins. While most of sensor is made with two layers of plastic laminated together, this last 1/4" or so is only a single layer and breaks easily. After soldering on several feet of speaker wire, I ended up taping a small piece of plastic (cut from an orange juice jug) that overlapped with the solder joints on the pins and the bottom 1/2 inch of the sensor and covering everything with a piece of heat-shrink tubing.
4. Assemble everything:
Connect the sensors to the screw terminals, drop the custom PCB into the bottom of the enclosure, plug the xBee explorer in on top of that, and pop the lid on the enclosure. I filed down the edge of the lid just enough so it would close with all of the wires in place but put gentle pressure on them so they couldn't get ripped out from the board.

Reciever

1. Prepare the enclosure:
2. Assemble the protoshield:
3. Put everything together:

Code

I used two very helpful Arduino libraries: DmxSimple and NewSoftSerial. Dmx simple provides the ability to output DMX signal to the driver chip using the simple format "DmxSimple.write(channel, value)". NewSoftSerial makes it so the Arduino can communicate with the xBee (a serial device) on pins 2 and 3, while leaving pins 0 and 1 (the only pins that normally support a serial connection) open so the Arduino can still use its USB connection.
The code for this project breaks into three main parts.

Attaching the Costume, Calibrating, & Troubleshooting

The finished product in action

Jim's examples of markup

http://cs.marlboro.edu/ courses/ fall2011/jims_tutorials/ ben/ flexsensor_DMX_controller
last modified Saturday September 17 2011 3:50 pm EDT

attachments [paper clip]

     name last modified size
   dmx_sensor_1_2.pde Sep 16 2011 11:03 am 8.41kB [DOC]flexsensor_dmx_schematics.pdf Sep 14 2011 1:17 pm 67.8kB [IMG]screenshot.jpg Sep 16 2011 11:41 am 80.3kB