Running Blinkytape processing code on arduino + neopixel strip: possible?
Hi everyone,
I have a BlinkyTape and I've found it lots of fun. I've especially enjoyed using it with processing programs to react to music (BlinkySpectrogram, BlinkyMusicShow and DiscoParty come to mind, all great programs).
A friend of mine recently got an arduino (uno) and some led strips (neo pixel type, WS2812) and we were wondering if it is possible to run the programs designed for the BlinkyTape on the arduino + WS2812.
Is it doable?
Does it require efforts to adapt the programs? lots?
Any advice is welcome on this issue, we have a big party in about a week and would love to have multiple strips flashing away to the BlinkyMusicShow for instance!
Cheers and thanks for the forum, it's been helped me out in getting my BT to do what I wanted to do.
axel
I have a BlinkyTape and I've found it lots of fun. I've especially enjoyed using it with processing programs to react to music (BlinkySpectrogram, BlinkyMusicShow and DiscoParty come to mind, all great programs).
A friend of mine recently got an arduino (uno) and some led strips (neo pixel type, WS2812) and we were wondering if it is possible to run the programs designed for the BlinkyTape on the arduino + WS2812.
Is it doable?
Does it require efforts to adapt the programs? lots?
Any advice is welcome on this issue, we have a big party in about a week and would love to have multiple strips flashing away to the BlinkyMusicShow for instance!
Cheers and thanks for the forum, it's been helped me out in getting my BT to do what I wanted to do.
axel
Comments
Cool, glad to hear you are enjoying it! Yes, it should be possible to use it with an Arduino Uno and generic neo pixel strips. The biggest thing to look out for with the Uno, is the serial baud rate setting. You'll need to make sure both the Arduino sketch (Color Swirl, for example), and the Processing sketch (BlinkyMusicShow) are both configured to the same setting. I suggest as a starting point 115200. This setting isn't important on the BlinkyTape (or the Leonardo, which the BlinkyTape is based on), because those ones use a different processor (Atmega32u4) which has the USB controller built in, so the baud rate setting is actually ignored. The Uno uses an older processor (Atmeg328), which doesn't have USB built in, so it actually has to communicate over an actual serial port, and uses a second processor (Atmega8u2, i think) to convert the serial into USB to connect to the computer.
I think that's the main thing that has to be changed. Let us know how it works, and send pictures of your party!
Cheers,
Matt
I managed to get it working, uploading colorswirl with a few modifications (commented out the pinModes, especially ANALOG_INPUT) and then runnning Blinky Spectrogram while checking all baud rates were at 115200 (including the "Magic reset baudrate", don't know if that's necessary).
A few notes:
- blinky swirl actually doesn't swirl, the strip lights up but there's no movement (not a big deal)
- the processing script can only be run once, then I need to unplug and replug the arduino to get it to run again (cumbersome, but not a real problem either)
- BlinkySpectrogram starts ok and then seems to fall behind. Pausing the music shows the LEDs flashing for a while although there is no sound. BlinkyMusicShow is almost immediately behind. That's more problematic.
- BlinkyShimmer is fine (LED 2 is sometimes red) and ColorPicker works fine too.
I borrowed a strip of my friend's WS2812 and have actually been testing this on my Diavolino (which is an Arduino duemilanove clone) connected over USB through an Adafruit FTDI friend. I'm learning a lot here and I'm pretty unsure of how the whole chain really works (surprise!) but I suspect this particular setup might be what causes the delays in updating the strip and makes too slow to keep up with the music.
We'll test on my friend's Uno (iteaduino clone, to be precise) and I'll report back here for anyone interested.
Once more, thanks a lot for taking the time to help us Matt, it's much appreciated
(Yes, we'll send pictures of the party )
Cheers
axel
You might have better luck if you also drop the framerate in Processing a little bit- try 20fps and see if that works any better. I suspect the Uno will work about the same as the Diavolino, since they will both have the same serial limitation.
Out of curiosity, what OS do you run on your computer?
The BT runs just fine.
I'll try dropping the framerate, sonuds like something that should help.
I'll also try a different USB cable, just in case. Do you think the FTDI Friend + cable could have an effect on actual serial speed or does such a question just show I'm not too aware of how this really works?
axel
USB cables are all basically the same, as far as data transmission goes- they either work or they don't. The actual construction quality can vary quite a bit (whether the data wires are properly twisted or not, if they have proper shielding or any shielding, how good the connectors are), but all that does is make the cable easier to break.
The FTDI friend uses basically the same chip as the Arduino Duemilanove to do the USB<->serial conversion. It is different than the Uno, but the bottleneck in this system should be the serial link between that chip and the Atmega328, so I expect they will perform almost exactly the same.
If you're using this BlinkyMusicShow (https://github.com/coryshaw1/BlinkyMusicShow), I'd love if you could get some videos of your party to see it in action. Have fun!
Cory
unfortunatly color swirl just frezzes and thats all that happens. im connected over onboard usb. what am i doing wrong? do i have to use an ftdi adapter?
when i run processing code (colorpicker), after connection (changing "/dev..." to "COM") it connects on COM3 (this is correct) and arduino rxtx flashes but all that happens is the pattern frezzes
if i copy the java serial lib inside processing v1.5 to v2.2. v2.2 works
also at 115200 baud the first led shows color ok, last 7 led's show white and in-between the color is rgb shifted from chosen color
i did all of this addressed as a 60 pixel strip even though its 144 long. none of the lights ever lit up after 60 which is good
If you use other sketches do you see the same issues? (DiscoParty is probably the Processing sketch that gets the most love.)
Also, which WS2811 strips are you using?
Hi from what ive experianced,it may be the timmers on the mcu,mine wont compile due to the timers and interupts.Code is for the 32u4 so the 328p and other mcu will have problems i think,my code wont compile past this in the production sketch,i asume your trying to use 328p as the blinkytape? Or are you just trying to use the sketches examples etc?Ime trying to use a 328p and connect to the pattern paint app but it just complains about the code bellow at compile time.
// And configure and start timer4 interrupt.
TCCR4B = 0x0F; // Slowest prescaler
TCCR4D = _BV(WGM41) | _BV(WGM40); // Fast PWM mode
OCR4C = 0x10; // some random percentage of the clock
TCNT4 = 0; // Reset the counter
TIMSK4 = _BV(TOV4); // turn on the interrupt
The Arduino Leonardo should be directly compatible, but unfortunately I think it's been discontinued. The timers are mostly just to handle the button input, so if you don't need that you should be able to just comment them out.