Teensy for Midi-Controlled RGB Strips

Status
Not open for further replies.

Senescence

Member
Hi Everyone,

I am a musician and i use elecronics on stage and i thought i'd give it a try and make something with teensy to make all my electronic stuff more visual for the audience.

I got a Teensy 3.0 cause i read that it can behave as a midi device which is gonna considerably help me.

But i'm totally new at coding with arduino/teensy so i might need opinions on the feasability of my project and advice about coding.

So what i have :

Teensy 3.0
3x 60 RGB Led Strips WS2811
5V 10A power supply

My goal :

In the computer, on stage, i use a midi bridge from which i address midi signals and channels to the correct devices.

I'd love to be able to use this midi data to trigger the leds ON/OFF and if possible colors.
For example, i control the sound with an infrared sensor that sends midi data according to many X-Y-Z axis ...
So ... my first goal would be to send on a channel a midi CC from values 1-120 (for example) to the 60 leds strip and turn them on two by two ... 2 first leds for CC value 1, 2 other leds for CC value 2 and so on ... So the light would just follow the movement of my hands along the X axis of the controler.
Then maybe use another CC (along the Z axis of the controller) to change the brightness of the LEDS ... so the closer my hands get to the controller, the brighter the light is.

I hope i'm clear in my explanations ...
Hopefully someone here can help me and give my clues about how to get started with this ...
I saw that there are some very convenient MIDI and RGB libraries available on the website but i'm totally new to this so i really need help to start messing around with my projet.

Thanks a lot for any help.
 
Using OctoWS2811 and setting the Teensy to USB midi mode should make it relatively trivial to control via midi. I started down that route with my latest project until I switched to using max4live jitter matrix's to pump video data out instead. But you can easily send midi notes or control codes and have the teensy read them and animate your LEDs. There's also a modification out there that adds midi clock info to the teensy usb midi implantation so you can time your animations to the metronome. I'm on my phone at the moment, but when I'm back at a computer I'll post an example sketch with some animations being times to midi, as well as how to trigger an animation from a midi note.
 
Please start with the example, from File > Examples > Teensy > USB_MIDI > PrintIncoming. Set Tools > Boards to Teensy 3.0, and set Tools > USB Type to MIDI. Then upload it and open the Arduino Serial Monitor to see what it prints.

You do not need any hardware connected to your Teensy for this test. Just watch the serial monitor window, and try sending it MIDI messages.

Once that works, then you're ready to connect some LEDs. Again, start small and run one of the OctoWS2811's examples for testing the LEDs.

Then when you know that works, try copying any pasting chunks of code from one example into the other, so instead of just printing message to the serial monitor, set the color of LEDs and occasionally use the show() function to update them all.
 
@ Digital 11 : Amazing news !
Perfect ! Thank you so much and thanks in advance for the example sketch !

@Paul Thanks ! I'll try running examples to start understanding !


Also, is it possible to add some timing to the leds ?
Cause my 3 strips will have to behave the same, but connected to different pins so each strip does the same but with a delay for two of them ... or, even better, with a fading ...
 
Last edited:
Also, is it possible to add some timing to the leds ?

Yes, of course it's possible. It might even be fairly easy, but the details will depend on how your other code is structured, so we'll be able to talk about this more specifically when you have that working and can post it here for discussion.

But to get you started thinking about how to do this, here are the timing functions:

http://www.pjrc.com/teensy/td_timing.html

Most likely you'll use one or more elapsedMillis variables. You'll probably set them to zero when some conditions happen to trigger lights to change in the future. Somewhere in loop(), you'll check if they've increased beyond some threashold, and if so do whatever light changes you want.

Edit: This might involve also creating another variable to remember what state the lights are in. For example, if they change between 5 colors over time, maybe you'd create an int to remember which of the 5 it is right now. Each time the elapsedMillis increases beyond the threshold, you'd change the other variable and use its new value to decide what color to actually update the LEDs.

There are a lot of possible ways to make these things work. More specific questions with posting the code you're already using can get much better, more specific answers.
 
Last edited:
Great. It all makes sense.
Im still missing the 10a power supply so i cant really get started with coding for the strips. But as soon as i start ill post my tests here.
Thanks a lot for the leads.
 
You can connect just a few LEDs and power them from the VIN or VUSB pin. If you've never done any of this before, starting with a very small-scale test might be wise.
 
Sorry for the delay, this is the first time I've sat down at a computer since my last post.

Here's the howto on adding midi beat clock to the Teensy midi code:
http://little-scale.blogspot.com/2011/08/how-to-deal-with-real-time-midi-beat.html

And here's the sketch I was playing around with when I was heading down the MIDI route. This is incomplete, and was just what I was doing to play around with animations timed to MIDI.
https://dl.dropboxusercontent.com/u/142550/Sketch.zip

Also, is the 10a power supply you're waiting on the one from Adafruit? If it is, be warned that all of the ones I've tried from them are enough over voltage that none of them worked with my Teensy's. They brought the minimum input signal voltage up too far past the 3.3v output by the Teensy pins.
 
Man, you're awesome ! Thank you so much for the help.
My power supply is one that i bought on ebay. Like those big ones for computers so i guess it'll do just fine.
Now i'm currently diving into all the tech stuff about wiring the teensy ... I'll get into coding pretty soon. I'm thinking posting my attempts, sketches and stuff on a dedicated tumblr so maybe if i reach my goal, it could be useful information for other musicians to build the same device or inspired by mine.
 
Man, you're awesome ! Thank you so much for the help.
My power supply is one that i bought on ebay. Like those big ones for computers so i guess it'll do just fine.
Now i'm currently diving into all the tech stuff about wiring the teensy ... I'll get into coding pretty soon. I'm thinking posting my attempts, sketches and stuff on a dedicated tumblr so maybe if i reach my goal, it could be useful information for other musicians to build the same device or inspired by mine.

Sounds fun. Doing the Tumblr is a great idea. What music software are you going to be using to drive it?
The project I did wasn't from a musician standpoint, but since I'm a musician and had Ableton/Max4Live sitting around, they were the easiest to use. :) I ended up learning a ton about Max doing this as well.
You can see the project in this video, although the video is about the party, not just the Twitter Taxi:
http://vimeo.com/80346444

I'm working on trying to get permission to release the source code for my sketches and Max patches. The Max patch especially would be extremely helpful to someone wanting to use Teensy's/WS2811 strips for music related projects.
 
ohhhh sounds interesting !
On stage i only use Live/max ...
But depending on the set up, i use also a global midi bridge to be sure that i have everything routed properly cause we have a shit ton of controllers on stage and i'm always scared of bad surprises :D
 
Please start with the example, from File > Examples > Teensy > USB_MIDI > PrintIncoming. Set Tools > Boards to Teensy 3.0, and set Tools > USB Type to MIDI. Then upload it and open the Arduino Serial Monitor to see what it prints.

You do not need any hardware connected to your Teensy for this test. Just watch the serial monitor window, and try sending it MIDI messages.

Once that works, then you're ready to connect some LEDs. Again, start small and run one of the OctoWS2811's examples for testing the LEDs.

back to this !!!
It works !
I can now totally route my midi messages to the teensy ... It seems to read them properly ! Thank you for the tip !
Now i need to understand how to turn on a specific led of the strip depending on the midi signal ...
Any advice ?
 
Status
Not open for further replies.
Back
Top