Arduino with BobLight


I'm building an ambilight clone. I got LED strips from deal extreme and I'm controlling them with pwm and ULN2003 ic. The display data is read from serial port. The data is written into serial by a software called BobLight I also have tested this with a MoMoLight filter into BS Player

I tested the system with Arduino Duemilanove, everything works nicely. Duemilanove is recognized as COM4 and I can read the data nicely from the serial.

Duemilanove has only 6 pwms, and that is not enough for my application. So I needed to change to Mega 2560. Now the problems start, Mega is recognized to COM5 and even if I change this to the software sending the data, it doesn't come alive.

Any ideas where to start to dig out the problem? What's the difference between Duemilanove and Mega?

Kind Regards Orbitrek

What's the difference between Duemilanove and Mega?

From the point of view of reading serial data, none. There are, of course, many differences - number of pins, which pins do what, number of timers, amount of memory, etc.

Which Mega do yo have? The 1280 and 2560 also differ in the kind of hardware that maps the USB data to serial data.

Hi, I'm running Mega 2560. Serial communication is going thru USB. I guess I should get the exact same code (except pwm out pin numbers) working on Mega as on Duemilanove.

Why duemilanove maps as COM4 and Mega as COM5. I changed COM5 => COM4 on advanced com settings, but it had no effect.

Any ideas where to start to dig out the problem?

Probably need to see the code on the Arduino to figure that out.

Why duemilanove maps as COM4 and Mega as COM5.

One of the (many) mysteries of Windows. The name is not important, though. The Mega (or Duemilanove) has no idea that the PC supports more than one serial port, and, therefore, names them.


I get my code working with a testing software where I have sliders and I'm capable of sending different nine byte messages to arduino. each byte can be set by slider: e.g: 0,0,0, 0,0,0, 0,0,0 or 255,255,255, 0,0,0 ,255,255,0

The code works nicely. But when I test this with BobLight I don't get any functionality. On duemilanove this works on both (test software and boblight) I noticed that when using boblight and mega the little inbuild "L"-led near RX and TX leds is always on. What does that mean? When I use Mega with test software and system works this led is not on?

Here's the arduino Code:

int r1Pin = 9;
//int r2Pin = 3;
//int r3Pin = 4;

int g1Pin = 10;
//int g2Pin = 6;
//int g3Pin = 7;

int b1Pin = 11;
//int b2Pin = 9;
//int b3Pin = 10;

void setup()
  pinMode(r1Pin, OUTPUT);  
  //pinMode(r2Pin, OUTPUT);
  //pinMode(r3Pin, OUTPUT);  

  pinMode(g1Pin, OUTPUT);  
  //pinMode(g2Pin, OUTPUT);
  //pinMode(g3Pin, OUTPUT); 

  pinMode(b1Pin, OUTPUT);  
  //pinMode(b2Pin, OUTPUT);
  //pinMode(b3Pin, OUTPUT); 


void loop()
    int RR1;
    int RR2;
    int RR3;
    int GG1;
    int GG2;
    int GG3;
    int BB1;
    int BB2;
    int BB3;

      if (Serial.available() > 8) {
    RR1 =;
    RR2 =;    
    RR3 =;
    GG1 =;
    GG2 =;
    GG3 =;
    BB1 =;
    BB2 =;
    BB3 =;
  analogWrite(r1Pin, 100);//RR1); 
  //analogWrite(r2Pin, RR2);
  //analogWrite(r3Pin, RR3);
  analogWrite(g1Pin, 100);//GG1); 
  //analogWrite(g2Pin, GG2);
  //analogWrite(g3Pin, GG3);
  analogWrite(b1Pin, 100);//BB1); 
  //analogWrite(b2Pin, BB2);
  //analogWrite(b3Pin, BB3);

I found one new weird feature. I try to explain it and hopefully it'll help some pro to understand the problem and one could then give me hints.

In the test program I'm capable of opening the COM port and then starting to sending the data with separate push-buttons. This routine works: - open the port - wait a sec (arduino blinks 13 led when opening com and I guess resetting) - start sending data

But if I do it like this: - open the port - start sending the data right away (I click two button quickly) it wont work.

This works in duemilanove in both ways!?!

In BobLight I can't wait before starting the data sending so I need to figure out a way handling this on Arduino side. Any Ideas? I tried to put delay and flush in the beginning of the code but it doesn't help. Arduino hangs already when the com port is opened and data sending is started.

You will need to disable the autoreset. Start by connecting a 220 ohm resistor from +5 to RESET.

Ok, thanks.

Start by connecting a 220 ohm resistor from +5 to RESET.

So this will disable autoreset. Is this 220 ohm only applicable resistor value? I don’t happen to have it laying around in the drawer.

This one says 120ohm:
(mega vs. diecimila , 220 vs 120 ? )

The actual resistor value isn't important.

The actual resistor value isn't important.

Within limits. A 1 ohm and a 1M ohm resistor are outside those limits.


Somewhere between 100 and 300 should work. One the higher end is probably a better choice for the Uno.

I applied a 120 resistor (trimmer) between 5v and Reset on my Mega 2560, but no effect. It still resets after I open serial? wtf?

What do I do wrong? It should be pretty simple.

Some folks have had problems disabling the autoreset on a board that uses an Atmega8U2 instead of a FTDI (like the Mega 2560). There are reports that a capacitor from RESET to GND works. Search the forum for details.

I bought some capacitors from the local dealer. I grabbed 1uF, 2,2uF and 10uF capacitors. I didn't find any exact value for this. But those three values were picked from threads where people have had luck using capacitor for disabling auto reset. I'll test those in the evening. Drop a line if you've used some other values succesfully or my values with no success.

The capacitor trick helped. I was able to disable auto reset when COM-port is opened plugging a 10uF capacitor between GND and Reset pins. This fixed the hanging problem. Still it is annoying that this needs to be done if a software on pc starts sending data right after port opening. thanks guys (Coding Badly)

Thank you for the follow-up. This thread will very likely help someone else.

Hi, ive been trying to get my 2560 working with boblight. I was wondering if someone could post the arduino code that works with the 2560 and boblight and also the boblight config file. Ive been trying to get this to work for days....

Cheers :)

carldickson: Hi


carldickson: I was wondering if someone could post the arduino code that works with the 2560 and boblight...

@orbitrek stated that, once auto-reset is disabled, the code in reply #4 works.

Hi, I tried that and got light, but they flashed rapidly.

I think I have the boblight config wrongly setup... has anyone got a good config for the mega 2560?