Rev14 of the Arduino DMX Receiver Code Released

New in this Version:

  • Tested and working in Arduino 0018.

That’s it!  As per usual, you will have to replace the stock HardwareSerial.cpp in C:\Program Files (x86)\arduino-0018\hardware\arduino\cores\arduino with the modified version included in the zip file.  Get it here!

Edwin Dolby at Laser Productions had an elegant idea to address this, namely that you could use the constrain function to map out of bounds values to the correct 0-511 range.  However, I have decided not to implement this by default, as without some kind of numerical readout I think the values should just be set to what you set them.  But, easy to implement if you decide you want it!


14 Responses to “Rev14 of the Arduino DMX Receiver Code Released”

  • Simon Says:

    Thanks for the code, got it working quite easily under version 18. (with LightFactory as a controller) (Didn’t quite understand the addressing button code, so commented that out and left it as DMX Address 1 for now).

    However I don’t understand about the “serial.print” in the Actionloop sketch. From the schematic, does it send back into the MAX485? or can it be monitored from the arduino comm monitor? I tried all the default baud rates, but just got random junk. Does the serial monitor have to be at 250000 baud? or can the arduino run two clock rates at once?

    Sorry if my question is confusing, I’m just starting to get my head around it.

  • Daniel Garcia Says:

    A question – can this board/code be used to send dmx as well? If so, can it make use of the DMXSimple library from here – http://code.google.com/p/tinkerit/wiki/DmxSimple ?

  • Daniel Garcia Says:

    I answered my own question – the answer is Yes! If using the board purchased from june trading/cute digital, the output channel you need to select is pin 4. I am now happily programming my lights using an arduino board, and the june trading/cute digital version of your board.

    Thank you so much for this!

  • Daniel Garcia Says:

    Gah – pin 1, not 4.

  • Max Says:

    Hey Daniel,
    Glad to hear it. That library appears to just bitbang a pin, rather than using the built-in hardware USART.

    It seems like it would be simpler and easier to just set the USART baud rate to 250Kbps, and used a timer interrupt to feed a bit at a time to the USART output buffer. Food for thought, I guess.

    Anyway, happy it’s working for you!

  • Max Says:

    Hey Simon,
    You are right to ask about the serial.print line, you won’t be able to get anything over the Arduino IDE serial monitor, because the IDE doesn’t allow you to set custom baud rates. You’ll need to use a program like Putty, and set your input values to 250Kbps, two stop bits, no flow control. I use that code along with a shareware program called 232 Analyzer for testing purposes when I’m releasing a new version to make sure I’m receiving the correct values.
    Since the only purpose of that code is to demonstrate the idea of ‘your code here’, using a serial output command probably raises more questions than answers. I’ll pick something simpler in future versions of the software.

  • michael Says:

    Hey Max, Is it possible to set the serial baud rate to something else? Id like to interface to a PIC or pretty much anything with more than PWMs but between timer conflicts and lack of PWM, Im having trouble getting information out of the arduino. Is it possible to send out serial messages without using the default TX RX pins that are encumbered by the dmx receiver?

    Thanks!

  • Max Says:

    Hi Michael,
    The serial output is still usable, because the Max485 is set to disable output while pins 2 and 3 are set low (if you are using the shield). Setting a different baud rate could be done in the action() loop– you could set the baud rate to your desired level, and then just put it back to 250Kbps afterward so you can receive another frame of DMX.

    Your PIC should have a configurable baud rate on its USART, as well, so you could also set it to 250Kbps and then you wouldn’t have to worry about it.

    Another option would be I2C, as there are PWM ICs that accept this protocol and the usage of them wouldn’t conflict with the reception software, I think (haven’t tested that, but it’s a hardware capability of the Atmega168/328, so I can’t imagine why it would).

    Hope it helps!

  • Smittie Says:

    Hey Max,

    First of all, great work!
    Though I can’t get it to work on my arduino yet.

    I tried version 13 on arduino 17, with the modified HardwareSerial.ccp

    I’m probably making some very simple mistakes..

    Step 1 : replace the hardwareserial.cpp
    Step 2 : open receiver_rev13.pde in Arduino 17
    Step 3: Try to compile, which fails.

    It gives an error on the HardwareSerial.

    Thanks!

  • Max Says:

    Hey Smittie,
    What is the error? Also, the latest version is Rev14, for use with Arduino 0018.

    Thanks,
    Max

  • Smittie Says:

    Hi Max,

    Where can I get a copy of version 14?
    If I follow the links I only get to version 13.

    Thanks!

  • Max Says:

    Hey Smittie,

    Link is fixed, sorry!

    By the way, Rev15 is very close, I’m testing it now. Will work with Arduino 0021.

  • Smittie Says:

    Hey Max,

    I’ll try Rev15 tomorrow, I’ll let you know :D

    Thanks a lot!

  • Smittie Says:

    Version 15 compiled :D

    My mistake was to have an empty sketch open and ad the 3 files, it gives errors saying some variables aren’t declared.

    Thanks a lot and keep up the good work, it is very useful!

Leave a Reply