Quick project in-between: the DIY DMX-controller

My previous project, the printer, is currently a bit on hold. That is mainly because of waiting for some parts which will be brought by someone coming over from Germany next week. But more on this one in the next follow-up on the printer project.

Meanwhile something new came up. Another friend of mine who is running a restaurant in the city where I live, arranged a comedian to give a show in his restaurant. As I'm known by my friends for having a lot of stage light equipment, he asked me if I can help him with some spots putting the performance into the right light.

Nothing easier than hanging a few PAR56 cans on the ceiling and connect them with a simple DMX dimmer pack. But for switching them on and off (and possibly dim a bit as well) a laptop with a full-blown DMX software is probably a bit oversized. So the dmx-controller project was born. :-)

Requirements: a very easy 4 channel DMX controller with possibility to switch on/off each channel separately, to dim each channel and to save some presets. Any setup which needs more channels to control is possibly more a candidate for a more professional thing anyway.

So I decided to start with the same ATMEL based board than in the previous project. This time I took one, which was already soldered, so I only needed to take off a few components from the board, like the 7805 and a few diodes and replace the ATMEGA32 with the 1284 version. Where to get it as well as its layout for DIY you can find in the first part of the printer project.

The processor already has 2 serial ports implemented and a lot of I/O ports. Which makes life a bit easier.

A quick draft how this thing should work, so how many buttons what for, how many LEDs to indicate the status of everything was quickly done.
Unfortunately it turned out that I will at least need to connect 14 buttons and the same amount of LEDs.
Considering that already a few ports of the processor on this ready made board are used for connecting the ethernet controller, a MAX232 and ISP connector, a bit of tweaking with a serial to parallel shift register became necessary. A 74 595 is an 8 bit serial in/parallel out shift register with a latch. So no flickering of any LEDs during loading a new set of data.
Port-wise it is enough to use the shift registers for driving all LEDs. The buttons I could connect directly to the port of the microcontroller, which made it easier in programming this whole thing later on.

With the necessary conversion to RS485 interfacing for DMX (nothing else is DMX on hardware level) and two cascaded shift registers the whole layout which is needed to be soldered looks like this.

Somehow it also works to read from DMX, but I don't need that here, so didn't take care of it (would be pin 1 of the 75176) as well as the enabling for send/receive is permanently set.
The LEDs are different types. Either they are parts of the buttons or standard 5mm LEDs. All LEDs I've connected directly to the 74595. The button LEDs via 470Ohm (as they are very bright for whatever reason), the rest with 330Ohm. I didn't use any transitor or something, just connected directly to the shift register, to keep it simple. The output of 74HC595 is rated with 35mA per pin. Probably there is a total limit of it as well, but so far it works and there are usually no more than 5 LEDs switched on at the same time. So no extra transistors for the time being...



Soldering is quickly done and looks easy (at least as long as there are no other 14 connections towards all the LEDs on the board. :-)
I should probably start working with flat ribbons cables and according connectors, but somehow there is always an end that needs to be soldered.
Next topic is an enclosure which is big enough to contain the microcontroller board, the extension for the LEDs and RS485 conversation and a small power adapter.

This hole thing needs to be sturdy enough not to implode when pressing a button after I drill 18 holes into it. Looking through my stock of old and new electronic stuff revealed this grey box where I could quickly punch the necessary holes into.


Most of the time it took to create the layout and captions in a more or less proper way. I've printed it on a sticker which I covered with plastic foil to make it a bit more resistent and professional looking, as far as this attribute is applicable at all to such a quick and dirty solution. :-)


The enclosure is made of 2-3 mm ABS plastic which has the tendency to melt, whenever working with electric tools on it. If somebody knows a way how to proper cut rectangle shaped openings into such a thing without getting an intoxication of this plastic fumes, please let me know...





After endless cabling and soldering (the piece of tape on the right side is sticking a reed switch to the enclosure lid so that the device can be kind of "locked" by the software later on with a simple magnet to avoid others playing around with the buttons) ...

... this thing is at least shining a bit already. :-)


All electronic parts I've mounted with screws into the other half of the enclosure. The power adapter board I've fixed with cable tie first which connects it then fully isolated to the metal screws. As these ones are sticking out of the enclosure on the backside, it is necessary to make sure that they are not even close to any high voltage inside the box.


Next thing to solve is the software running on the ATMEGA1284 microcontroller. For that I'm using an open source framework, which brings already a lot of ready made modules written in c for connecting to many home automation devices, different protocols etc. It has a good abstraction layer so that changes of the board or layout how the microcontroller is connected can be applied easily without rewriting everything.
It requires the avr tool chain for compiling of course. I'm running it on debian and Ubuntu, so far without any bigger problems. Documentation is not the most extensive one, but there is a mailing list plus a website which is partly in english and in german:

http://www.ethersex.de/index.php/Quick_Start_Guide

The main files I needed to adjust in this framework were:

/control6/control6.scr  - contains the main script which is driving all buttons, LEDs, DMX commands and the logic how the device works,

/pinning/hardware/netio.m4  - adjustments for connecting the shiftregister and RS485 converter, etc.

This file needed to be added:
/control6/lang.d/50_io.m4 - enhancement for shift register ports usage in control6, thanks to Sven Donath: io-port-set-in-control6-aber-wie

All changed files including the configuration file for the used ethersex framework can be downloaded here: DMX-controller project files

The eeprom of the microcontroller I've used to save the addresses of the DMX channels as well as the presets. For a later software version I'm considering to set different types of devices for a channel, e.g. to connect an RGB LED washlight or something instead of simple dimmer channels only, hence I've reserved a few parts of the eeprom for storing the device type and preset values for R, G and B channels to mix colors.


It is also possible to generate a boot loader with ethersex for the atmega microcontroller so that any new software updates I'm writing as control6 script are automatically loaded by the dmx controller when connected via network cable to an tftp-server. That makes developing and testing of such a device much faster than using an ISP programmer all the time.

The finalized dmx controller connected to a standard 4 channel DMX dimmer pack:

Any questions or further ideas? Feel free to comment.


Comments