Shop OBEX P1 Docs P2 Docs Learn Events
DMX Receiving on the Propeller — Parallax Forums

DMX Receiving on the Propeller

Timothy D. SwieterTimothy D. Swieter Posts: 1,613
edited 2006-09-01 01:01 in Propeller 1
I have wanted to code a DMX receiver on the Propeller ever since I heard of the Propeller. Last weekend I finally did it! It only took a couple hours. Most of the time was spent tracking down two bugs in the assembly code.

I used the FullDuplexSerial object as an example and I coded an assembly routine for receiving all 512 channels of DMX. Coding in assembly was not too bad, the Core Docs PDF really helped to shed light on what the different commands are and some basic usage. The DMXin Object runs in its own cog and receives the DMX as fast as anything can send it. I setup an “activity" LED to blink indicating that packets were arriving.

The attached picture shows the hardware details. I used a Demo Board and built the simple circuit for level converting from RS485/DMX to TTL levels. I used the TV display for debugging and in the picture you can see that it is displaying the hex value of 156 of the 512 channels. I used an Enttec Open DMX USB device and a handheld DMX device (in the picture) for generating the DMX packets.

There is a routine in the object for retrieving a channels data out of the buffer.

I need to clean up the code before posting. I may also make the object DMX/RDM (Remote Device Management) capable. The spec for RDM was just released and I may be getting it soon.

The Propeller is so powerful - I love it!! Receiving DMX requires minimal resources of the Propeller and it is free to do what ever I want to with the DMX. Using just the DMXin Object leaves 7 available cogs and don’t forget that the DMX object is capturing all 512 channels of data. What this means is that there is a lot of processing power left to keep the function of advanced DMX lights and devices on one piece of silicone, instead of multiple chips dedicated to specific functions.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
tdswieter.com
One little spark is all it takes for an idea to explode
1280 x 960 - 556K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-23 17:55
    Very nice.· There has been talk about DMX on our Forums for a long time now, but this is the first application I have seen of it on a Parallax Product.· You will certainly make more than a few people happy.· Can't wait to see the code/schematics.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-06-23 18:12
    Not having a clue what DMX is, I typed it into Google. Wow! 14 million hits! This must be some popular protocol! But, alas, most were for DMX (Dark Man X), the rapper. For those in the same boat as I am, DMX (Digital MultipleX) is a standard designed for communicating with stage lighting. You can read about it here: en.wikipedia.org/wiki/DMX_(lighting).

    -Phil
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-23 19:00
    I don't mean to go off-topic here Phil, but you brought up a good point that makes me have to ask this question...There already was a standard for stage lighting...MIDI.· My band, and every band in the area that I knew used MIDI to control lighting.· MIDI is popular, easy to use and worked very well.· I cannot understand what about lighting would require a whole new high-speed protocol to handle.· Does anyone know?· In the future if I build a new lighting controller I would probably still use MIDI over DMX, but in my case I would be building the lights as well.· I understand existing lighting that you buy may use DMX.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 6/23/2006 7:16:53 PM GMT
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-06-23 19:06
    Sorry about the jargon. Yes DMX is a protocol for use in the theatrical/lighting/entrainment/DJ etc world. If you have ever been to a theater/concert/theme parks you have been close to DMX equipment and may have not even known it! To boil it down: A lighting fixture receives an address (0-512) and is usually set with dip switches of BCD dials. The fixture then listens to that DMX channel and the subsequent number of channels it needs for information to display lighting/video/etc. For instance - a dimmer is a simple device. Set it to a DMX channel, say 4, and then the fixture listens to the channel for a value between 0 and 255. The dimmer usually only requires a single channel and the value represents the dimmed level of lighting, 0 being off and 255 being full.

    Other instruments get more complicated - especially moving head luminaries (see Martin Lighting website). There will be multiple channels assigned to pan/tilt motor control, color scrollers, lamp brightness, etc.

    RDM or Remote Device Management was recently added to the DMX protocol by ESTA. Until RDM, DMX has a half-duplex Master-slave sort of deal. The lighting desk or DMX playback unit told all the fixtures what to do. The lighting desk simply sent 20 to 40 packets of data per second to the devices and they listened. (250K baud - variable update because of spacing within the packet) Now with RDM the lighting desk can set parameters or ask for feedback from a fixture. Where would one use this? Take lamp life for instance. As lamps get older their color temperature and effectiveness decreases. A fixture could be designed to track how many hours the lamp is on. A lighting desk with RDM or a hand held RDM device could be used to ask the fixture, "How long has your lamp been on?" With RDM we can now read this parameter of the fixtures memory.

    There are many other possibilities for RDM. At LDI (major entertainment technology tradeshow - in oct/nov) I expect to see the first few devices implementing RDM - from there who knows what will evolve.

    I have been toying around with Eagle Cad. I will see if I can create a simple schematic. Overall the circuit is really simple. Code is not too bad either.

    The above Wikipedia described DMX pretty well (I guess I repeated a lot of what it says). I also used http://www.dmx512-online.com/packt.html because I did not have the DMX spec in front of me over the weekend. I used the waitpne or waitpeq for detection of the start of the packet, from there is was simply receiving bytes. I will review my code this weekend and post.

    I have thought about creating a DMX Coprocessor or other similar devices that other could purchase for use in their products. I think this is a neat idea for an EFX product.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-06-23 19:08
    DMX is the standard for professional lighting. It has been around since early 1990, maybe even in the 1980. MIDI has been around for a long time, but there were limitis to is use. Many lighting manufactures decided to agree upon a standard in the 90's so equipment could be interoperable. Up until then it was each manufacture had their own protocol.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
  • StarManStarMan Posts: 306
    edited 2006-06-24 01:35
    Very nice.· I'm anxious to see more.

    Chris I.
  • SSteveSSteve Posts: 808
    edited 2006-06-24 02:52
    Timothy D. Swieter said...
    It [noparse][[/noparse]MIDI] has been around since early 1990, maybe even in the 1980.
    MIDI devices started appearing around 1983/1984.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    links:
    My band's website
    Our album on the iTunes Music Store
  • SSteveSSteve Posts: 808
    edited 2006-06-24 03:08
    Chris Savage (Parallax) said...
    I cannot understand what about lighting would require a whole new high-speed protocol to handle. Does anyone know?
    I'm also an old MIDI-hand. I wrote the first commercially available sysex voice librarian on the PC. It was distributed by Passport Designs. Anybody remember them?

    A few things that popped into my mind as an advantage of DMX:
    • the higher baud rate means less latency down the daisy-chain
    • data values can store 256 values in a single byte (MIDI is limited to 128)
    • 512 channels vs. 16
    • the lighting industry got to design it to do what they wanted instead of having to manipulate MIDI

    For a band's lighting setup, the limitations of MIDI are negligible. But I can imagine a large setup (imagine Paul McCartney, the Oscars, the Olympic opening ceremony, etc.) being hampered.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    links:
    My band's website
    Our album on the iTunes Music Store
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-25 03:18
    Steve,

    ·· I remember Passport well...Thanks for the information.· I will have to look at the specification in more detail.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-06-25 12:28
    SSteve - you infered MIDI in my post, but I meant DMX has been around since the early 90's, to late 80's.· To be more percious here it is according to John Huntington's Book "Control Systems for Live Entertainment" - "DMX512 was first published by the USITT in August 1986, and in 1998, maintenance of the standard was transferred to ESTA's Control Protocol Working Group."· I don't know why I did not pick this book up earlier to put more exact dates in my post.· It was not until a few years after the publication of the standard that DMX experienced growth because of consumer demand to have lighting equipment have a standardized control method.

    When talking about MIDI, there are different standards out there.· The first MIDI standard·was published in 1983.· I admit I have not had to use MIIDI much, but·MIDI exists·in various entertainment installations around the world.· I can see that it is good for small clubs and bands, but professional installations require DMX for lighting control.· There is MIDI,·MIDI Time Code (1986), MIDI Show Control (1991), and MIDI Machine Control (1992).· I recoemmend checking out John's book mentioned above - it is the authority on entertainment control systems.

    The 512 channels of DMX is known as a universe in DMX·speak and for the examples mentioned by SSteve usually many universes are needed because of the sheer number of fixtures involved and channels required.· DMX also has some other exciting developments including distribution of the network over Ethernet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-06-25 15:35
    I have attached an archive of my DMX/Propeller project.·
    ·
    In the near future I will add expand the DMX Object to include support for RDM.· I will also include support to send a DMX packet.
    ·
    Let me know your thoughts.· This was my first project with the Propeller and I love it.· I am thinking on making some PCBs for use in experimenting with DMX.· Let me know if you are interested - maybe I will get a handful made.· I was thinking it would have the Propeller, EEPROM, crystal, connection for USB2SER, headers for attaching a pigtail with an XLR connector, Level converter chip, a couple surface mount LEDs and maybe a 5V to 3.3V regulator.· I will probably make it using the QFP package.· Think of the design as a "DMX Stamp".· A little larger though than a stamp because I don't want to mess with the QFN package at the moment.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
  • Eric CornwellEric Cornwell Posts: 1
    edited 2006-07-20 21:23
    Timothy, I am glad you are doing this, otherwise I would have to drop all of my current projects and waste the rest of the summer playing with this amazing new chip. I do make a point of skimming the Parallax web site every month or so, but somehow this slipped past me until last night.

    Looking over your project to try to understand a little about how it and the Propeller work, I think I may have noticed a minor flaw. It looks like you are assuming that the packet size is always 513 frames, which in not the case. Many DMX sources transmit shorter packets if they are not using all the frames. And I as I recall RDM uses very random packet sizes.

    You can detect a short packet if a break comes down the line when you are expecting another frame. It will appear as a a 00 byte, but then no stop bits. Confirm that your stop bit is a 1. If not there is either a framing error or it's a short packet.

    The possibilities the propeller chip presents are boggling. Dang, I wish I had more time to get into it!

    -Eric
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-07-20 23:51
    Thanks for the post Eric!·

    You are correct on many fronts:
    -Yes the Propeller is amazing
    -Yes the software posted does assume 513 frames

    I got distracted with a couple other projects (mainly planning a wedding and work)·and so I have not returned to this project yet.· I will consider your advice when time allows, thank you for posting.· So far the DMX routine has worked with the four devices I have tested it with, but I had not considered making my·code more robust.· I did do some plugging and unplugging of the DMX cable·though and I never seem to lockup the Propeller and would still receive data after I plugged the unit back in.· I doudt that I was plugging/unplugging·at·packet boundaries.·Hmmmm.....

    I also understand that RDM can have varying packet lengths, I have not seen a full spec yet (again with the other projects distraction and money to buy the spec).

    Bugger - now I am going to have to find time this weekend to look back into my code to prove/disprove your theory. Stay tuned.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
  • John CoutureJohn Couture Posts: 370
    edited 2006-08-25 02:50
    Hey guys!

    The DMX looks a awful like it uses standard RS485 chips (i.e. SN75176). Couldn't you create a simple DMX slave with one of those, an MCU and a couple of Quadracs?

    The SN75176 chip would handle the talking to the network, the MCU would determine what addresses to listen to and the Quadrac could be the "dimmer" (assuming, of course it has a high enough amp rating).

    Or am I way off base (as usual).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2006-09-01 01:01
    Hi John -

    DMX is RS485 phsycially and it has a defined protocol for messages (@ 250K BAUD). There are a couple of other minor differences as well. I have not used the SN75176, but many people use the SN75156B. In the picture above I used the MAX487E. A DMX device is usually the RS485 transceiver chip and a processor and other circuitry to do something (Lights, LEDs, fog machine, etc). The trick in the past though was having enough processing power (time) to do the other things while watching the DMX stream. Usually the processor operated off of interrupts for counting the channel data and only recorded the channels that the device needed (set by dip switch usually - the device address on the DMX network) With the Propeller I had no problems receiving and recording the entire DMX stream as fast as 30 to 40 frames/second. I also had 7 processors left to do anything else that I wanted.

    I am excited about the power of the Propeller and my DMX project was just my first jump into doing assembly programming with the Propeller and seeing what I could do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter
    tdswieter.com
    One little spark is all it takes for an idea to explode
Sign In or Register to comment.