2x RGB music controlled (DMXControl, Winamp)

Hello,

got my Duemilanove some days ago and love it :smiley:

first thing is a RGB controller, off course music controlled...
to be more specific, its controlled from DMXControl, so it can be music or something else...

dont know how to link youtube, here is a small video showing it:

And the "hardware": ::slight_smile:

The DMXControl plugin:

everything is quick and dirty coded, nothing special there :-[

Cant wait to explore more, the Arduino rocks! :sunglasses:

The Arduino Code:

//http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1202245205
//Extendet to all 6 Channels on 16.01.2009

#include <AFSoftSerial.h>

AFSoftSerial mySerial =  AFSoftSerial(3, 2);

int valueR = 0;                            // variable to keep the actual value 
int valueG = 0;                            // variable to keep the actual value 
int valueB = 0;                            // variable to keep the actual value 

int valueR2 = 0;                            // variable to keep the actual value 
int valueG2 = 0;                            // variable to keep the actual value 
int valueB2 = 0;                            // variable to keep the actual value 

int ledgreen = 9;                           // light connected to digital pin 9
int ledblue = 10;
int ledred = 11;

int ledred2 = 3;                          //second RGB Set
int ledgreen2 = 5;
int ledblue2 = 6;

int intdelay = 100;
int stepsize = 1;
int valuemin = 20;
int valuemax = 100;

int Read = 0;
int runVal = 1;

void setup()  {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  Serial.println("RGB Sequencer V0.1");
}

void loop()                     // run over and over again
{
    analogWrite(ledred, valueR);           // sets the value (range from 0 to 255) 
    analogWrite(ledgreen, valueG);           // sets the value (range from 0 to 255) 
    analogWrite(ledblue, valueB);           // sets the value (range from 0 to 255)
  
    analogWrite(ledred2, valueR2);           // sets the value (range from 0 to 255) 
    analogWrite(ledgreen2, valueG2);           // sets the value (range from 0 to 255) 
    analogWrite(ledblue2, valueB2);           // sets the value (range from 0 to 255)
  

  if (Serial.available()) {   
        
    Read = Serial.read();
   
    //Serial.print((char)Read);
    //Serial.println(Read);
    
    //when Read = 123 it means its a new run, so it resets the runVal to 1,
    //The sending programm must not send a 123 for a channel, it must increment or decrement it by 1.
    
    if (Read == 123){
      runVal = 0;
     // Serial.println("Reset");   
    };
   
    switch (runVal) {
    case 0:
      runVal = 1;
      break;  
    case 1:
      valueR = Read;
      runVal = 2;
      //Serial.print("R: ");
      //Serial.println(Read);
      break;
    case 2:
      valueG = Read;
      runVal = 3;
      //Serial.print("G: ");
      //Serial.println(Read);
      break;
    case 3:
      valueB = Read;
      runVal = 4;
      //Serial.print("B: ");
      //Serial.println(Read);
      break;
      
    case 4:
      valueR2 = Read;
      runVal = 5;
      //Serial.print("R2: ");
      //Serial.println(Read);
      break;   
    case 5:
      valueG2 = Read;
      runVal = 6;
      //Serial.print("G2: ");
      //Serial.println(Read);
      break;
    case 6:
      valueB2 = Read;
      runVal = 1;
      //Serial.print("B2: ");
      //Serial.println(Read);
      break;       
    }
    
  }
}

The Visual Basic Code from the Pc:

'Sync:
MSComm1.Output = Chr(123)   'This resets 
        
'RGB Set 1:
MSComm1.Output = Chr(Check123(HScroll1.Value))
MSComm1.Output = Chr(Check123(HScroll2.Value))
MSComm1.Output = Chr(Check123(HScroll3.Value))
        
'RGB Set 2:
MSComm1.Output = Chr(Check123(HScroll4.Value))
MSComm1.Output = Chr(Check123(HScroll5.Value))
MSComm1.Output = Chr(Check123(HScroll6.Value))

The Check123 Function:
it justs prevents sending another Sync, you cant see its missing in the 0-255 range ::slight_smile:

Private Function Check123(RGBval As Integer) As Integer

    Dim RGBout As Integer

    If RGBval = 123 Then
        RGBout = RGBval - 1
    Else
        RGBout = RGBval
    End If

    Check123 = RGBout

End Function

as i said, quick & dirty coded :wink:

i wondered why they always look so white, never have seen nice colours mixed :-/

so i looked into the "linearity" and it was dissapointing. from 0-100 it was a huge change, and the rest ist little.

for this i changed from linear to exponential:

blue is the input and green the pwm value outputet to the arduino.

Thats the codeline for this:

LightVal = LightVal * LightVal * 0.0039

on video i cant catch the different look, but now it looks like RGB, not like white with changing intensity :smiley:

I found that you had to be careful not to overdo the blue, then you get the results I get:-
www.thebox.myzen.co.uk/Hardware/Mini_Monome.html
But it is difficult to capture on video or photographs.

the white is quite nice, i needed to reduce red for it. the red channel is the orignal value / 1,1 and then send into the exponential conversion.

but thats easier, just see to get a "snow white" no warm or cold white, thats stupid to describe :-/

but perfect white is not needed, looks also with warm or cold white amazing.

and yes, capturing that on video or picture is quite difficult!

but now im into mooore channels :smiley:

at least 4 x rgb i must get, so i can make a nice ambilight for my pc screen :slight_smile: