Articles Hierarchy

Articles Home » Arduino Projects » ARDUINO PROJECT: DMX

ARDUINO PROJECT: DMX

DMX

From STAGE - LIGHT and SOUND technology comes this old serial link
protocol for control distributed fixtures from a master panel.
now with home automation getting public this old standard is revived.

in the ARDUINO community there are 2 approaches to DMX,
-- DMX sender to a DMX slave ( like DMX LED driver ) where a Dout try to simulate
the serial DMX protocol.
-- DMX slave ( doing PWM to outputs for driving LED...)
and listen to a DMX sender via the serial port ( what is normally used as USB to PC )
seems to need some hack of ARDUINO to run.

DMX hardware
DMX is running on RS485 serial hardware, a 2 wire multidrop link up to 1200m
for this need a driver IC, i use SN 75176.

but first i wanted to build up the extension board, ARDUINO Proto Shield V 4
price high, no documentation, i got some circuit, but wrong, but also
the board seems not to be well planned. like i found for the copy of the reset button
( you need because if the board is plugged upon the arduino board
the reset there is not easy accessable )
but it looks like the circuit wants to use a 10k resistor for pull up,
but that is already on the mainboard, so its a parallel resistor/ == 5kohm /, not a real problem.

anyhow, why need a PCB for wire one IC?
it is a very bad thing from the ARDUINO motherboard PCB, there are 2 rows of
header for plug in the shield board, left analog and power, ok, right side
digital i/o 0..7 and 8 .. AREF. as 2 headers, where the distance between them is not in the norm raster.
so you can not use a normal experiment board und put header pins on.
i think its not just a mistake!

with the DMX circuit it looks like this:


DMX software arduino

there is some code for DMX output to a digital pin, timing by assembler code, i want to test first.
setup as a new project, inside my latest menu structure,
-1- select DMX slave add
-2- select 4 color values and write to slave
-3- fade up down

DMX software processing
for the operation from the PC i want test the processing environment
( instead of the above used terminal software )
what is it? it is a java package what looks at the first look nearly same like the arduino software.
With it you can make small fast little programs for the PC, what gives us back the programming power
what they take away from us after DOS basic, when they downgraded us from programmers to windows users.

I liked it from the beginning. And may be as hundreds of arduino / processing beginners
i startet with the SLIDER, a setpoint input for my RGB DMX LED project.


On ARDUINO my terminal menu runs ( at 19200bd).
for communication with processing i use following trick:
a "r" for REMOTE switch from terminal input to dmx remote control ( and never leave it again until reset ).
to tell the remote application that its ready ARDUINO sends back one "a".
From slider input i can set 4 channel ( 4 bytes for RGBI ), now a ( required) keyboard input to processing
allows to adjust a slave add. The channel setpoints are stored to the 512 channel array
( must use integer ) like a input
slave 3, R=255, G=123, B=0,I=99 stores in array
0,0,255,123,0,99,0,0,....
at next operation ONLY the 4 words are overwritten,
means now u can set all 512 channels with that 4 channel input slider tool,
just by changing slave add / start channel.
( at program restart all channel array is 0 (no memory for fixtures until now))
after a setpoint input the whole array is send to ARDUINO.
and each channel send by DMX macro to RS485 shield.
There is now also a array (512 byte) at arduino,
but not as memory after reset, power, usb connect.


The first LED hardware drops in.

-- RGB LED STRIPS
they come in adjustable length ( just cut ) and have 4 solder points.
+12V, R, G, B.
On the flexible strip see the LEDS ( 6 pin )
and one resistor per LED.
12VDC --- xxx? ---
---|>|--- R
+--|>|--- G
+--|>|--- B
so the RGB output from strip must be connected to a driver ( MOSFET ) drain to ground (0 V DC)

Arduino can not drive that power,
and i only run on the USB power until now, so i use the

-- LT -3060 LED Power Repeater from Zhuhai Ltech Electronic Technology Co., Ltd
LTEC
where on the signal input i connect the 5VDC and 3 pwm outputs from ARDUINO directly.

These signal input spec is not available.





The signal inputs are not very high ohm inputs ( some mA run from ARDUINO),
and i am not happy to run ( my USB ) 5 VDC directly to that box,
but testing a 100ohm resistor as a minimal protection
in the 5Volt wire already gave me some funny color on the strip.
But running a few mA is also good ( not only Volt),
signal is more stabil, and a 4 wire telefon cable with 10m works fine between ARDUINO and repeater.

Where delta volt 5 means (1) ( at pwm output (0)), dout pwm 255 (1) would mean 5VDC to 4.8VDC
this must be (0), in other words, the pwm signal is to be inverted by the ARDUINO code ( 255 - DMX byte ).

I want to integrate that in the DMX ( master) project, so the add 3 PWM outputs RGB
are kind of DMX slave copy. means the setpoints come from PC ( processing slider ) in the
DMX style array. The 3 PWM outputs need a base address ( to read from the DMX array )
like 509 ( R = 510, G = 511, B = 512)
but still this set values are in the DMX array and send to RS485,
so you understand the above used word COPY.

All works nice but there is a twist in the green and blue color, and i dont find the mistake.
no other way as to twist that 2 signal wires.

i already suspect the USB cable (LOL)

6.b local operation As long i wait for some DMX slave hardware ( for test the RS485 link) i could try
to build some local control.

Until now power and setpoint come from PC.
If i power the ARDUINO by the external LED 12VDC system it could run
and send PWM to repeater, but only the preset color, now "half white".

-- Most obvious are 3 10k poti / slider type / on analog input of ARDUINO.
-- A touch screen input for ARDUINO

why should i work on some expensive devices what alread exist
( for 300 $ ... 500 $ get DMX master PDA style with touchscreen and color wheel for wall mounting...)
i can use the PC, a netbook and a ARDUINO as DMX transducer or PWM output is even cheaper,

or i find a new way:
if i can control the color by Arduino i dont need a additional hardware input device
( from slider over touch color wheel to touchscreen ) because the show i can do in arduino
ramping colors, intensity by a program and the user decide by a pushbutton
where to stop / what to use.
30 years ago i build a touchdimmer with a 555 IC, so the hardware poti is definitely out of date.


++ THE MOODY PUSH BUTTON (TMPB) ++
yes, ONE BUTTON on the ARDUINO and i call it a new project ( ! beginner ! ) LOL
some kind of, i even had to delete some unused software from the DMX ++ menu software
to get the Push Button software running ( not got compiler or upload error,
just the program did not work, the serial interface send only half of the text... )

TMPB logic detect:
-+- one click
-+- one double click
-+- one long click ( start and end )
--- eliminate glitches
( all timing might depend on the push button hardware ( and your usual double click speed )
and a conveniant ramp speed )

The 4 events are send to main program control.

TMPB program use:

on one click: toggle POWER/LIGHT ON / OFF ( last known color setting )

on one double click: select one of the three colors and show it, so operator know
what color he would operate by using long click.
on next double click: select next color ...

on long click change the selected color by a UP DOWN RAMP and show the color mix
on release long click: just keep that color ( until reset or PC remotecontrol...)

HMI is a difficult thing, but if u think your 80 year old mama has to use that color wheel PDA
to switch on the light!

so ONE push button and one tip on it for ON and OFF
and a double click for color programming mode,
i think that is better operation concept for RGB house installation.
And its cheap, a ARDUINO with n parallel installed pushbuttons ( on one input)
for the room / house for one RGB setting.
( but i agree, you have to get used to that kind of operation)

hardware setup


shield add on circuit

the remote control ( DMX processing slider setpoint) disables local pushbutton operation.

TMPB2 what can be better as one button, two button?
no, same concept, one button, one RGB PWM output
but two times in one ARDUINO.
deleted serial menu, DMX...
just one arduino for 2 RGB fixtures / for a house installation.
arduino powered by the same 12 VDC as the strip and the power repeater.

now in V03 we test some new features,
until now we used 3 slider type RGB ( from black to full collor )
( or a softwareramp showing this again and again ... )
as often used for internet / HTML, but also in DMX Master devices,
a HSI, for Hue, Saturation, and Intensity concept as other option to RGB operation
is implemented. Where the

-- HUE: is the so called color wheel
0 .. 360 grad, 6 step, where alternating one color is 255, next is 0, next is ramped up or down.

-- Saturation is 100% for any of above by HUE selected colors.
ramp Saturation down to 0% means ramp up the smaller colors to the highest.
depending on Intensity this ends up in WHITE or grey to black.
A small change like this we see as a softening of color wheel colors.

-- Intensity is like a Dimmer where the color / the ratio of the RGB / is not changed

again this are 3 sliders to reach the same color space as with the 3 RGB sliders,
just a other concept.

I leave it to you to select one or the other operation concept,
default now is HSI. RGB optional.

for the ramp shows a sinus type ramp is used, actually a (1 - cos())*128,
instead of the triangle wave ( ramp up / down )

check out the source code with lots of more info.

6.c remote operation
back to processing:
the TMPB version from above ( only with one button and one RGB PWM )
copy back to DMX project ( as local operation concept ),
but instead of the RGB sliders for remote operation now can use the COLOR CUBE as setpoint input

On a slider type DEVICE seletion tool one of 512 DMX add. can be selected.

If there is a fixture configured ( read from EXCEL CSV / ASCII file )
one of above 3 operations is possible.

-- ON OFF just on click change black white and send "0" or "255"

-- DIMMER the moonlight slider from left to right, 0 .. 100 .. 0, send on click 0 .. 255
-- RGB the color cube ( from processing examples ) mod as a setpoint input, mouse moves cube
the center pixel color is read as setpoint, send on click. see also video



DMX_CUBE setpoint video:


TMPB video

This version ( without tested DMX hardware ) source code


Try DMX software to test with a DMX slave.
I got the
LEDWALKER DMX512 decoder LW-D6PWM from LEDWALKER Technology Co, Ltd
manual

frontview



hardware connection

sorry nothing worked, not even the FUN dip switch


Together with PROCESSING, ARDUINO and DMX i run into a problem,
ARDUINO:
byte
Description
A byte stores an 8-bit unsigned number, from 0 to 255.
PROCESSING:
byte
Datatype for bytes, 8 bits of information storing numerical values from 127 to -128.
DMX:
A grouping of eight bits, called a byte, is used to carry one piece of information.
This ‘information’ is simply a value ranging from 0 to 255.
DMX 512 data is transmitted at 250 kiloHertz (kHz). A single transmission (DMX Packet)
includes synchronizing elements and channel data for up to 512 channels.
At a minimum, a fully loaded DMX Packet (data for all 512 channels) will be around 5700 bits in
size. This means about 44 DMX Packets can be sent each second.


Having problems to get hold of a DMX device to test the DMX Master software
and to get this project to a 1.0 revision i decide to start a new project:
build a DMX slave also with ARDUINO see DMX slave

lucky i have 2 computer, 2 ARDUINO ( 2009 and uno ), and 2 SN75176BP
so i can start right away.

please read next about project OSZILLOSCOPE