Running Blinkytape processing code on arduino + neopixel strip: possible?

edited September 2014 in BlinkyTape Fun
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

Comments

  • Hi Axel,

    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
  • edited September 2014
    Wow, thanks so much 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
  • Great!

    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?
  • I'm running Debian testing (Jessie as of know) on an aging (2008) laptop.
    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
  • It's a good question! Don't worry about changing out the cable.

    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.
  • Hey Axel,

    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
  • Hello: i am using an arduino mega 2560 and am trying to get the blinkytape processing code to work with it. i have set all baud rates to 115200 and the arduino rxtx led is blinking with processing saying connected on COM3.

    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?
  • Hey Ollie, I'm not 100% sure on what you're trying to do there. Are you using our code with a different strip and an Arduino? Where does it freeze? Are you able to upload the code to the mega?
  • hello, yes its a ws2812 144 pixel 1m strip connected directly to the arduino mega. colorswirl compiles and uploads fine only with arduino 1.0.6. pattern visible and flawless.

    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
  • OK, understood. Have you modded the programs to run with more LEDs or are you just running with the first 60 at this point?
  • ok. so using processing v1.5, colorchooser.pde (changed /dev to COM & baud to 57600) with firmware colorswirl (untouched) the first leds #1-27 show the live chosen color, leds #28-30 show white

    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
  • OK, that's very strange. Not sure why the baud rate would be having an effect like that.

    If you use other sketches do you see the same issues? (DiscoParty is probably the Processing sketch that gets the most love.)
  • Hi not sure if I should start a new thread for this. I have an arduino nano running ws2811 light. So far I have been able to use pattern paint to export animation.h and display my pattern by pushing PatternPlayer to my board. Here is the question. "The pattern displayed from my sketch looks like it may not be rendering in the proper order it's a pattern but not like the bmp provided" Are there anything other changes to the pattern player sketch required to support the older ws2811 besides declaring the light type.
  • ZenHoop- they should work without modification. Can you describe the difference in output? Is the pixel order scrambled, or the color different, or something else?

    Also, which WS2811 strips are you using?
  • edited August 2017

    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.

Sign In or Register to comment.