Sebastian Wiessner
Published © GPL3+

DMX RGB LED Outdoor

Low-cost outdoor lights with DMX control.

IntermediateFull instructions provided20 hours26,127
DMX RGB LED Outdoor

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Adafruit PCA9685 16PWM Channels I2C
×1
own PCBs
×1

Software apps and online services

Arduino IDE
Arduino IDE
freestyler DMX control

Story

Read more

Schematics

Arduino-Base PCB with DMX - Schematics (Eagle)

universal Nano base with DMX input and PWM / I2C output

Arduino-Base PCB with DMX - Board (Eagle)

distribution PCBs for ribbon cables - Schematics (Eagle)

5x 3 ch. (15x PWM) distribution with 12V (+/-) input

distribution PCBs for ribbon cables - Board (Eagle)

3x PWM constant current source - Schematics (Eagle)

3x 350mA / 12V source with PWM inputs

3x PWM constant current source - Board (Eagle)

3x PWM constant current source - part list

Arduino-Base PCB with DMX - part list

Code

DMX Version

Arduino
Control program for 5x 3channel RGB lights
// 15 PWM on 5 RGBs LEDs / DMX Start-Address 200 / 5x 3channel R G B

#include <Conceptinetics.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>


Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

#define DMX_SLAVE_CHANNELS   15
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

int channel[16];
int channelOut[16];
int value[16];
int ch = 0;
int red = 0;
int green = 0;
int blue = 0;



void setup() {

  Wire.begin(); // join i2c bus (address optional for master)
  pwm.begin();
  pwm.setPWMFreq(120);  // This is the maximum PWM frequency
#ifdef TWBR
  // save I2C bitrate
  uint8_t twbrbackup = TWBR;
  // must be changed after calling Wire.begin() (inside pwm.begin())
  TWBR = 12; // upgrade to 400KHz!
#endif

  // DMX set up
  dmx_slave.enable ();
  dmx_slave.setStartAddress (200); 

  // set all PWM to high -> LEDs off
  pwm.setPWM(0, 4096, 0 );
  pwm.setPWM(1, 4096, 0 );
  pwm.setPWM(2, 4096, 0 );
  pwm.setPWM(3, 4096, 0 );
  pwm.setPWM(4, 4096, 0 );
  pwm.setPWM(5, 4096, 0 );
  pwm.setPWM(6, 4096, 0 );
  pwm.setPWM(7, 4096, 0 );
  pwm.setPWM(8, 4096, 0 );
  pwm.setPWM(9, 4096, 0 );
  pwm.setPWM(10, 4096, 0 );
  pwm.setPWM(11, 4096, 0 );
  pwm.setPWM(12, 4096, 0 );
  pwm.setPWM(13, 4096, 0 );
  pwm.setPWM(14, 4096, 0 );

}

void loop() {

  // DMX input
  for (int j = 0; j <= 14; j++) {
    channel[j] = dmx_slave.getChannelValue (j+1);
  }

  //  fine tune color
  channelOut[0] = map(channel[0], 0, 255, 0, 1400); // reduce red LED 1
  channelOut[1] = map(channel[1], 0, 255, 0, 4095);
  channelOut[2] = map(channel[2], 0, 255, 0, 4095);
  channelOut[3] = map(channel[3], 0, 255, 0, 1400); // reduce red LED 2
  channelOut[4] = map(channel[4], 0, 255, 0, 4095);
  channelOut[5] = map(channel[5], 0, 255, 0, 4095);
  channelOut[6] = map(channel[6], 0, 255, 0, 1400); // reduce red LED 3
  channelOut[7] = map(channel[7], 0, 255, 0, 4095);
  channelOut[8] = map(channel[8], 0, 255, 0, 4095);
  channelOut[9] = map(channel[9], 0, 255, 0, 1400); // reduce red LED 4
  channelOut[10] = map(channel[10], 0, 255, 0, 4095);
  channelOut[11] = map(channel[11], 0, 255, 0, 4095);
  channelOut[12] = map(channel[12], 0, 255, 0, 1400); // reduce red LED 5
  channelOut[13] = map(channel[13], 0, 255, 0, 4095);
  channelOut[14] = map(channel[14], 0, 255, 0, 4095);

  //assign values
  for (int i = 0; i <= 14; i++) {
    if (channelOut[i] == 0)
    { pwm.setPWM(i, 4096, 0 );
    }
    else
    {
      pwm.setPWM(i, 0, 4095 - channelOut[i] );
    }
  }
}

USB input version

Arduino
Debug version with direct input for lamp Nr. and R G B values
// 15 PWM on 5 RGBs LEDs

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

int channel[15];
int channelOut[15];
int value[15];
int ch = 0;
int red = 0;
int green = 0;
int blue = 0;


void setup() {

  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(9600);
  Serial.println("Waiting for input: LED, R, G, B, [each 0-255]");

  pwm.begin();
  pwm.setPWMFreq(120);  // This is the maximum PWM frequency

  // if you want to really speed stuff up, you can go into 'fast 400khz I2C' mode
  // some i2c devices dont like this so much so if you're sharing the bus, watch
  // out for this!
#ifdef TWBR
  // save I2C bitrate
  uint8_t twbrbackup = TWBR;
  // must be changed after calling Wire.begin() (inside pwm.begin())
  TWBR = 12; // upgrade to 400KHz!
#endif
  // set all PWM to high -> LEDs off
  pwm.setPWM(0, 4096, 0 );
  pwm.setPWM(1, 4096, 0 );
  pwm.setPWM(2, 4096, 0 );
  pwm.setPWM(3, 4096, 0 );
  pwm.setPWM(4, 4096, 0 );
  pwm.setPWM(5, 4096, 0 );
  pwm.setPWM(6, 4096, 0 );
  pwm.setPWM(7, 4096, 0 );
  pwm.setPWM(8, 4096, 0 );
  pwm.setPWM(9, 4096, 0 );
  pwm.setPWM(10, 4096, 0 );
  pwm.setPWM(11, 4096, 0 );
  pwm.setPWM(12, 4096, 0 );
  pwm.setPWM(13, 4096, 0 );
  pwm.setPWM(14, 4096, 0 );
}

void loop() {

  //input color

  while (Serial.available() > 0) {
    ch = Serial.parseInt();
    red = Serial.parseInt();
    green = Serial.parseInt();
    blue = Serial.parseInt();
    if (Serial.read() == '\n') {}
    ch = constrain(ch, 0, 4);
    red = constrain(red, 0, 255);
    green = constrain(green, 0, 255);
    blue = constrain(blue, 0, 255);

    // print the three numbers :
    Serial.print ("new values:");
    Serial.print (" LED=");
    Serial.print(ch, DEC);
    Serial.print (" R=");
    Serial.print(red, DEC);
    Serial.print (", G=");
    Serial.print(green, DEC);
    Serial.print (", B=");
    Serial.println(blue, DEC);
  }
  switch (ch) {
    case 0:
      channel[0] = red;
      channel[1] = green;
      channel[2] = blue;
      break;
    case 1:
      channel[3] = red;
      channel[4] = green;
      channel[5] = blue;
      break;
    case 2:
      channel[6] = red;
      channel[7] = green;
      channel[8] = blue;
      break;
    case 3:
      channel[9] = red;
      channel[10] = green;
      channel[11] = blue;
      break;
    case 4:
      channel[12] = red;
      channel[13] = green;
      channel[14] = blue;
      break;
  }

  //  fine tune color
  channelOut[0] = map(channel[0], 0, 255, 0, 1400); // reduce red LED 1
  channelOut[1] = map(channel[1], 0, 255, 0, 4095);
  channelOut[2] = map(channel[2], 0, 255, 0, 4095);
  channelOut[3] = map(channel[3], 0, 255, 0, 1400); // reduce red LED 2
  channelOut[4] = map(channel[4], 0, 255, 0, 4095);
  channelOut[5] = map(channel[5], 0, 255, 0, 4095);
  channelOut[6] = map(channel[6], 0, 255, 0, 1400); // reduce red LED 3
  channelOut[7] = map(channel[7], 0, 255, 0, 4095);
  channelOut[8] = map(channel[8], 0, 255, 0, 4095);
  channelOut[9] = map(channel[9], 0, 255, 0, 1400); // reduce red LED 4
  channelOut[10] = map(channel[10], 0, 255, 0, 4095);
  channelOut[11] = map(channel[11], 0, 255, 0, 4095);
  channelOut[12] = map(channel[12], 0, 255, 0, 1400); // reduce red LED 5
  channelOut[13] = map(channel[13], 0, 255, 0, 4095);
  channelOut[14] = map(channel[14], 0, 255, 0, 4095);

  //assign values
  for (int i = 0; i <= 14; i++) {
    if (channelOut[i] == 0)
    { pwm.setPWM(i, 4096, 0 );
    }
    else
    {
      pwm.setPWM(i, 0, 4095 - channelOut[i] );
    }
  }


}

fixture for Freestyler

BatchFile
definition of channels describtion for the DMX controll programm on the PC
Buzz
Comments:
""
Outdoor LED
3
 0 
 0 
RBG Outdoor.gif
0
0
0
0
0
0
0
 1 
1
2
3
Red
Green
Blue













Macros
 2 

 0 

0




 0 



 1 
 0 


0
255





0
0
0


0
0
0
255
0
255
0
255
0
255
0
255
0
255
0
255
0
0
0-0-0-0


-1
Sliders
 0 

Credits

Sebastian Wiessner

Sebastian Wiessner

1 project • 9 followers

Comments