Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
1
Abbey’s Tube—Using MIDI, DMX, and Arduino to Create an
Integrated Light Fixture
Madhu Ashok
University of Rochester
The Institute of Optics
Submitted to Mark Bocko on 05/08/2015
Abstract: Abbey’s Tube is a music visualizer that is designed to educate children
at the Rochester Museum and Science Center on sound waves through the
illumination of mist with light. This exhibit prototype was designed to be
interactive, so I decided to turn Abbey’s Tube into an effective light fixture which
could be mapped to a Novation Impulse 49 MIDI controller. This tutorial will
describe the processes and code involved in communicating with Arduino and
servos, as well as a further exploration of Chauvet ShowXpress DMX software.
In the final design, the prototype was able to control color and tilt of an LED
fixture, pan/tilt control of a servo mounted mirror, and pan control of a servo
mounted laser pointer.
2
Introduction
This independent study focuses on advanced computerized lighting design, and is a
continuation of research done in a paper I wrote called “MIDI Mapping Synthesizers in FL
Studio Simultaneously with DMX Mapping in Chauvet ShowXpress”. In my senior design
project for optical engineering, I have developed a music visualizer modeled on a Rubens’ Tube,
which uses flame heights to demonstrate pressure inside of a tube which is filled with sound
waves generated from a subwoofer reflex port. The Rochester Museum and Science Center
(RMSC) has strict policies against open flames, so I substituted propane with mist that is
illuminated with light. It seemed appropriate to add MIDI and DMX control for the illumination
system—adding a great deal of interactivity for a museum patron. The mist generated from an
ultrasonic hydroponic mister is oftentimes too faint for the eye to see, and is resolved using a
COLORband PiX-M LED bar in conjunction with a 532 nm laser pointer. These lighting
elements are controlled through Chauvet ShowXpress lighting design software and mapped
through MIDI.
Figure 1: Abbey’s Tube illuminated with a 532 nm green laser pointer and a Chauvet
COLORband PiX-M LED bar. Faders on the MIDI controller offer manipulation of the LED bar
located behind the tube, as well as the servo mounted mirror (located on the top right of the tube).
The software used for generating single frequencies will be a digital synthesizer in Fruity
3
Loops Studio called Toxic Biohazard (which was used in the previous paper). The MIDI
controller will be the centerpiece of interaction by controlling both music and lighting software.
This was found to be beneficial when prototype testing at RMSC, since patrons were only
allowed to touch the MIDI, leaving the rest of the electronics and opto-mechanics unaltered.
I wanted to complete my senior year at the University of Rochester with a project that
reflected my interests in music and lighting design. This project has resonated deeply with me
due to the vast amounts of engineering involved in its creation—including optics, mechanics,
electronics, computer science, audio, and music engineering. As an avid live music follower I
have noticed the increasing influence of lighting in the music industry, and how it transforms a
music production into an all-encompassing audio-visual experience.
Figure 2: Clay Paky B-EYE LED light fixtures used by designer Scott Huston from lotus. [1]
Background
The concept and name for Abbey’s Tube was derived from my fascination with the
Rubens’ Tube. This device shows a visual representation of invisible sound waves by creating a
way to show pressure differences with fire. The Rochester Museum and Science Center already
has an operational Rubens’ Tube, but is unable to use it as a floor exhibit due to fire hazards.
4
Figure 3: Rubens’ Tube created at the University of Utah [1].
Sound enters one end of a long tube and reflects upon an acoustic barrier, causing interference
and a standing wave pattern. Small holes are cut on the top of the tube spaced evenly across (in
my design 1” apart) for a pressure profile at that particular position of the tube. Lower pressure
outside the tube causes gas to escape. This effect is modeled by the following equation derived
from the Bernoulli Equation:
Figure 4: 𝑷𝟎; 𝑷𝑻 represent the pressure outside and inside the tube respectively. 𝑽 models the
velocity of the gas with density 𝝆 [2].
Pressure inside the tube varies based on the sound generated from the subwoofer which, in turn,
alters the escape velocity of the gas. This effect is visually represented by flame height in the
Rubens’ Tube, but can be modeled with other gasses. Mist was chosen as a safe and cheap
alternative to propane, as well as for its ability to scatter incident light. The mist height without
illumination is difficult to resolve, so an LED bar is used. Additionally, a 532 nm laser pointer is
aligned above the spouts, scattering light off of the horizontal cross section of the escaping mist.
The fundamental frequency of the tube will determine the lowest frequency for a standing
5
wave pattern to be displayed in the spouts. Given a fixed tube length with an acoustic reflector
on the end, the problem models a closed-end air column:
Figure 5: Closed-end air column illustration of the first harmonic (quarter wave). The reflection
causes a standing wave pattern when the length of the tube (L) is a fourth of the wavelength [3].
𝑓1 =𝑣
𝜆 𝑤ℎ𝑒𝑟𝑒 𝜆 = 4𝐿 𝑓1 =
𝑣
4𝐿
The speed of sound in air is approximately 343 m/s, which is a slight underestimate for the speed
of sound in mist/water vapor. This difference is minimal compared to the effects of pressure
differences in the standing wave at the various spouts. The tube length is fixed at 3 feet (.91
meters)
𝑓1𝑠 =343
4∗.91 𝑓1𝑠 = 94.23 𝐻𝑧
This is a rough estimate of the frequency required to have a quarter wave displayed on the spouts
(the resolution of this pattern will depend on the number of spouts). Using Citrus, a frequency
generator in Fruity Loops Studios music production software, I determined the tube to resonate
at around 112 Hz (by determining the lowest frequency the tube vibrated at). This frequency
generated the following pattern as expected.
6
Figure 6: Laser scattering pattern at the first harmonic frequency—112 Hz. This was performed
in optimal light and air conditions. The pattern above the tube illustrates a quarter sin wave.
Abbey’s Tube will output mist from the holes (with hole diameter approximately 1/8th inch) cut
in 1” increments across the top of a 3’ acrylic tube. Scattering will be visually displayed with a
532 nm laser pointer directed at a 2” diameter mirror (for alignment) parallel above the tubes
central axis in conjunction with a Chauvet COLORband PiX-M LED fixture (this can be
substituted with any similar light fixture with a field of view that encompasses the 3’ tube).
DMX/MIDI mapped parameters include tilt and color of the COLORband PiX-M, pan/tilt of a 1”
Thorlabs band pass filter, and mounted laser pointer pan. The speaker used for creating sound
waves is a subwoofer which conveniently has a 2” bass reflex port that is coupled to the tube for
maximum air displacement. The mist generating system consists of an ultrasonic mister
immersed in a tub of water, a fan for air input, and an opening for air output. The fan is
controlled with a power supply with varying voltage, which ultimately changes the baseline
height of the mist outgoing the holes in the tube. The three servos are controlled via Arduino,
which is fitted with a DMX shield in order to input signal from Chauvet ShowXpress lighting
design software.
7
Figure 7: Schematic diagram of Abbey’s Tube.
Figure 8: Operational prototype design of Abbey’s Tube.
Initial testing of the laser pointer interference brought about a new illustration of inner-tube
pressure. A flame tube will display higher flame peaks where there is low pressure in the tube,
and lower flame peaks where the pressure is higher. Water vapor does not display this
characteristic as simply due to dissipation of the vapor as well as the influence of air in the room.
In the first round of testing, the fan rate was increased to create equal spouts. The pressure
differences were seen through variance in cone angle emitted from the spouts. This arises from
volumetric flow rate:
8
𝑄 = 𝑣 ∗ 𝐴
Where 𝑄 is the volumetric flow rate, 𝐴 is the cross sectional area, and 𝑣 is the velocity of the
water vapor. Velocity and pressure in the tube are inversely proportional, so low pressures
inside the tube correspond to higher velocities of the water vapor and smaller cross sectional
areas. The scattering from the laser beams illustrate the cross sectional area.
Figure 9: Cross sectional area of water vapor flow illustrated through scattering. When low
pressure exists in the tube there will be a higher velocity of the output vapor, and subsequently a
smaller scattering cross sectional area.
Figure 10: Example of cross sectional scattering of a HeNe laser source. Above is a
representation of a stable signal from no sound, while the bottom image illustrates the effects of
inducing a frequency in the tube.
After a couple months of testing a stationary laser pointer design, I felt that a more dramatic
effect could be seen from moving the laser pointer rapidly back and forth to create a two
9
dimensional scattering pattern across the top of the tube. This was achieved by designing a
mount which could change the pan motion with a servo.
DMX512 is the lighting industry protocol used for communicating from transmitters to
light fixtures. It seemed appropriate to implement DMX controllable parameters in Abbey’s
Tube, because one of the goals was to create a light fixture. DMX stands for “Digital
Multiplex”, with 512 representing the number of channels in one DMX universe. DMX is an
electrical signal consisting of 8-bit (byte) signals, giving a possible 256 combinations of 1s and
0s. This allows for values from 0-255 for a given data byte [4]. An Arduino with a DMX shield
was programmed to receive signals from lighting design software and send information of pan
and tilt coordinates to a mirror mounted servo. This was done with help from example code
from Conceptinetics [5]. All of the DMX controllable parameters are mapped through MIDI,
which is the musical instrument electrical signal standard. MIDI stands for “Musical Instrument
Digital Interface”. This system allows musical instruments to send and receive electrical signals
to computers and other MIDI devices. MIDI signals consist of an 8-bit status byte starting with
a 1 to denote a note-on message and 7 bits of information, which identify the message for the
data bytes that follow. A data byte corresponds to a value of 0-127 (or 1-128) for velocity, pitch
bend, control change, or program change (these are called voice messages). Each knob and fader
on the Novation Impulse 49 MIDI keyboard used in prototyping has a “Control Change” number
associated with it (CC #). Similar to velocity, each CC can output a value of 0-127. MIDI is
used frequently in live lighting design due to the parallels between CC# and a DMX fader which
outputs 0-255 data. It is important to note that this keyboard can be replaced with any other
similar MIDI keyboard with faders and knobs, and only requires slightly different computer
settings.
Problem
The goal for Abbey’s Tube lighting fixture was to create a program template on Chauvet
ShowXpress which would control the following parameters through a MIDI controller (note that
everything will be on MIDI channel 9):
1. Creating a custom fixture in ShowXpress for Abbey’s Tube. 2. Fader controlled red, green, and blue color for the COLORband PiX-M LED bar. 3. Fader controlled tilt for the COLORband PiX-M LED bar, which is constrained to
movements which are relevant to the design. 4. Master fader control for the overall brightness of the LED bar. 5. Fader controlled pan/tilt for a servo mounted mirror fixed to the right end of the tube. 6. Fader controlled pan for a servo mounted laser pointer, which is constrained to the
movements which are possible by the opto-mechanical housing. 7. Fader controlled scanning speed for the two dimensional scattering effect. 8. Drum pad mappings to pixel generated sequences for the LED bar.
10
9. Fader, knob, note, and pitch bend control for relevant parameters in Toxic Biohazard,
ultimately creating a frequency generator for the system.
The following sections will overview the hardware required, and a tutorial on how the software
and code was derived.
Tutorial
Custom Fixture
Chauvet ShowXpress is free software for intro-intermediate level lighting design. In
order to output DMX signals from the program, an external dongle is required for each universe
of 512 channels. I will be using a Chauvet Xpress 512 Interface to output DMX signals from the
computer to the LED fixture and Abbey’s Tube. I chose the Chauvet COLORband PiX-M LED
bar for its appropriate illumination profile and dimensions. At 40.9” in length, the LED bar was
remarkably ideal for bathing the 3’ tube in somewhat evenly illuminated light. It also did not
hurt that the light came with a whopping illuminance of 2321 Lux at 2 meters away, and 42
different programmable channels of DMX. The beam angle is relatively standard at 20°, which
does not apply to this system due to the close proximity of the light source to the tube.
Figure 11: Chauvet COLORband PiX-M photometric properties and lifespan [6].
With an advertised lifespan of 50,000 hours, the light fixture seems appropriate for the museum.
It was found during operation and prototyping that the LED bar was at times too bright when at
maximum illuminance. As an added bonus the fixture can be programmed to have eye catching
11
rainbow and chaser effects using the “Pixels” portion of ShowXpress. More DMX channels
correspond to greater control over the light fixture.
In order to control Arduino with DMX, I used a “DMX RDM Shield for Arduino” CTC-
DRA-10-1 designed by Conceptinetics. This hardware will attach on top of an Arduino Uno and
acts as a DMX master, DMX slave, or RDM transponder based on the jumper cable assignment
on the top of the circuit board. For the purposes of this project I will be using the shield as a
DMX slave, so that it will receive signals from Chauvet ShowXpress. The shield has a 3-pin
DMX input and output like many lighting fixtures.
Figure 12: Jumper pin configuration for receiving DMX signals. In order to upload code to the
Arduino shield you MUST change the last jumper pin on the right to 𝐸𝑁̅̅ ̅̅ .
Arduino was chosen as the programming medium for the servos due to its open source nature, as
well as its popularity in DIY projects. Although I could not find any example code for direct
DMX to servo programming, Conceptinetics’ Arduino library for DMX does most of the heavy
lifting in terms of receiving and transmitting signals. The following code is required prior to the
“void setup” portion of Arduino code.
#include <Conceptinetics.h> //Adding Conceptinetics Library for DMX Code
#define DMX_SLAVE_CHANNELS 10 //Assigning the number of channels of DMX
Control
// Configure a DMX slave controller
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS ); //Using example code from the
company who makes the DMX Shield
12
These three lines of code ensure that the Arduino will respond to 10 DMX channels, and process
the information with the included library. Next, the setup code is required in “void setup”:
dmx_slave.enable ();
// Set start address to 1, this is also the default setting
// You can change this address at any time during the program
dmx_slave.setStartAddress (1);
These two lines enable the DMX slave and allow the Arduino to react to DMX channels 1-10.
The starting address can be changed by substituting a number for (1). The DMX shield and the
corresponding library allow a DMX value to be referenced with a single line of code in the “void
loop”:
dmx_slave.getChannelValue (#)
Where # is replaced with the desired DMX channel, the line of code above represents the integer
value of the specified channel. This piece of code is used frequently to convert a DMX value (0-
255) into 0-180° angle space for servos.
To add the COLORband PiX-M fixture for Abbey’s Tube, first open the program and
click File->New Lightshow:
Name the file and click OK. This will bring you to the starting screen which displays your
fixtures in editor. This page is used for DMX assigning each of the fixtures that are desired for
use, and will later be used for assigning dipswitches to the fixtures connected through the dongle.
In order to create a new fixture click “Add Fixture”. Notice how the grey boxes represent the
512 channels of DMX.
13
The “Add Fixtures” menu has a library of popular fixtures on the left hand side of the pop up
screen. Since the COLORband PiX-M is a Chauvet product, the fixture is included in the
software bank. Click on Chauvet->DJ->COLORband PiX-M (42CH):
Select the starting address of 11 (since Abbey’s Tube will have 10 channels) and then clicking
“Patch”. The fixture will appear on the fixtures tab of editor. Next, click “Add Fixture” again to
create the Arduino controlled fixture. Select “or create a new fixture” and name the fixture:
14
Enter 10 for the number of channels (to be consistent with the code from above):
Select 1 for the starting address of the Arduino fixture and click “Patch”. This should bring you
back to the fixture menu.
Next we must configure each of the 10 channels of DMX in Abbey Laser Pointer. Double click
“Abbey Laser Pointer” shown above to open the “edit fixture” window. Right-click the first
DMX channel and click “edit channel”.
15
The first two channels will be named “Pan Control” and “Tilt Control” (these are not included in
the “edit channel” icon list). These control channels will turn on and off the pan/tilt servos and
pan/tilt servo LEDs based on a value above or below 127. When a control channel is turned off,
the servo will return to its 90° position. Channels 3 and 4 will correspond to pan/tilt servo
control of the 1” mirror, so the X and Y icons will be selected. Channels 5 will provide an on/off
control of the turnbuckle servo and the corresponding turnbuckle servo LED. And finally,
Channel 7 will provide turnbuckle servo control for the laser pointer (I selected the laser icon).
It is important to click on the icons for the pan and tilt channels so that the generator can be used
to create light scenes. The corresponding levels will be discussed in the following sections.
Color Control
The first 3 faders on the MIDI controller will be devoted to color of the COLORband
PiX-M LED bar. This will be done by creating what are called “fader buttons” in the live
window. First we must create a light scene that has two steps. The first step will send a DMX
value of 0 for the red channels to the LED bar, while the second step will send 255 to the red
channels of the LED bar. Channels 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, and 44 correspond
to the “Red” channels of the 12 individual LEDs on the fixture. ShowXpress automatically
groups all these channels together, so when one of the red channels is altered in the “Steps”
16
window it affects all 12 of the channels. This can be toggled on and off by pressing the “Toggle
Group Channels” button. Since we desire to have all 12 LEDs display the same color, we not
press the “Toggle Group Channels” button. The first step will have an arbitrary duration of time
(5 seconds in the image), but needs to be the same duration as the second step. This will ensure
that when the fader is moved the light will evenly change from no red light to red at its full
brightness. Make sure all the red channels are set to zero, and set the fade state below the
software fader to “stepper function”.
Make sure all other channels but red are “Ghosted”, which means that the software fader is red in
color and there is no value above the fader. In the example above, channels 12 and 13 are
considered “Ghosted”. This is an important concept in layering scenes since the ghosted
channels are not affected by the scene that is being made. This strategy is used frequently for
making a light scene for multiple colors. A lighting designer will ghost color channels on a
moving head fixture, so that a particular movement can be done with any combination of colors
designated in a separate set of color scenes. For the purposes of the “Red” scene shown above,
the blue, green, and dimmer channels are ghosted so that operating different faders does not
impact one another. If a green channel is not ghosted, for example, when the red fader is moved
it will impact the green channels based on the value that is set in the step.
17
After creating the first “zero” step, click on “Add Step” to create a new step in this scene.
Set the duration of the step to be equivalent to step 1. Next, move all of the red channel faders to
255. The fade state should be set to “fade function” so that the change is gradual.
Save the scene by clicking on the “save scene as” button, and name the scene “RED_1”.
Now that the scene is made we will want to open it in the “live tab”. Open the live tab and right
click the scroll down button named “Page_1” and select “add light scene”
18
After selecting “add light scene”, ShowXpress will prompt you to open a previously made light
scene. Open the “RED_1” light scene and a button in the live tab will be created for this scene.
In order to make this a fader button, right click the button and select “Fader button”.
A bar with percentage should appear below the button we have just created. This percentage
corresponds to the transition percentage between the first two scenes. Since the two scenes we
have created go from 0 to 255, the percentage will directly translate to the percentage intensity of
red. Next we want to map this to the first MIDI fader. This is done simply by right clicking the
button and selecting “button trigger”. This will open a menu where you can map the scene
button to the computer keyboard, MIDI, DMX, and even a specific time and date.
19
Select “learn” under the MIDI options and proceed to move the corresponding fader (fader 1) on
the Novation Impulse 49 controller. This process is common in most music and lighting
software.
You have now successfully created the programming to map the first fader to control the red
channels on the LED bar. The process for creating the green and blue faders is near identical, by
changing the steps to the corresponding color channels and the fader you link the scene to.
LED Tilt and Master Fader:
Fader controlled tilt and master fader for the LED bar uses principles from the previous
steps applied to a different set of DMX controls. For the tilt control on the LED bar (DMX
channel 50) we want to restrict the motion in Y (tilt) so that the step begins with illumination at
the bottom of the tube, and ends at the top of the mist heights. This was found experimentally in
the setup to be the range of 210-255. Due to the orientation of the LED bar, 255 corresponds to
the beginning step, while 210 is the end step.
20
Remember to keep every channel but 50 ghosted, and that the first step is a “stepper function”
(whether the second step is a stepper function or not is negligible). The first step (left) is set to
stepper function to ensure that when a fader is moved the DMX value is changed
instantaneously. The rest of the steps to creating a fader button are identical to the color
channels.
To create the master fader, repeat the previous steps using a DMX value of 0 for the dimmer
(Channel 52) and a value of 255 for the second step (the second step can be reduced from 255 to
limit the intensity of the LED bar). An alternative method for the master fader (which is
commonly used by lighting designers) is to directly connect channel 52 to the master fader (this
has been described in the previous lighting design paper).
Pan/Tilt/Turnbuckle Servo with DMX
In the original design, the laser pointer was mounted in a fixed position parallel to the
tube and intersecting the center of the mist pattern. A polygonal laser scanner was used in
attempt to view a two-dimensional profile of the mist, but the reflection loss of the mirrors made
the scattering pattern too dim to view. An alternative approach of moving the laser pointer
mount was tested. Two rectangular pieces of aluminum were machined to form a base and a
laser pointer mount. The pieces are connected with a steel dowel which is press fitted into the
laser pointer mount, and loosely fitted in the base to allow rotation. A servo is mounted on the
base and is connected to the laser pointer block with a turnbuckle.
21
Figure 13: Back of the envelope design for laser pointer mount (left) and the final product
created in the student machine shop (right).
This design allows for a panning effect of the laser pointer above the mist. When the servo
moves from its central point (90°) the laser beam moves horizontally across the profile of the
mist. When the servo is programmed to move rapidly back and forth in DMX software, the
effect is a cross sectional scattering pattern of the mist.
Figure 14: Laser scanning of the mist pattern illustrating the cross sectional area at each
integration point.
This is in my opinion the most dramatic effect, and when the lighting is set correctly the mist
cross section can be seen very clearly. In a dark room with the LED light turned off, the pattern
appears as it does in the image above with low pressure points in the tube corresponding to larger
scattering areas. Something to keep in mind is that the left side of the tube will appear brighter
in the scanning pattern as the power decreases toward the right hand side of the tube.
Additionally, the right side of the tube will have a larger scanning area due to the geometry of
the setup—which also decreases the scattering power directed towards the eye. Two laser
pointers can fit on the mount simultaneously if more than one cross sectional area is desired.
22
The servo mounted mirror is a simple Zitrades pan/tilt mount for SG90 micro servos (used
predominantly in remote control helicopters). A 1” reflecting optic is mounted so that incident
laser light can be reflected in a direction controlled by the user of Abbey’s Tube.
Figure 15: Servo mounted mirror attached to the right end of Abbey’s Tube. The two servo
wires will be attached to the Arduino.
These three servos are controlled using Arduino. The wiring for a servo simply requires
connecting the signal wire (usually yellow or orange) to one of the digital pins on the Arduino,
the ground pin (normally black) connected to the Arduino ground, and the power wire (red)
connected to a 5V source [7]. Using the servo library included in Arduino software, the angle of
the servo can be manipulated with a single line of code. Prior to the “void setup”, the following
code needs to be included:
#include <Servo.h>
Servo nameofservo;
The first line includes the servo library in the Arduino code; while the second establishes a servo
object which needs to be made for each servo in the design (nameofservo illustrates the name of
the servo for the rest of the code). Next, the servo needs to be attached in the “void setup” part
of the code:
nameofservo.attach(#);
# represents the pin number of the arduino which the signal wire of the servo will be attached to.
In the “void loop” portion of the code, the following code is needed to move the servo to a
desired angle:
tiltservo.write(angle)
23
Where “angle” corresponds to an angle value between 0 and 180.
Figure 16: Typical wiring for a servo to the Arduino board. To add more servos I just connected
the power wires in parallel and used digital ports 8 and 6 for the additional signal wires [7].
This design requires using 3 different servos, and the code involved has signal wires connected
to the 9th, 8th, and 6th digital ports.
For a given servo to function, I have added an on/off feature in the code which is
controlled by DMX—indicated by turning on and off an LED. LEDs are very simple to wire to
an Arduino, requiring a 330 ohm resistor connected from the 5V terminal to the LED, and the
LED connected to a digital pin on the Arduino. The Arduino can then write a “HIGH” or
“LOW” value to turn on and off the LED. To code an LED, you first need to define a constant
integer with a value equal to the pin number on the Arduino:
const int ledPinname = #;
In this example code, # corresponds to a digital pin on the Arduino. Next the “void setup” code
needs to include a line of code to set the led pin as an output pin:
pinMode ( ledPinname, OUTPUT );
This is followed by digitalWrite ( ledPinname, HIGH ) or digitalWrite
( ledPinname, LOW ) in the “void loop” to turn on or off the LED.
The main idea of the code is to determine whether or not the DMX value of a given servo
control channel is above 127. If the value is >127, the Arduino will turn on the corresponding
LED and read DMX values for the given servo. In order to convert the 0-255 signal to servo
angle, the map function was used to create a new variable in 0-180° angle space to be sent to the
servo. The code is looped so that the Arduino is continuously searching for DMX values in the
1-10th channels.
24
Figure 17: Wiring diagram for the current design for Abbey’s Tube. I used the exact breadboard
and wire color configuration as found in the physical.
CODE:
/*
DMX_Slave.ino - Example code for using the Conceptinetics DMX library
Copyright (c) 2013 W.A. van der Meeren <[email protected]>. All right reser
ved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
#include <Servo.h>
Servo panservo; //DMX Chan 3
Servo tiltservo; //DMX Chan 4
Servo turnbuckleservo; // DMX Chan 7 Create servo object to control a servo
int DMXval1=0;
int DMXval2=0; //Set DMX Value for a given channel
int DMXval3=0;
int DMXval4=0;
int DMXval5=0;
int DMXval6=0;
int DMXval7=0;
int DMXval8=0;
int DMXval9=0;
int DMXval10=0;
const int ledPinpan = 13; //Assigning LED Port 13 on Arduino for Pan DNX
Channel 3
const int ledPintilt = 12; //Assigning LED Port 12 on Arduino for Tilt DMX
Channel 4
const int ledTurnbuckle = 11; //Assigning LED Port 11 on Arduino for
Turnbuckle DMX Channel 7
#include <Conceptinetics.h> //Adding Conceptinetics Library for DMX Code
//
// CTC-DRA-13-1 ISOLATED DMX-RDM SHIELD JUMPER INSTRUCTIONS
//
// If you are using the above mentioned shield you should
// place the RXEN jumper towards G (Ground), This will turn
// the shield into read mode without using up an IO pin
//
// The !EN Jumper should be either placed in the G (GROUND)
// position to enable the shield circuitry
// OR
// if one of the pins is selected the selected pin should be
// set to OUTPUT mode and set to LOGIC LOW in order for the
// shield to work
//
//
// The slave device will use a block of 10 channels counting from
// its start address.
//
// If the start address is for example 56, then the channels kept
// by the dmx_slave object is channel 56-66
//
#define DMX_SLAVE_CHANNELS 10 //Assigning the number of channels of DMX
Control
//
// Pin number to change read or write mode on the shield
// Uncomment the following line if you choose to control
// read and write via a pin
26
//
// On the CTC-DRA-13-1 shield this will always be pin 2,
// if you are using other shields you should look it up
// yourself
//
///// #define RXEN_PIN 2
// Configure a DMX slave controller
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS ); //Using example code from the
company who makes the DMX Shield
// If you are using an IO pin to control the shields RXEN
// the use the following line instead
///// DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS , RXEN_PIN );
//const int ledPin = 13;
// the setup routine runs once when you press reset:
void setup() {
dmx_slave.enable ();
// Set start address to 1, this is also the default setting
// You can change this address at any time during the program
dmx_slave.setStartAddress (1);
// Set led pin as output pin
pinMode ( ledPinpan, OUTPUT );
pinMode ( ledPintilt, OUTPUT );
pinMode ( ledTurnbuckle, OUTPUT );// Set led pin as output pin
panservo.attach(9); // attaches the servo for pan on pin 9 to the servo
object
tiltservo.attach(8); // attaches the servo for tilt on pin 8
turnbuckleservo.attach(6); // attaches the servo for the turnbuckle on pin
6 which is capable
}
// the loop routine runs over and over again forever:
void loop()
{
//
// EXAMPLE DESCRIPTION
//
// If the first channel comes above 50% the led will switch on
// and below 50% the led will be turned off
// NOTE:
// getChannelValue is relative to the configured startaddress
if ( dmx_slave.getChannelValue (1) > 127 ) //Pan Control DMX Channel 1 On
{digitalWrite ( ledPinpan, HIGH );
DMXval3 = dmx_slave.getChannelValue (3); //Pan 0 to 18 degrees DMX
Channel 3
DMXval3 = map(DMXval3, 0, 255, 0, 180) ; // scale it to use it with the
servo (value between 0 and 180)
27
panservo.write(DMXval3) ; } // sets the servo position
according to the scaled value
else
{digitalWrite ( ledPinpan, LOW ); //Pan Control DMX Channel 1 Off
panservo.write(90);} //First channel of
if ( dmx_slave.getChannelValue (2) > 127 ) //Tilt Control DMX Channel 2 On
{digitalWrite ( ledPintilt, HIGH );
DMXval4 = dmx_slave.getChannelValue (4); //Tilt 0 to 180 DMX Channel 4
for fourth fader
DMXval4 = map(DMXval4, 0, 255, 0, 180) ; // scale it to use it with the
servo (value between 0 and 180)
tiltservo.write(DMXval4) ; } // sets the servo position
according to the scaled value
else
{digitalWrite ( ledPintilt, LOW ); //Tilt Control DMX Channel 2 Off
tiltservo.write(90);}
if ( dmx_slave.getChannelValue (5) > 127 ) //Turnbuckle Control DMX
Channel 5 On {digitalWrite ( ledPintilt, HIGH );
{digitalWrite ( ledTurnbuckle, HIGH );
DMXval7 = dmx_slave.getChannelValue (7);
DMXval7 = map(DMXval7, 0, 255, 53, 127) ; // scale it to use it with the
servo (value between 53 and 127 for range of motion)
turnbuckleservo.write(DMXval7) ; } // sets the servo
position according to the scaled value
else //This is for the turnbuckle
laster mount pan (makes cool harmonic patterns in the mist)
{digitalWrite ( ledTurnbuckle, LOW );
turnbuckleservo.write(90); } //Turnbuckle Control DMX Channel 5 Off
}
Code generated with pieces from Conceptinetics and Arduino [7,8]
This code allowed for the full control of 3 servos with DMX signal. The pan-servo was
assigned to the Arduino digital channel 9, with DMX channels 1 and 3 for control. The tilt-servo
was assigned to the Arduino digital channel 8, with DMX channels 2 and 4 for control. The
turnbuckle-servo was assigned to the Arduino digital channel 6, with DMX channels 5 and 7 for
control. DMX channel 6 was made for an additional laser pointer if RMSC desires to add one to
the mount. Although Chauvet ShowXpress was used for the DMX signal input, any DMX signal
from hardware or software can be used to manipulate the servos.
Once the code is uploaded to the Arduino and the system is wired, the custom fixture
requires the correct levels for the 10 DMX channels in the fixture editor. In the fixture tab of
“editor” in ShowXpress, double click the fixture. Select the desired channel and click on the
“add level” button.
28
Once you have added a level, you can edit it by right-clicking and selecting “edit level
This will bring up the edit level screen, which allows for selection of min and max DMX value,
along with a name and icon for the level.
29
I find it helpful to select icons that are relevant as often as possible. For example, the first two
icons represent closed and open, and are used in four of the DMX channels. You can add
multiple levels to fully classify a given DMX channel. Use the following diagram to create the
levels for the fixture:
Figure 18: List of DMX channels (left) and their levels (middle) with the influence on the
Arduino code (right). Electronic signal starts from the MIDI keyboard where it creates a value of
0-127 on a given channel, which is then sent to Chauvet ShowXpress (left and middle) and
30
converted to 0-255 DMX values. These DMX values are sent to the Arduino DMX shield
(Arduino code on right) and process data to the servos in Abbey’s Tube.
At this point a scene can be programmed for the pan servo fader. This is nearly identical
to the process for creating a color fader, with the first step corresponding to a DMX value of 255
and the second step corresponding to a DMX value of 0. The servo control DMX channels are
set to 255 for both steps:
(Note that step one starts with a DMX value of 255 for X because of the orientation of the servo)
The process for creating a fader button is the same as above (in the color control section), and the
process can be repeated for the tilt and turnbuckle servos. The tilt servo scene is nearly the same
with the following two steps:
31
Notice that the tilt control channel (DMX channel 2) is turned on for both steps to allow servo
motion. If the tilt or pan control channels are changed to a value below 127, the servo will
default to its central position of 90°. The following images show the steps for the laser
turnbuckle pan fader:
The turnbuckle servo is given a full range of DMX control (0-255), but notice in the code that
the servo is limited to 53-127°. This is due to the physical limitations of the servo mounted laser
pointer. This mount cannot allow for the servo to move past ±37° of motion:
32
if ( dmx_slave.getChannelValue (5) > 127 ) //Turnbuckle Control DMX
Channel 5 On {digitalWrite ( ledPintilt, HIGH );
{digitalWrite ( ledTurnbuckle, HIGH );
DMXval7 = dmx_slave.getChannelValue (7);
DMXval7 = map(DMXval7, 0, 255, 53, 127) ; // scale it to use it with the
servo (value between 53 and 127 for range of motion)
turnbuckleservo.write(DMXval7) ; } // sets the servo
position according to the scaled value
else //This is for the turnbuckle
laster mount pan (makes cool harmonic patterns in the mist)
{digitalWrite ( ledTurnbuckle, LOW );
turnbuckleservo.write(90); } //Turnbuckle Control DMX Channel 5 Off
}
Note how the “map” function in the 4th line of code scales to “53, 127” instead of “0, 180” as
found in the pan and tilt servos. Once the servo scenes have been created, they can be uploaded
to the live tab and created into fader buttons. Due to the many conversions from MIDI to DMX
to Arduino servo code, the resolution of the servo movement is limited to roughly 2° of motion.
This can be improved with code, but I was satisfied with the results for the purposes of the
exhibit.
Two-Dimensional Scatter with Generator Function
In this stage of the tutorial there should be 8/9 fader buttons completed. The last fader
button will involve creating a generator scene for a pan movement of the laser mounted servo.
Start by opening the “generator” tab in editor:
33
Select the “Abbey Laser Pointer” fixture located as an icon in the right hand side of the screen.
This should open a list of the DMX channels on the left.
Select the “DMX” icon located towards the top of the screen. This button will send DMX
signals through the interface in real time, so changes can be seen instantaneously.
Check the first 532 nm Laser Pointer box, and notice how the central window displays the levels
created previously for open and close. Move the black line in the central window so that the
DMX level is at 255:
34
Next, set the duration to 1 second since we want a relatively fast sweep of the laser pointer back
and forth across the top of the tube. Check the “laser” DMX channel, and move the black line to
around 127 where the laser pointer impinges the 2” alignment mirror at its center. It is helpful to
have Abbey’s Tube fully aligned for the next couple of steps. Set the Duration to 1 second to
stay consistent with the previous step:
35
The generator tab is very useful for making sequences of steps that would otherwise be very
tedious in the steps window. Think of the central window as a graph with DMX on the y-axis,
and time on the x-axis. We want to create a movement that goes from one end of the 2” mirror
to the other end of the mirror. To do this we will select “Lines” on the bottom of the graph (to
create a linear transition between points), and right click the graph to “add point”.
The image on the right describes the following movement in (DMXvalue, time-in-seconds)
coordinates:
(127, 0)1 → (115, .1)2 → (137, .3)3 → (127, 0)1
Every 1 second the movement will loop back to the starting coordinate: (127, 0)1. Continue
adding points and tweaking the coordinates so that you generate a steady movement back and
forth across the 2” alignment mirror:
36
I found that the DMX values 115-148 correspond to the laser pointer movement across the 2”
mirror. This is iterated 3 times in the span of 1 second. To save the generator you have created
select “Save project as” and name the file.
Generator scenes can be added to the live tab just like any other step scenes. Right click the
“Page_1” scroll down window and “add light scene”. Find the “generator” folder, and the scene
you have just created should be located here.
37
Once the scene has been opened in the live tab, right click the button and select “Scene
properties”:
This will open a menu which designates scene speed and whether it loops. Check “Manual
Speed” and the “Speed slider” check boxes. This will create a slider button that alters the speed
of the scene from 25% to 400%. Since the scene is 1 second long, the range of speeds will be
from .25-4 seconds.
Next, right click the button and select “button trigger”. Click “learn” under MIDI options and
physically move the MIDI fader desired (just like the previous 8 faders). At this point you
should have the following fader assignments:
38
Figure 19: Fader assignment for Abbey’s Tube. All 9 faders on the MIDI keyboard are mapped
to functions in ShowXpress and FL Studio. Pan and tilt control the servo mounted mirror, while
the turnbuckle manipulates the mounted laser pointer.
When programmed correctly, movement of a fader should not alter the effect of moving another.
This allows for simultaneous fader operation, which is especially important for color generation.
Correct use of ghosting will allow for the red and blue faders to be moved up jointly to create a
purple light on Abbey’s Tube.
Pixel Scene Generator for LED Bar
This next section of the tutorial will focus on the “Pixels” tab in ShowXpress, which is
made specifically for LED fixtures with multiple DMX channels. One of the main reasons I
wanted to use the COLORband PiX-M was for its 12 individually programmable LEDs. The
“Pixels” tab can be used to control hundreds of individually programmable LEDs in any sort of
orientation, and is commonly used for displaying images onto an array of LEDs. For the
purposes of this tutorial we will overview the creation of “Chaser effects” and “Rainbow
effects”.
Open the “Pixels” tab in editor. You should see an array of white boxes on the right side of the
screen. Right click one of the boxes and select “Add fixture”.
39
This will open up the “Fixture properties” menu. This menu is used for DMX addressing a
fixture, and allocating an array of pixels in the orientation of the fixture. For the COLORband
PiX-M we desire a 12x1 array of round LEDs. We assign the fixture the starting address of 11 to
be consistent with the fixtures settings created earlier in the tutorial. The LEDs used are 50%
round RGB pixels. This tells the program the relative size and spacing of the pixels so that a
proper effect is rendered on the fixture. To patch the DMX addresses shown on the bottom left,
select “Horizontal” for orientation, and click “Patch”. This will create a yellow 12x1 array of
pixels in the editor:
Once the fixture is properly assigned DMX values, highlight a box around the 12x1 array and
right click inside the “Effect” box to create a new effect:
40
The “Chaser effect” and “Rainbow effect” are very self-explanatory, and offer a multitude of
color and options which can generate complex color effects:
These pixel scenes can be saved and opened in the live tab like any other step or generator scene.
I have mapped 8 different rainbow and chaser effects to the drum pad using by right clicking the
button and selecting “flash button”:
41
A flash button is appropriate in this situation since it will only play the light scene when the
button is pressed and held. By right clicking the button and selecting “Button trigger”, I have
mapped the effect to one of the drum pads by selecting “learn” and pressing the corresponding
MIDI pad (similar to the process for mapping a fader). When a drum pad is pressed and held the
lights generate the corresponding effect, and when the drum pad is released the lights go back to
normal.
Figure 20: An example of a rainbow effect on the COLORband PiX-M light fixture.
The ShowXpress portion of the tutorial is now complete, and the live tab window should look
something like the following. Buttons can be rearranged by right clicking and selecting “move button”:
42
Figure 21: The button on the left is a “manual speed” button mapped to the 8th fader on the
MIDI—controlling the speed at which the turnbuckle servo moves for the 2-D scattering effect.
The next three buttons correspond to programmed mirror mount movements, and are mapped to
the MIDI buttons 4-6 located underneath the faders. The next three buttons are fader buttons for
the 3 servo movements, and are mapped to faders 5-7. The next four buttons correspond to the
LED bar color and tilt control, and are mapped to MIDI faders 1-4. The eight buttons on the right
are mapped to the drum pads on the MIDI, corresponding to different programmed light
sequences for the LED bar.
Fruity Loops Studio
This section is a slight modification from the program developed in the previous
semester, and is described more in my paper “MIDI Mapping Synthesizers in FL Studio
Simultaneously with DMX Mapping in Chauvet ShowXpress”. It is important to remember that
all of the previous MIDI mappings were on MIDI channel 9, since this was the main channel
chosen for the digital synthesizer Toxic Biohazard. The previous program had the following
mappings for channel 9:
43
In live operation, these values are the most important, and determine the percentage of a specific
channel and its left or right orientation.
The buttons below the faders are also MIDI CC buttons which output ON-OFF data either with a
0 or 127. I assigned these to turn channel 1-6 on or off.
44
This provided the main control of Toxic Biohazard. The six input waves were modified to
appropriately show how different waveforms affect the resolution of mist in the tube. I used a
regular sin wave, a sine wave with 45° phase, a sin wave with 90° phase, a sin triplet with 45°
phase, a “TriPow2” wave, and a triangle wave:
45
Next, I added a 7th knob which controlled the “drive” of the synthesizer. This acted as a
distortion to the signal, and offered an interesting effect on the mist pattern. The 8th knob was
mapped to the “Maser Volume” located next to the “drive” effect:
Another important function that helped demonstrate the effects of frequency in Abbey’s Tube
was implementing the pitch wheel. I mapped the pitch wheel to the “frequency offset” knob of
the first channel. Since the demonstration was predominantly used for demonstrating single
frequencies, the first channel was generally the only one in operation. By mapping the pitch
wheel to the frequency offset, a user could play a note and slowly move the pitch wheel to view
the drastic effects on the mist pattern:
46
I felt that the digital synthesizer was appropriately integrated, and needed no further
improvements or mappings. All faders, knobs, drum pads, keys, as well as the pitch wheel,
where mapped to Toxic Biohazard functions.
Simultaneous Operation
After programming ShowXpress and Fruity Loops Studio to map to MIDI channel 9,
both programs could be opened and operated simultaneously. This means that moving the first
fader will change the “RED_1” channel in ShowXpress while also manipulating the left-right
bias of the first synthesizer channel. More importantly, a museum patron could play notes on the
keyboard while changing the lights with the faders. By integrating everything through MIDI
channel 9 on the Novation Impulse, Abbey’s Tube could be operated entirely though the
controller. During my demonstrations at RMSC, Industrial Associates, and Design Day, I
noticed that the addition of MIDI control amplified the experience for users. A patron could
spend up to 45 minutes interacting with the MIDI controller, testing all of the parameters to
observe the resulting effects. My goal last semester for this project was to allow users to “Create
your own light show”, and I feel like I have succeeded in that endeavor.
47
Figure 22: Increased interaction from adding the MIDI controller can be seen here, where this
girl has turned off the lights with the master fader while she is playing notes!
For the purposes of this class, I have used ShowXpress to send DMX signals to Abbey’s Tube
and the LED bar, but moving forward the museum exhibit will bypass the computer. Since a
computer poses many risks to an exhibit, and can crash or malfunction, the future design of
Abbey’s Tube will directly send signals from the Arduino to the MIDI keyboard and LED bar.
Having the computer implemented in the prototyping design was very helpful in demonstrating
the programming involved in Abbey’s Tube.
Conclusion
This has been the most enjoyable work I have done to date. Not only have I been able to
create something that has never been done before, but I was able to learn more about lighting
design and the vast scope of engineering topics it covers. Most of this project involved
prototyping and proof of concept, and I learned a lot about the design process. Linking Arduino
and DMX opens up a whole world of opportunities in lighting design. Since a servo can be
scaled up to a larger size, the concept of moving servos with DMX can be used to move stage
props and larger objects to the beat of the music. Arduino has limitless functionalities, most of
which involve sending pulse width modulation (PWM) signal valued from 0-255, which is
conveniently in the same basis as a DMX signal. If more time allowed, I was going to explore
the use of a TIP120 transistor to vary voltage to the fan used in generating mist. I am proud to
have worked on Abbey’s Tube, and I will be continuing work on it this summer for the RMSC
“2015 International Year of Light” Exhibition. Again, I would like to thank you for this
opportunity to explore a topic I am fascinated with.
48
References
[1] D. Barbetta, “All Eyes are on Clay Paky B-EYE Fixtures For Lotus Tour” Clay Paky.
<www.claypaky.it> (2011).
[2] Butterfield, Anthony. “Rubens’ Tube” Department of Chemical Engineering, University of
Utah. (2011) <http://www.che.utah.edu>
[3] “Closed-End Air Columns”. The Physics Classroom. <
http://www.physicsclassroom.com/class/sound/Lesson-5/Closed-End-Air-Columns> [4] Eade, James. The DMX512-A Handbook. Cambridge: Entertainment Technology Press Ltd,
2013. Print.
[5] “DMX Library for Arduino”. Conceptinetics. (2013) <
http://sourceforge.net/projects/dmxlibraryforar/files/>
[6] “COLORband PiX-M User Manual”. Chauvet Lighting. < http://www.chauvetlighting.com/products/manuals/COLORband_Pix-M_UM_Rev1_WO.pdf>
[7] “Sweep” Arduino. <http://www.arduino.cc/en/Tutorial/Sweep>
[8] “DMX Library for Arduino”. Conceptinetics. (2013) <
http://sourceforge.net/projects/dmxlibraryforar/files/>