Introduction: PIC18F Based 6 Channel DMX Transmitter
Based on AN1076 - "Using a PIC® Microcontroller for DMX512 Communication". Modified and added to Microchip's code to use 6 AdC Channels for 6 channels of DMX data and the ability to offset its starting address via a 9-position DIP switch.
Designed to demonstrate a simple DMX transmitter and to test DMX Controlled lights without having to adjust their address or change anything in a prepared show if using DMX Software and USB DMX device.
It is written in Assembly and utilizes a PIC18F24J10. A bit odd as it's voltage input is 3.3v and it requires a low ESR capacitor to ground on one of its pins. I am sure the code could be modified to work on any 18F PIC with a EUSART.
There is no PCB layout, it is easy enough to construct point to point on perfboard.
Please Take a look at AN1076 From Microchip and the PIC18F24J10 Datasheet.
I apologize about my images as my camera decided to crap out with this and another project worth of images on it, so I did my best to recover and recreate them.
V2 - Updated the schematic to show the potentiometer hookup.
V3 - PIC Transmit pin was hooked up to the wrong pin on the SN75176, fixed, should be pin 16 on the PIC connected to pin 4 on the transceiver. A pretty big mistake, sorry to anyone that got screwed up by it.
DISCLAIMER: Not responsible for any damage or injuries resulting from this instructable. Damage to DMX Devices is possible if this transmitter is not built correctly.
Step 1: Supplies
Parts: (all ICs are DIP spacing)
- SN75176A - RS-485 differential bus transceiver
- 28 pin socket
- 8 pin socket
- 10 position DIP Switch
- 3.3v linear regulator, TO-220
- 16 mhz Crystal Oscillator - I used ECS-2200BX-160
- 8 pin socket
- 28 pin socket
- 6x slide or dial Potentiometers
- Female XLR, i use panel mount
- Male XLR, not really needed
- 2x 10 1/4w resistor, R3 & R5
- 100 ohm 1/4w resistor, R2
- 120 ohm 1/4w resistor, R4
- 10kohm 1/4w resistor, R1
- 10uF low ESR cap, less than 5 ohm, but most caps can still work,C1
- 2x 1uF electrolytic capacitor, C3 & C4
- 0.1uF disc capacitor, C2
- Solid strand wire
- 5v @ 500ma PSU
- DC Power Jack, I used a 2.1mm that matched my 5v power supply. Buy PSU with Matching Jack
-Enclosure, or parts to build one.
- Soldering Iron
- Diagnal Cutter
Step 2: Layout the Board
Perhaps the hardest part is laying out the circuit board. You have to consider where some things have to be, like the slide potentiometer, DMX receptacles, power jack, DIP switch ect. The RJ45 jack is for ICSP and is not necessary.
My slide pots had a 1.75" track and I spaced them 0.75" apart. Overall it is 4.5" x 4" x 1.5" high in the back and 0.5" high in the front. I chose the odd shape because I did not want to panel mount anything, I wanted all the components attached to the PCB.
I don't think my layout is optimal. The DIP switch is in an awkward spot which caused a bit of problems when building the enclosure. But overall it is quite small, which was the idea.
Step 3: Start Point to Point
There are many ways to go about this, which I am not covering here but with the board laid out in a reasonable fashion it shouldn't be to difficult. I usually start with the power traces and work my way out from there. I always avoid crossing to jumper wires over eachother, even though they should be insulated, but it is unavoidable sometimes. Just make sure that both wires insulation is fully intact.
Make sure that the potentiometer have their voltage hooked up right so the correct direction is value up or down. In my case the pot's contacts on the bottom of the board was hooked to negative and other end to positive, so when the pots were slid upwards towards the PIC, it increased the DMX value. I did it wrong first and had to go back and fix it. The pot's center should be connected to the PIC pin, the other to 3.3v(not 5v) and ground.
- The Oscillator and the SN75176 require a 5v input and the PIC requires 3.3v.
- Most 3.3v regulators have a different pinout than a 7805, so make sure and find out.
- The male XLR receptacle is not required or is the ICSP jack.
Step 4: Firmware
The firmware is based on the included code with in Microchip's AN1076. I enabled 6 AdC channels and cycle through them as they return data which is placed into Address variables, which waits to be sent.
Also added the ability to offset the start address, so instead of it always sending its first byte of data to DMX Address 1, the DIP switches can be used and set it to start at any of the addresses.
Unfortunately the only way I could implement it to work with all addresses was to use a method that produces choppy AdC results the higher the address is set to. But it works with all the addresses. Method 3
In the firmware, commented out, are two other methods to use the offset value.
Method 1: Allows the DIP switches 1 - 8 work correctly, which is DMX Addresses 1 - 255
Method 2: Allows DIP Switches 1-7 & 9 work correctly which is addresses 1-127 & 256 - 383
Method 3: Was discussed above.
Included in the ZIP on step 1 was the firmware with method's 1 & 2 commented out. And the HEX files for all 3 methods, ready to program.
A lot of PCB space can be saved by removing the offset functions, in the source code, remove all 3 of the methods and remove the "rcall OffsetAddress" and then the transmitter should always start sending at address 1.
If anyone can fix or find out a better way to implement it let me know. I have spent way to much time trying to figure it out, I have some comments on what I tried in the source code. It has to do with Indirect addressing.
Step 5: Finish Up the Electronics
Finish up the circuit as per the schematic and give it a good look over before applying any power.
Program the PIC18F24J10 in a programmer or with ICSP if you included it.
Before continuing to the enclosure, it should be tested on a DMX Device.
- Flip all the transmitters DIP Switches down or leave DIP1 up and the rest down, its the same address.
- Set DIP1 on the DMX Device, rest off. Even 10, which is a special function switch on most devices.
- Plug an XLR into the devices "DMX In" jack, which is male.
- Plug the other end of the XLR into the transmitter circuit.
- Most commercial DMX devices have an indicator light, which should begin to flash.
- Try out the potentiometers see if they are working.
If both the device and transmitter are set to the same DMX address, then Pot1 will control the first address slot on the device.
Step 6: Build an Enclosure
My enclosure is built from 100mil Polystyrene bonded with Acrylic Solvent, melts the pieces together and fuses them. Works great, but it if any is dripped where its not suppose to go, it will leave a mark that really shows up when painting.
The top panel with the holes for the slide pots is made from 25mil polystyrene which was easier to cut and was not structurally important at all.
A Couple Notes on using polystyrene
Started with the 4.5"x4.25" base piece and worked my way from there. Polystyrene can be scored and snapped but luckily I have access to a Kick Shear that works great on it. The awkwardness of the DIP switch position made it a bit harder than it needed to be, and its not that pretty but its sturdy.
Put a coat of Krylon Fusion on it, only stuff that sticks well to most plastics.
Depending on they layout you may be able to find a suitable premade enclosure but you almost have to know what your putting the circuit in when its done to know how best to lay out the circuit board.
Step 7: Finished
After the paint dries, put the circuit into the enclosure. After screwing in to the panel mount DMX receptacles, I just used some crystal clear tape to assemble the rest of it. Screws or glue aren't an option in case the circuit needs to be accessed in the future.
Put on some blue decals to spice it up and put some black vinyl with room for the slide switches over the slide pots to hide the uneven holes I had cut. And put some colored tape on the slide pots till I get some knobs.
Check out more of my Instructables through my Profile or visit my website at http://www.chromationsystems.com/
I have many projects, including Infinity Mirrors , Full Featured DMX Wash Light Driver , Simple High Power RGB LED Driver