Go Down

Topic: 2x RGB music controlled (DMXControl, Winamp) (Read 2817 times) previous topic - next topic


Jan 16, 2009, 07:37 pm Last Edit: Jan 16, 2009, 07:45 pm by designer2k2 Reason: 1

got my Duemilanove some days ago and love it  :D

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":  ::)

The DMXControl plugin:

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

Cant wait to explore more, the Arduino rocks!  8-)


The Arduino Code:
Code: [Select]
//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.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();
   //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;
   case 1:
     valueR = Read;
     runVal = 2;
     //Serial.print("R: ");
   case 2:
     valueG = Read;
     runVal = 3;
     //Serial.print("G: ");
   case 3:
     valueB = Read;
     runVal = 4;
     //Serial.print("B: ");
   case 4:
     valueR2 = Read;
     runVal = 5;
     //Serial.print("R2: ");
   case 5:
     valueG2 = Read;
     runVal = 6;
     //Serial.print("G2: ");
   case 6:
     valueB2 = Read;
     runVal = 1;
     //Serial.print("B2: ");

The Visual Basic Code from the Pc:
Code: [Select]
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  ::)
Code: [Select]
Private Function Check123(RGBval As Integer) As Integer

   Dim RGBout As Integer

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

   Check123 = RGBout

End Function

as i said, quick & dirty coded  ;)


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:

Code: [Select]

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  :D



I found that you had to be careful not to overdo the blue, then you get the results I get:-
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  :D

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

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131