I have a product! It’s an arduino microcontroller that receives a DMX signal and does things with it!
What it does well:
- Successfully receives a DMX signal
- Interprets the data sent by the signal
- Acts on the data: for my sample implementation, channel 1 dims a red LED, channel 2 triggers a green LED on/off, and channel 3 triggers a blue LED on/off
Known issues with it:
- I cannot yet receive all 512 channels in the protocol. I was unable to determine why; if I had to guess, I’d bet on it being something involving memory usage. I tested it up to 24 channels successfully.
- It cannot have two of the LED’s on dimming systems simultaneously. Something about the timers and interrupts in the language/hardware gets royally screwed.
- It occasionally fails on for a split second. That is, the signal coming in is saying “0%,” and for a brief moment the controller reads “100%? Alright!” from memory. It then resets to the correct value, but it’s quite annoying.
Honestly, this was not quite the result for which I had hoped. Surely I could have developed a more reliable program! After all, the data format is well-defined, and the algorithm I designed while planning this project accounted for everything within the data format.
That said, I’m pretty proud of what I’ve accomplished. First, I was able to get the correct set of ones and zeroes coming in at all. Not too shabby, considering there were 250,000 of them coming in every second. Additionally, I was able to match the pace of the signal format, correctly interpreting the beginning few data packets of every set of 512 that came in; again, not too bad, considering there were probably about thirty of those coming in every second.
On top of that, I did nearly all of this project in AVR assembly code, which is pretty damn cryptic. Here’s a section from my code:
"Readbit:" "\n\t" "SBIC 0x09, 0x02" "\n\t" //1 "ADD r16, r17" "\n\t" //1 "LSL r17" "\n\t" //1 "BRCS Storebyte" "\n\t" //1f2t "nop\n\t""nop\n\t""nop\n\t""nop\n\t" //4 "nop\n\t""nop\n\t""nop\n\t""nop\n\t" //4 "nop\n\t""nop\n\t" //2 "CALL Delay48" "\n\t" //48 "RJMP Readbit" "\n\t" //2
The above code was part of my method to read in a byte of data. Imagine a whole lot of that (albeit with more comments reminding myself of what each line was doing) and you basically have my project.
Overall, I’m pretty pleased with what I was able to learn from this project. No, it wasn’t the product I wanted, but I now know a ton about how to program in the Arduino environment and in AVR assembly language. I also know exactly how a DMX512 signal operates. In all, not a bad take-away for my time this summer.
Plus, I still have 400 transistors in a desk drawer next to me. So if you need any transistors… just let me know.