Hello,
I am using Arduino Mega 2560, running Processing on Mac OSX. I got the 12 mm digital RGB LED pixels (25 LEDS) and the strandtest code works well on it. So the LED is fine. The problem is when either colorwirl or the adalight is running, the lights are not showing up.
Processing codes seems worked well. The small adalight window's color block changes according to my screen in realtime. The RX pin on arduino board flashes consistantly or lit up.
THe wiring on board: blue wire connnected to ground, yellow wire to pin 11, green wire to pin 13. Is it the right connection? The webpage says data pin for arduino mega is Pin 51, and clock pin is Pin 52. But i tried both settings, none works.
Any clue or suggetions? THanks in advance!
Help needed for Adalight Project
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Help needed for Adalight Project
Hey there,
The wiring sounds correct. A couple other things to check: did you upload the "LEDstream" sketch to the Arduino board before running either Colorswirl or Adalight? Are there any other serial ports or devices on the system? Both programs open the first available serial port by default...you may have to tweak this to point to your Arduino.
The wiring sounds correct. A couple other things to check: did you upload the "LEDstream" sketch to the Arduino board before running either Colorswirl or Adalight? Are there any other serial ports or devices on the system? Both programs open the first available serial port by default...you may have to tweak this to point to your Arduino.
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
Yes i did uploaded the LED stream to Arduino. I was tried to find the line of code of definition of data pin and clock pin. But didn't success.
There is no other USB device.
There is no other USB device.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Help needed for Adalight Project
On the Mac, Bluetooth shows up as a serial device, so that might be throwing it off.
Open the Colorswirl sketch in Processing, and at the start of the setup() function (just before the call to noLoop()), add this line:
Run the sketch and look at the console output. You should see something similar to '/dev/tty.usbmodemfd531' somewhere in that list, corresponding to the Arduino Mega. If the number next to it is not 0, edit this line in the code, replacing the '0' with that port number:
Open the Colorswirl sketch in Processing, and at the start of the setup() function (just before the call to noLoop()), add this line:
Code: Select all
println(Serial.list());
Code: Select all
port = new Serial(this, Serial.list()[0], 115200);
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
I has checked as you suggested. This is the printout
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
[0] "/dev/tty.usbmodemfa131"
[1] "/dev/cu.usbmodemfa131"
[2] "/dev/tty.Bluetooth-PDA-Sync"
[3] "/dev/cu.Bluetooth-PDA-Sync"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/cu.Bluetooth-Modem"
It seems fine.
And i plugged a LED on pin 13, just for testing. When the processing running on mac and LEDStream running on Arduino, the Rx is on and pin 13 is HIGH (LED is lit up).
Does it mean the communication between mac and arduino works?
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
[0] "/dev/tty.usbmodemfa131"
[1] "/dev/cu.usbmodemfa131"
[2] "/dev/tty.Bluetooth-PDA-Sync"
[3] "/dev/cu.Bluetooth-PDA-Sync"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/cu.Bluetooth-Modem"
It seems fine.
And i plugged a LED on pin 13, just for testing. When the processing running on mac and LEDStream running on Arduino, the Rx is on and pin 13 is HIGH (LED is lit up).
Does it mean the communication between mac and arduino works?
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Help needed for Adalight Project
Howdy,
Something is amiss with LEDstream running on the Mega. I'm trying to sort it out now.
If your wiring is correct (blue to GND, green to pin 52, yellow to 51), you should see all the LEDs flash red, green, blue once at startup. Are you seeing that? If so, good, the wiring is correct, I just need to figure out what's going wrong with the software. Will post an update once it's resolved.
Something is amiss with LEDstream running on the Mega. I'm trying to sort it out now.
If your wiring is correct (blue to GND, green to pin 52, yellow to 51), you should see all the LEDs flash red, green, blue once at startup. Are you seeing that? If so, good, the wiring is correct, I just need to figure out what's going wrong with the software. Will post an update once it's resolved.
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
Thanks for your help.
Now blue --> ground, green --> Pin 52, yellow --> Pin 51. When it started up, all LEDs are lit up as R G B once.
Now blue --> ground, green --> Pin 52, yellow --> Pin 51. When it started up, all LEDs are lit up as R G B once.
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
Is it related with Arduino Mega 2560 SPI pins (Pin 50, 51, 52)?
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Help needed for Adalight Project
No, the SPI pins are fine.
Apparently this is a known thing with the Mega serial port. There are a few workarounds:
1) Run the Arduino IDE, open the Serial monitor and leave it there. Then start the Processing sketch. This is, of course, silly.
2) Disable auto-reset on the Arduino Mega. If you have a current (R2) Mega with the 32u4 serial chip, connect a 10 uF capacitor between the reset pin and ground (I didn't have a 10 uF handy, but 47 uF worked fine). For older Megas (with an FTDI chip), use a 220 Ohm resistor between reset and +5V. This is marginally less silly, but at least you don't have to run the Arduino IDE just to run Adalight.
3) Changes to Adalight, Colorswirl and anything else that works this way, so there's a few seconds' delay after opening the serial port before issuing any data. Unfortunately delay() doesn't work within the setup() function in Processing, and both of those programs are written to never exit setup(), making this a pretty substantial rewrite. Argh!
I don't suppose you have a 10 uF capacitor handy?
Apparently this is a known thing with the Mega serial port. There are a few workarounds:
1) Run the Arduino IDE, open the Serial monitor and leave it there. Then start the Processing sketch. This is, of course, silly.
2) Disable auto-reset on the Arduino Mega. If you have a current (R2) Mega with the 32u4 serial chip, connect a 10 uF capacitor between the reset pin and ground (I didn't have a 10 uF handy, but 47 uF worked fine). For older Megas (with an FTDI chip), use a 220 Ohm resistor between reset and +5V. This is marginally less silly, but at least you don't have to run the Arduino IDE just to run Adalight.
3) Changes to Adalight, Colorswirl and anything else that works this way, so there's a few seconds' delay after opening the serial port before issuing any data. Unfortunately delay() doesn't work within the setup() function in Processing, and both of those programs are written to never exit setup(), making this a pretty substantial rewrite. Argh!
I don't suppose you have a 10 uF capacitor handy?
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
Thank you so much for the immediate and through help.
I tried the first two workarounds. They all work. I dont have 10 uf at hand so i used a 2.2 uf. It works fine.
Thanks again!
I tried the first two workarounds. They all work. I dont have 10 uf at hand so i used a 2.2 uf. It works fine.
Thanks again!
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Help needed for Adalight Project
Cool beans, glad you got it working.
Found a software workaround which I'll roll into the next Adalight update. If you're comfortable with the capacitor fix, that's all good, else you can make this change to the sketch (immediately following the port = new Serial line):
Found a software workaround which I'll roll into the next Adalight update. If you're comfortable with the capacitor fix, that's all good, else you can make this change to the sketch (immediately following the port = new Serial line):
Code: Select all
try {
Thread.sleep(1000);
}
catch(InterruptedException ie) {
}
-
- Posts: 14
- Joined: Wed Jun 20, 2012 1:15 pm
Re: Help needed for Adalight Project
pburgess,
Thanks for the software fix. I guess i have an even cleaner solution: i switched to Arduino UNO
Just joking:) Hope this thread help other people who also use Mega 2560.
Thanks for the software fix. I guess i have an even cleaner solution: i switched to Arduino UNO
Just joking:) Hope this thread help other people who also use Mega 2560.
- Richard63
- Posts: 1
- Joined: Thu Oct 09, 2014 12:53 pm
Re: Help needed for Adalight Project
Just maked my arduino mega 2560 working on pin 51 and 52 with the processing FIX from 2012 post
try {
Thread.sleep(1000);
}
catch(InterruptedException ie) {
}
it seems to work on test (1 led and color swirl)
(i got some loose pixels)
But how is this to use in boblight on xbmc ?
or should i use the capacitor option ?
(not an elco i believe)
try {
Thread.sleep(1000);
}
catch(InterruptedException ie) {
}
it seems to work on test (1 led and color swirl)
(i got some loose pixels)
But how is this to use in boblight on xbmc ?
or should i use the capacitor option ?
(not an elco i believe)
Please be positive and constructive with your questions and comments.