Jump to content

How to connect Common Anode RGB LEDs


roberto
 Share

Recommended Posts

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...

 

 

 

Link to comment
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.

Link to comment
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...

 

Link to comment
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.

 

 

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

...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:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...