Tinkers Projects

Imagine | Develop | Create

DMX LightMain
DMX Light0
DMX Light1
DMX Light2
DMX Light3
DMX Light4
For years I have been looking into DMX controllers, DMX lights and MIDI controllers to see how they work and how I could make some lights/controllers my self. I have made a number of DMX controllers that sends the DMX signal to the lights but I have not made a DMX light before. This light is the first DMX light that I have made. The controller is the PLEX controllerwhich allows easy access to a 16X2 LCD. This controller allows the setting for the light to be changed and set. The light has different modes including colour fading, colour stepping, solid colour and DMX. The program uses the RGB LED Library that allows control of RGB LEDs and the fading between colors. the program also uses a DMX library to read the incoming DMX signal

Code for Project

GNU General Public License v3.0
#include <LiquidCrystal.h>
#include <RGB_LED.h>
#define upButtonPin A0
#define downButtonPin A1
#define modeButtonPin A2

byte mode = 1;
unsigned int speed = 1000;
byte DMX = 1;

LiquidCrystal lcd(2, 4, 5, 6, 7, 8);
RGB_LED LED(3,10,11);

void setup() 
{
  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(upButtonPin,INPUT);
  pinMode(downButtonPin,INPUT);
  pinMode(modeButtonPin, INPUT);
  Serial.println("Start");
  changemode();
  setsetting();
}

void loop() 
{
   LED.run();
  
   if(mode ==6)
   {
     DMXcontrol();
   }

   if(digitalRead(modeButtonPin)==HIGH)
   {
      mode++;
      changemode();
      setsetting();
      controldelay(); // and mode button is low
   }
   if(digitalRead(upButtonPin)==HIGH)
   {
      upsetting();
      setsetting();
      controldelay();
   }
   if(digitalRead(downButtonPin)==HIGH)
   {
      downsetting();
      setsetting();
      controldelay();
   }
}



void changemode()
{
  lcd.setCursor(0,0);
  Serial.println(mode);
  switch(mode)
  {
    case 1:
      Serial.println("Fade");
      lcd.print("Fade");
      LED.setFunction(Fade);
    break;
    case 2:
      Serial.println("Fade Random");
      lcd.print("Fade Random");
      LED.setFunction(FadeRandom);
    break;
    case 3:
      Serial.println("Step RGB");
      lcd.print("Step RGB");
      LED.setFunction(Step1);
    break;
    case 4:
      Serial.println("Step ALL");
      lcd.print("Step ALL");
      LED.setFunction(Step2);
    break;
    case 5:
      Serial.println("Step Random");
      lcd.print("Step Random");
      LED.setFunction(StepRandom);
    break;
    case 6:
      Serial.println("DMX");
      lcd.print("DMX");
      LED.fadeToColour(Black,500);
    break;
    case 7:
      Serial.println("White");
      lcd.print("White");
      LED.fadeToColour(White,500);
    break;
    case 8:
      Serial.println("Red");
      lcd.print("Red");
      LED.fadeToColour(Red,500);
    break;
    case 9:
      Serial.println("Gre");
      lcd.print("Green");
      LED.fadeToColour(Green,500);
    break;
    case 10:
      Serial.println("Blue");
      lcd.print("Blue");
      LED.fadeToColour(Blue,500);
    break;
    default:
      mode = 1;
      changemode();
  }
  lcd.print("                ");
}

void setsetting()
{
  lcd.setCursor(0,1);
  if(mode <=5)
  {
    lcd.print("Speed: ");
    lcd.print(speed);
    LED.setSpeed(speed);
  }
  else if(mode ==6)
  {
    lcd.print("Address: ");
    lcd.print(DMX);
  }
  lcd.print("                ");
}



void upsetting()
{
  if(mode <=5 && speed < 30000)
  {
    speed = speed +100;
  }
  else if(mode ==6 && DMX < 255)
  {
    DMX++;
  }
}


void downsetting()
{
  if(mode <=5 && speed > 100)
  {
    speed = speed - 100;
  }
  else if(mode ==6 && DMX > 1)
  {
    DMX--;
  }
}



void controldelay()
{
  unsigned long currenttime = millis();
  while(currenttime+50 > millis() || digitalRead(modeButtonPin)==HIGH)
  {
    LED.run();
  }
}





void DMXcontrol()
{
  
}
For years I have been looking into DMX controllers, DMX lights and MIDI controllers to see how they work and how I could make some lights/controllers my self. I have made a number of DMX controllers that sends the DMX signal to the lights but I have not made a DMX light before. This light is the first DMX light that I have made. The controller is the PLEX controllerwhich allows easy access to a 16X2 LCD. This controller allows the setting for the light to be changed and set. The light has different modes including colour fading, colour stepping, solid colour and DMX. The program uses the RGB LED Library that allows control of RGB LEDs and the fading between colors. the program also uses a DMX library to read the incoming DMX signal

Related Projects