Adding sensors to Arduino RDM / DMX

  • Hi Guys

    I am building a set of DMX addressable units using arduinos and the common DMX/RDM sheild. Instead of using DIP switches to set the address I wanted to use RDM.

    We have a test rig working with OLA recieving data from 2 arduinos loaded with Matthias Hertel's DMXSerial2 example code.

    Its working perfectly, we have all four channels working and RDM protocol is being sent and can be changed in OLA.

    So far so good.

    Now I wish to add code for sending analog and digital sensors back to OLA. I would like to add fan speed and temperature sensors to start.

    I also would like to change the PID's like E120_LAMP_HOURS to something more relevent (we are not using a lamp, we have DC motors and servos.

    I noticed the firmware for the PIC32 based Number1 unit is sensor capable and wondered if someone on the forum could help with adding similar code to the DMXSerial2 example.

    From what I can gather from the DMXSerial2 library, the library has a structure to send the sensor data im just not sure how to work it into the loop.

    Any help would be appreciated.

    Many thanks

    Star Holden

  • nutzer99

    Approved the thread.
  • Actually, I was the one who added the sensor capabilities to the library.

    Please find attached my demo sketch I used for that (rename from .txt to .ino). It adds one temperature sensor. This should make clear how the sensor part works. You basically define the sensors you have and give that to the library. Then there is a callback function where you return the values for the sensor that is asked for.

    Kind regards,


  • Hi Stefan

    Many thanks for your contributon to the library. It really is exactly what im looking for.
    Ive edited the code to test it with an analog voltage sensor and it works perfectly thankyou.

    Im not sure how to display the output of more than one sensor. I would like to have temperature (sensor 0) and voltage (sensor 1)

    How could I call two sets of getSensorValue?

    Ive attached the edited code. Please could you have a look at it.



  • In getSensorValue() you get the parameter "sensorNr". This is the index of the sensor (from my_sensors) that you should return the values for.

    In the code you have

    if (sensorNr == 0) {

    simply add an

    } else if (sensorNr == 1) {

    and duplicate the assignments for your other sensor.

    Kind regards,


  • Ahh I see how it works now. Perfect.

    I have 2x DS18B20 and a voltage sensor now working with RDM !

    I have another hurdle if you would. You have been so helpful already.

    I would like to add the SET command: E120_RESET_DEVICE 0x1001

    Im hoping when called it could pull a digital pin LOW which is wired to the RESET pin of the arduino. The reason im using RDM is that I cannot get to the arduino it is 8meters up and dont want to power cycle the unit.

    Almost like identify command where the LED flashes except it just sends a digital write..

    What do you think?



  • Newly created posts will remain inaccessible for others until approved by a moderator.

    The last reply was more than 365 days ago, this thread is most likely obsolete. It is recommended to create a new thread instead.