Electronza
  • Homepage
  • Privacy
    • Privacy Policy
  • Contact
Electronza
  • Homepage
  • Privacy
    • Privacy Policy
  • Contact
Electronza
You are at:Home»Electronics projects»Arduino projects»ARDUINO: DMX Console
Arduino UNO DMX console with Mikroe RS-485 click
Arduino UNO DMX console with Mikroe RS-485 click

ARDUINO: DMX Console

3
By Electronza on April 28, 2017 Arduino projects

Today’s project is a remake of my older DMX master, this time allowing for more user control, with six sliding potentiometers and five scene buttons.

I will start with one Arduino Uno, with one Sparkfun ProtoShield on top. On the ProtoShield I’ve soldered some screw terminals, which will later be used to connect the buttons and the potentiometers. On top of the ProtoShield I’ve placed one Arduino Uno click shield from MikroElektronika, with one RS-485 click board installed in socket #1.

Arduino Uno - the brain of the DMX console
Arduino Uno
Arduino Uno, plus Sparkfun protoshield with screw terminals
Arduino Uno, plus Sparkfun protoshield with screw terminals
Arduino with protoshield and click shield installed
Arduino with protoshield and click shield installed
Arduino DMX console electronics
Arduino DMX console electronics
Clearance for the screw terminals
Clearance for the screw terminals

Notice that the screw terminals are not very high, so there’s enough clearance between the top side of the screw terminals and the Arduino Uno Click shield.

Then, I’ve placed five sliding potentiometers and five buttons in the case. As a side note, while the sliding potentiometers allow for a nice and fine control, they are a pain in the well-you-know to install. Cutting the slot for the slider can become a big issue without proper tools.

One can use the regular, rotary type potentiometers with no side effects. Just keep in mind to order linear potentiometers and not the logarithmic ones.

DMX console - assembling detail
DMX console – assembling detail

 

I have also used one XLR panel connector for the DMX cable. Connections are as follows:

  • XLR pin 1 – GND
  • XLR pin 2 – DATA- (B)
  • XRL pin 3 – DATA+ (A)

Both power and programming are done via an USB panel adapter, which has one USB-B on the outside and one USB-A on the inside. Pretty expensive, but does a nice job. From that connector to the Arduino I used a standard USB cable, which stays inside the case.

USB panel adapter - outside
USB panel adapter – outside
USB panel adapter - on the inside
USB panel adapter – on the inside

 

Some pictures from the assembling process. Note that pins D0, D1 and D6 are used by the RS-485 click board, so the buttons are connected to pins D2-D5 and D7. Potentiometers are connected to pins A0 to A5.

Arduino DMX console: assembling detail
Arduino DMX console: assembling detail
Arduino DMX console: connecting the buttons
Arduino DMX console: connecting the buttons
Arduino DMX console: conecting the potentiometers
Arduino DMX console: conecting the potentiometers

 

DMX console Arduino code

The code is a variation of the older DMX master, and it still uses the Conceptinetics DMX library. The difference is that now it checks whether the buttons are pressed. If a button is pressed, then the corresponding scene is run. If buttons are not pressed, the values from the potentiometers are mapped to the [0..255] range and sent over the DMX bus.

/*
  DMX_Master_console.ino - https://electronza.com/arduino-dmx-console

  *******************************************************************************
  This code uses the Conceptinetics DMX library
  Copyright (c) 2013 W.A. van der Meeren <danny@illogic.nl>.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/


#include <Conceptinetics.h>

#define DMX_MASTER_CHANNELS   6

//
// Pin number to change read or write mode on the shield
//
#define RXEN_PIN              6

// Configure a DMX master controller, the master controller
// will use the RXEN_PIN to control its write operation
// on the bus
DMX_Master        dmx_master ( DMX_MASTER_CHANNELS, RXEN_PIN );

int ch1_pot;
int ch2_pot;
int ch3_pot;
int ch4_pot;
int ch5_pot;
int ch6_pot;

int ch1_dmx;
int ch2_dmx;
int ch3_dmx;
int ch4_dmx;
int ch5_dmx;
int ch6_dmx;

void scene1 (void){
  // 10 seconds blue
  for (int i=0; i<10; i++){
    dmx_master.setChannelValue (1, 0);
    dmx_master.setChannelValue (2, 0);
    dmx_master.setChannelValue (3, 255);
    dmx_master.setChannelValue (4, 255);
    dmx_master.setChannelValue (5, 0);
    dmx_master.setChannelValue (6, 0);
    delay(1000);
  }
}

void scene2 (void){
  // 10 seconds blue
  for (int i=0; i<5; i++){
    dmx_master.setChannelValue (1, 255);
    dmx_master.setChannelValue (2, 255);
    dmx_master.setChannelValue (3, 255);
    dmx_master.setChannelValue (4, 255);
    dmx_master.setChannelValue (5, 0);
    dmx_master.setChannelValue (6, 0);
    delay(1000);
  }
}

void scene3 (void){
  // 10 seconds blue
  for (int i=0; i<5; i++){
    dmx_master.setChannelValue (1, 255);
    dmx_master.setChannelValue (2, 0);
    dmx_master.setChannelValue (3, 255);
    dmx_master.setChannelValue (4, 255);
    dmx_master.setChannelValue (5, 0);
    dmx_master.setChannelValue (6, 0);
    delay(1000);
  }
}

void scene4 (void){
  // 10 seconds blue
  for (int i=0; i<5; i++){
    dmx_master.setChannelValue (1, 0);
    dmx_master.setChannelValue (2, 0);
    dmx_master.setChannelValue (3, 255);
    dmx_master.setChannelValue (4, 255);
    dmx_master.setChannelValue (5, 255);
    dmx_master.setChannelValue (6, 0);
    delay(1000);
  }
}

void scene5 (void){
  // 10 seconds blue
  for (int i=0; i<5; i++){
    dmx_master.setChannelValue (1, 0);
    dmx_master.setChannelValue (2, 255);
    dmx_master.setChannelValue (3, 255);
    dmx_master.setChannelValue (4, 255);
    dmx_master.setChannelValue (5, 0);
    dmx_master.setChannelValue (6, 0);
    delay(1000);
  }
}

// the setup routine runs once when you press reset:
void setup() {

  // Enable DMX master interface and start transmitting
  dmx_master.enable ();

  // turn off all channels
  dmx_master.setChannelValue (1, 0);
  dmx_master.setChannelValue (2, 0);
  dmx_master.setChannelValue (3, 0);
  dmx_master.setChannelValue (4, 0);
  dmx_master.setChannelValue (5, 0);
  dmx_master.setChannelValue (6, 0);
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  pinMode(4,INPUT_PULLUP);
  pinMode(5,INPUT_PULLUP);
  pinMode(7,INPUT_PULLUP);

}

// the loop routine runs over and over again forever:
void loop()
{
 if (digitalRead(2)==0){
   scene1();
 }
 if (digitalRead(3)==0){
   scene2();
 }
 if (digitalRead(4)==0){
   scene3();
 }
 if (digitalRead(5)==0){
   scene4();
 }
 if (digitalRead(7)==0){
   scene5();
 }

// read apotentiometer position
ch1_pot = analogRead(A0);
ch2_pot = analogRead(A1);
ch3_pot = analogRead(A2);
ch4_pot = analogRead(A3);
ch5_pot = analogRead(A4);
ch6_pot = analogRead(A5);

// compute DMX values
ch1_dmx =  map(ch1_pot, 0, 1023, 0, 255);
ch2_dmx =  map(ch2_pot, 0, 1023, 0, 255);
ch3_dmx =  map(ch3_pot, 0, 1023, 0, 255);
ch4_dmx =  map(ch4_pot, 0, 1023, 0, 255);
ch5_dmx =  map(ch5_pot, 0, 1023, 0, 255);
ch6_dmx =  map(ch6_pot, 0, 1023, 0, 255);

// update dmx bus
dmx_master.setChannelValue ( 1, ch1_dmx);
dmx_master.setChannelValue ( 2, ch2_dmx);
dmx_master.setChannelValue ( 3, ch3_dmx);
dmx_master.setChannelValue ( 4, ch4_dmx);
dmx_master.setChannelValue ( 5, ch5_dmx);
dmx_master.setChannelValue ( 6, ch6_dmx);
//
delay(100);

}

This code version doesn’t use interrupts, so one has to wait for a scene to finish before pressing another button. The potentiometers are ignored within a scene.

Also, when the scene comes to an end, the DMX changes to the values of the potentiometers. If desired,  a fading routine can be implemented in software.

A few final thoughts

While this is working fine, I already plan for a bigger version. I want to use one Arduino Mega, with 10 potentiometers. The Mega will also allow for more buttons.

A remote control is also possible – there’s a wide range of wireless click boards from MikroElektronika, and even the current version has one free mikroBUS socket. One can trigger different scenes by using motion sensors, buttons, etc. Imagination is the only limit. Have fun!!!

RS-485 DMX Uno Click Shield MIKROE-925 code XLR Eurolite screw terminals USB
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

Related Posts

Prettifying preformatted text

SDS011 - HPMA115S0 - Arduino Due

A comparative test of two particle sensors

4-20mA thermometer

Arduino: 4-20mA thermometer

3 Comments

  1. Alec Thomson on September 2, 2017 6:31 am

    just found your project, just after i started building mine.
    Lets just say were 2 different worlds away with arduino’s
    great work

    Reply
  2. felix on April 17, 2018 9:24 am

    I’m looking for a way to simply control a dimmer, so just 1 potentiometer to control the brightnes and than three buttons or even better switches to turn on three different sinus waves for beautiful blinking effects, the device should only address one dmx address, can anyone help?

    Reply
    • Teodor on April 17, 2018 3:06 pm

      Dimming is the easy part. Just read the potentiometer (https://www.arduino.cc/en/tutorial/potentiometer), then map the value in the range [0,255] and send the updated value to the DMX channel of your choice.

      Playing the effects is a bit more complex. Is it really necessary to do the sinus wave? Or you can simply go with a linear dimming?

      If you wish to go with the sinus wave, then you have to build a look-up table (a vector) which contains the values for the dimmer, then update the DMX bus at a delay that depends on the desired speed of the effect. You can put the whole code inside a while loop (https://www.arduino.cc/en/Tutorial/WhileStatementConditional) and run the code for as long the button is pressed.

      Reply

Leave A Reply Cancel Reply

Latest posts
January 15, 2023

A pretty text box for Blogger posts

January 15, 2023

New blog section: beginners’ corner

January 15, 2023

Cleaning unused images from blogs hosted on Blogger

Categories
  • Beginners' corner
  • Electronics projects
    • ESP8266
    • Arduino projects
    • IoT
    • 8-bit PIC projects
    • Raspberry PI
    • PIC32 projects
    • Robots
  • Arduino libraries
  • Reviews
    • Tools & equipment
    • Development boards
    • IoT
    • Industrial Arduino
  • Blogger / Blogspot
  • Tutorials
  • Casual stuff
Popular posts
Arduino Uno 4-20mA communication using 4-20mA R click and 4-20mA T click boards from MikroElektronika: MIKROE-1296, MIKROE-1387, Uno Click Shield
August 17, 2016

4-20mA current loop Arduino tutorial Part I: hardware

ESP8266 Thing Dev from Sparkfun
May 15, 2019

ESP8266 – running on battery power

ECG click on Arduino Uno
December 5, 2016

ECG click: Arduino IDE code examples

WiFi3 Click - esp8266 in click board format
March 15, 2017

ESP8266: AT mode webserver tutorial

Honeywell HPMA115S0-XXX particle sensor
November 23, 2017

Arduino: measuring PM2.5 and PM10 with Honeywell HPMA115S0

Copyright © 2023 Teodor Costachioiu

Type above and press Enter to search. Press Esc to cancel.