Home > Advanced Projects > DMX Controller

Modified: 23:31, 26 October 2013

This controller is a neat little project even though I do say so myself. It follows on from the Analogue CPU System I designed for our school hall some 5 years ago, but with the event of DMX becoming more popular in clubs and theatres, we purchased 2 Explorer 250 head units and 2 scanners. They were great but the control desk we got with them wasn't. Very awkward to program and to use, so time to design a sister control system for or hall - a DMX512 controller with PC control.

The orignal design for this included up to 32 analogue sliders, 16 switches and 16 LED's to be connected and used to have some physical control over the lights, rather than just PC control. This has been tested and works and is waiting for fitting to a desk. However, the desk for the system is being built by a student and since this won't be completed for a time then a reduced version was also developed.

This is the reason for using a larger than needed PIC. The PIC and program can be used for either system, just the analogue inputs should be tied to ground, as should pins25-28 which are scanned by the software to see which PCB it is sat in. The software reacts accordingly.

  • 2-256 DMX channels
  • RS232 link (56K)
  • DMX output 5v @ 250KHz
  • Dedicated PC software
  • All settings set in software
  • Supply 8-18volts AC/DC
  • Current < 130mA
The circuit is surprisingly simple. The PIC micro-controller is the heart of the system running at 20Mhz driven from a crytal clock module IC4.

It communicates with the PC via a RS232 serial driver based upon MAX232 IC. With only 5 capacitors, this provides all the voltages and buffering needed from a single 5v supply. Easy! Admittedly USB is more common now but I haven't found the time to develop this and my laptop has a 9pin serial port.

The DMX signal is driven by 2 push-pull transistor drivers. Inverters provide the polarity to produce Data+ and Data- signals based on RS485. The push-pull may be crude, but its cheap and works a treat at 250KHz.


The power supply is a standard 7805 regulator to produce 5v. The bridge rectifier ensures that an AC or DC power supply of either polarity can be used. I hate having to determine which connection is + or - so eliminate the problem with a bridge rectifier! OK so you loose 1.4v etc etc.

RS232 byte transmission
Serial transmission between the PC and controller is a well known serial standard format. It takes 10 bits to send an 8 bit byte, and the next byte can begin with a start bit as soon as the previous stop bit has finished.
Byte time @56K = 178.6us

DMX byte transmission
Although each byte follows the same method the structure is more complex and too long to go into on this page. The links below show a good explanation of the DMX protocol which I used when developing the PIC software transmission routines.

    There are two programs to consider here
    • The PIC program in the controller/interface
    • The PC software (frontend)

    Both these programs talk to each other via the RS232 interface.


    This program is only 530 bytes long yet performs many tasks, thanks to the PIC's on board A/D converter and USART. It performs many tasks by executing a bit at a time, with interrupts controlling all serial communication.
    Its main task is producing a constant stream of DMX data for the fixtures.
    The rate is

    (DMX bytes x 44us) + 120us sync time
    so 256 byte DMX stream = 256x44)+120 =11.4ms

    and is transmitted every 48ms.
    All aspects of the DMX stream can be adjusted including channels, sync time and signal rate in the PC software.

    The remainder of its tasks include receiving control codes and DMX data from the PC to be transmitted in DMX format. Also it replies to requests for information about settings and status. The original design also monitors 32 analogue channels for slider control and switches for scene/fixture selection on an external panel, but this version detects the connection of pins 25-28 to 0v which effectively turns off the analogue sampling and switch sampling. I will publish the DMX Lighting desk where all the functions are implemented when I get the chance.


    This is operated by the user. It would take ages to decribe its operation but in summary:

    • It communicates with the Controller - transmitting DMX data, receiving sampled slider input data
    • Manages Scene and Fixture data so it can be recalled and sequenced
    • Manages file saving/loading.
    • Allows full control over PIC DMX generation and speed of operation.

    There are 2 versions:

    This version
    is intended for the project described here for moving heads and scanners. It has more scripts that are used for sequencing and is set in a bank of 16 sliders for heads and another of 6 for scanners as that's what we have, 2 of each. There is much more control over addresses and which units work together and the option to mirror channels. It also has a virtual joystick that can be used to steer heads and scanners together and it works pretty well. Pleased with that mod!

    I have included this version should you want to control stage lighting instead of fixtures.It is layed out the same way our power packs are back stage, 5 x 6 2KW channels. This has up to 8 scripts with fade in times and features such as Preview and Back. It has a sequencer that will play any of the scripts without fade and the speed can be adjusted. It also has presets where many sliders can be mapped onto one Colours can be set with light bars showing all outputs. It will mimic the sliders in real time making plotting of scripts easy. It is easy to split the packs into colours with blue always taking up more than its fair share.

    They both have the same System Settings screen and will detect automativally if the PCB has been wired for use as a Driver only or for use with analogue and switch sampling. This is displayed in the top of the settings window where it annoyingly says "Unknown". This is because I did the snapshot when nothing was connected.

    One admission, I'm having trouble with detecting serial port availabilty and thus is stuck on COM1 so if you haven't got a COM1 or its being used for something else, then you will have to disable it in the software - under Tools. If anyone can help me solve this please let me know.

    Below are some screenshots I took while trying to sort a bug out with the serial communication between the PC and the DMX controller, using PICO PC Scope software.
    The problem was that the serial communication is a fully duplex system but bytes were getting lost on reception.





    Below is the PCB. Note IC4 the 20MHz osc is not shown but the 4 pads are there and pin 1 is top right, next to the top of the 1K resistor. I used a 40106 instead of 4069 which is a Schmitt inverter - only because it was all I had, so if you have problems with a 4069, try 40106.

    The case was a ABS modem case with Serial, DMX and Power sockets cut into the rear panel and the 3 LED's and switch in the front. Wiring was done with SIL connectors.

    Below is a shot of the breadboard I used for testing the circuit before putting to PCB.

    Final confession, When first tested, the moving head was acting erratically, kinda twitching. After much searching, I just tried to swap the data lines over and it all worked instantly, the Data+/- were the wrong way round. Still not quite sure if I've recorded them correctly - you will have to check for yourself - sorry.

    If you want a pre-programmed PIC with version 2.0 then contact me.


    By Phil Townshend 2011
    DORSET, BH23 3QU
    Tel./Fax: 01202 474720
    Tel: 07714 096258

    Contact us by email.
    www.edutek.ltd.uk - Working Electronics For Students & Teachers