I’m looking for a good way to send data to the Arduino. As I am using the FastLED Animation library for the Arduino I cannot make use of the Firmata which is usually my way to go when it comes down to communicate between vvvv and Arduino.
Here’s what I want to do:
The Arduino board is controlling a digital RGB LED light strip. Every LED is individually controllable and one strip consists of 60 LEDs. Each LED can be controlled by either HSV or RGB which means each LED needs to receive three values from vvvv.
As I have 60 LEDs on one strip: 60 x 3 = 180 values in the range of 0 - 255.
I looked up several examples to send values from vvvv to Arduino but so far my attempts didn’t really work out.
I think the general idea is to send a large string to the Arduino which then stores the single values in a large Array and then pushes the values onto the RGB LED strip.
Can anyone point me to good sources / examples on how to set up such a communication?
After reading more threads and testing out different things I think I might be able to rewrite colorsounds ‘SendSerial2Arduino’ from this thread - https://discourse.vvvv.org/t/11396. I’ll report back as soon as I have something set up.
Okay colorsounds ‘SendSerial2Arduino’ was really helpful. I yet have to fully understand what’s going on in the Arduino sketch but I get the basic idea and I think I can tweak it for my purposes. I don’t have my RGB LED strip right now but I was able to successfully build a test setup with six LEDs controlled over the Pipet Node in vvvv.
Another challenge will be to actually address all 60 RGB LEDs and see if there are any performance issues due to the Serial Communication.
I’ll report back tomorrow after testing is done with the RGB LED strip.
So I was able to set up a connection and actually control all 60 LEDs sending RGB values for each one. The set up is limited (as I expected) since the Serial Communication can only handle so much traffic.
I’ll create a detailed post with pictures and a short video sometime tomorrow.
@Westbam: Can you tell me a bit more about the controller you mentioned? How it works or point me towards a good website? And how many LED strips / LEDs can you control with it? I’m totally new to this whole lighting thing and just don’t know where to start…
The first setup was done with six LEDs to check if I can set their brightness individually. It works perfectly and there are no performance issues.
The next setup uses my Neopixel RGB LED strip. There are 60 LEDs and everyone needs R,G, and B values which means I have to send 180 values to address all of them. I don’t have performance issues if I want to update the strip every few seconds but as soon as the updates are more frequent the Serial Communication struggles to keep up - which is something I expected. I made a short video that shows what I mean. Excuse the quality - I just had an old iPhone at hand.
On the bright side: the setup basically allows you to push any animation on screen to the LED strip. The pipet node picks 60 points and a RGB color split node determines their respective R,G, and B values which are then sent to the Arduino over Serial Communication. No other hardware is required except the Arduino, a PC running vvvv, the USB cable to connect both, and the RGB LED strip - which is something I am really excited about.
However, I’m not sure if I can work with my current setup as I might want to have smooth animations on my LED strip. So any suggestions on how to control RGB LED strips over vvvv using as few resources (hardware, costs) as possible are much appreciated.
I’ll clean up my code and create a blog post in the next few days.
looking to your screenshots … seems you’r using 9600 baud rate for the communication. The Arduino should be capable to run with a max transfer rate of 115200 baud.
Doing the math:
1 baud means 1 bit per second.
1 byte of information needs 10 bit because there is usually 1 start- and 1 endbit involved.
Than means if you’r using a transmission rate of 9600 baud you can transfer 960 symbols (1 byte including one strat- and one endbit) per second. Now depending on how you transfer your data – as string or as a proper hex value per led – you have a refresh rate of 960 / (60 * 3 ) ≈ 5,333fps to update all you leds but only if you’r using one hex value (1 byte including one strat- and one endbit) per led … if for instance you’r using the “1_Arduino_DataAsStrings.v4p” patch as a basis and transport your values as a string you’ll need at least 4 bytes per led (255 and a separator) witch further decimates your framerate to around 1,3fps.
So solutions to your speed problem are a) increase you’r baud rate b) use a proper transport protocol that only uses 1 byte (0-255 as hex) to control you’r leds c) or be lazy and use a Teensyduino http://www.pjrc.com/teensy/td_serial.html which is capable of 12mbit/s (but I’ve to admit I never tried that and don’t know if that’s even possible in combination with vvvv).
Good catch from m9dfukc (what a name!) about the bautrate.
Okay, here goes my 1 minute commercial:
The thing we used are “DMX 512 ArtNet network to WS2801 chip controller”, look for it on Ebay! ($130,-) what it basically can do is control 6 strips of RGB LEDs that have the WS2801 chip (=SPI I think).
Each SPI line is 1 DMX artnet universe, so that is 512/3 = 170 RGB pixels per line. So one box can control 6 * 170 = 1020 seperate RGB LEDs.
They come with a minimal browser configuration, to set up what uni they use. You can control it with the vvvv artnet nodes, needs one node per universe.
So all you need to take car of are some proper/decent power suplies, THE LED strips and some ethernet cable.
Now, before ordering this stuff, you need of course be sure that the chips on your LEDstrip are compatible.
If you mind to show us your patch, we might even find a few more bugs. And I still wonder how you did it with the Array in the Arduino code.
@m9dfukc: Thanks for the suggestion with the BaudRate. I don’t know how that didn’t come to my mind. I think that is just what you get when working late hours :) However, for some reason higher BaudRates don’t work as well / at all. Sometimes it changes to LED strip immediately, sometimes a second later, and sometimes not at all. I honestly don’t get it. I tried various BaudRates from 9600 all the way up to 115200 and 9600 is the only reliable one.
I also tried to send hex values to the Arduino but it didn’t really make any difference.
@Westbam: Thanks for shedding some light into the DMX world. I’ll check if that is an option for this project.
@mino: No it’s not the same that Adafruit sells. However - it is a Neopixel. Unfortunately I cannot use Serial.println() on the Arduino because the Serial Port is already occupied by vvvv and only one program can use it.
I also thought about programming all the effects on the Arduino side and then have vvvv just send signals to trigger the single animations and colors. As it looks right now this will be my solution.
@beyon: Thanks for reminding my about the Teensyduino. I didn’t know vvvv has a library for that board. That’s awesome! However - I’ll most likely not use the board since I think I’ve found a solution.
I’ll report back in a few days when I had a bit more time to work on my current early stage prototypes!
Thanks for all the suggestions so far and keep 'em coming :)
You can use Serial.read and Serial.print the same time, just look into the girlpower folder f.e. into “1_Arduino_DataAsStrings.v4p” … there is an example given for that. Just use the RS232 node instead of the serial monitor to listen to the Serial.print output.
So here’s my latest update.
I received a couple of Lithne Boards (http://lithne.id.tue.nl/) from the TU Eindhoven and will use those to control my RGB LED strips. They already have a wireless functionality build in and can control my Neopixel LED strips.
One Lithne will act as a coordinator and receive signals from vvvv and then forward the command to my 6 routers which will trigger the animations.
So basically I’m falling back to mino’s suggestions to only send signals from vvvv to trigger animations that are hard coded on the Lithne boards.
Also, @m9dfukc, checking the Serial in vvvv works. Super handy to know. Thanks!
Cheers everyone and thanks for the support!
I’ll report back with the final installation.