roberto

How to connect Common Anode RGB LEDs

8 posts in this topic

Hi

 

After testing the functionality of the CORE, DINs and DOUTs it’s time to layout the Controller.

 

I want to use (among others) 16 RGB Buttons and im unsure how to connect it to the DOUT’s.

I read some threads about it but didn’t found the answer that satisfied me.

 

http://midibox.org/forums/topic/18058-connecting-rgb-leds/?page=1

 

http://midibox.org/forums/topic/19752-rgb-hue-sweep/#comment-171871

 

 

The RGB Buttons are COMMON ANODE. One possibility is to attach it to a 6 *8 LED Matrix with the drawback to loose brightness.

I don’t want that, I have enough DOUTs to connect the LEDs directly, so I would like to go the direct way.

 

Is it possible to do that without using additional ULN Arrays?

As I understand it is possible to drive one RGB LED with one Midi Note and make the color with different velocities right?

 

And since I am at the very beginning of everything I don’t understand how the code should look for that...

 

 

 

Share this post


Link to post
Share on other sites

For common anode, wire the anode to +5V or your supply voltage (possibly through a resistor) and connect your cathodes to DOUT pins. If the light output is different for each die, you may want three resistors on the cathode side instead. E.g. red has a lower Vf, so may end up brighter, often green is too bright etc., so control the current with the resistors.

595s can sink current, meaning they "can provide ground/0V." So the output is "inverted" for common anode parts. This can be specified in MB_NG. When the 595 output is high, the LED is off. When it's low, the LED is on.

You shouldn't need any transistors if the current is nominally around 20mA or so. 

I haven't tried with the dim levels of normal RGB LEDs, but TK. has in your second link above.

Share this post


Link to post
Share on other sites

cool, thanks latigit, works... as i understand following code inverts the output:

EVENT_LED id=0 inverted=1
EVENT_LED id=1 inverted=1
EVENT_LED id=2 inverted=1

etc.

now i have to figure out how to assign the RGB LEDs to different velocities on the same note... phew, this coding is a big book to get into it... :cry:

 

the RGB button has internal resistors, so i think it's not necessary to match the color brightness...

 

Share this post


Link to post
Share on other sites

 

Quote

the RGB button has internal resistors, so i think it's not necessary to match the color brightness...

 

Perfect, even easier then! Good choice on the buttons.

 

6 hours ago, roberto said:

now i have to figure out how to assign the RGB LEDs to different velocities on the same note... phew, this coding is a big book to get into it... :cry:

It does take a while to understand the coding, but just go through the many examples. Notice in the "RGB hue sweep" thread, TK. has basically what you need. He uses a map to define the LED colour based on an incoming CC, so change that to notes over the range you require. The velocity should change the dim level, at least this is one way to work with "smart" LEDs.

 

 

Share this post


Link to post
Share on other sites

yes, those are nice buttons, rugged, but 10 bucks each... :decayed:

well, before fiddling with RGB hue, i have to solve following

by inverting i turn off the RGBLEDs on startup:

# Common Anode RGB LEDs 

EVENT_LED id=1 inverted=1  type=NoteOn  key=36   # Red LED
EVENT_LED id=2 inverted=1  type=NoteOn  key=37   # Green LED
EVENT_LED id=3 inverted=1  type=NoteOn  key=38   # Blue Led

by sending a NoteOn 36/37/38 and Off from the MIOS Keyboard i can light and turn off the 3 LEDs. Fine.

 

Now, when i define a button the behaviour is reversed

EVENT_BUTTON id=81  fwd_id=LED:1  type=NoteOn key=36  range=0:127  button_mode=Toggle
EVENT_BUTTON id=82  fwd_id=LED:2  type=NoteOn key=37  range=0:127  button_mode=Toggle
EVENT_BUTTON id=83  fwd_id=LED:3  type=NoteOn key=38  range=0:127  button_mode=Toggle

will say, the LEDs are OFF when the button sends a NoteOn and ON by a NoteOff...

i tried to inverse also the EVENT_BUTTON and the range (127:0) but nothing helps...

is there something else i need to invert? i don't get it.

Share this post


Link to post
Share on other sites

strange... i booted the whole thing on a second computer and now it's working as expected... :cry: will investigate...

Share this post


Link to post
Share on other sites

switched back to first comuter, and there it is again... button behaviour inversed again, damned...

Share this post


Link to post
Share on other sites

...just for the record. im slowly slowly get into the deep sea of MIOS...

i managed to map the RGB buttons with the multicolour test mentioned in TK's post above. everything's fine... (although magenta is missing in the map, i added it at the end after red...)

back to construction :happy:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now