Pages: [1] 2   Go Down
Author Topic: Arduino with BobLight  (Read 5410 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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 http://blogger.xs4all.nl/loosen/articles/408236.aspx I also have tested this with a MoMoLight filter into BS Player http://divxstation.com/article.asp?aId=151&page=2

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
« Last Edit: January 31, 2011, 09:03:02 am by orbitrek » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Any ideas where to start to dig out the problem?
Probably need to see the code on the Arduino to figure that out.

Quote
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.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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:
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);
 
 
  Serial.begin(9600);
}

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

    while(true){
      if (Serial.available() > 8) {
RR1 = Serial.read();
RR2 = Serial.read();   
RR3 = Serial.read();
GG1 = Serial.read();
GG2 = Serial.read();
GG3 = Serial.read();
BB1 = Serial.read();
BB2 = Serial.read();
BB3 = Serial.read();
      }
  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);
}
}
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12742
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, thanks.

Quote
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: http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection
(mega vs. diecimila , 220 vs 120 ? )
« Last Edit: January 30, 2011, 03:57:24 pm by orbitrek » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12742
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The actual resistor value isn't important.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The actual resistor value isn't important.
Within limits. A 1 ohm and a 1M ohm resistor are outside those limits.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12742
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley

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

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 30, 2011, 05:11:42 pm by orbitrek » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12742
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Pages: [1] 2   Go Up
Jump to: