Jump to content

Connecting RGB LEDs


FantomXR
 Share

Recommended Posts

 

 

I'm suggesting you take a step by step approach to discovering what is going on with your LED array.

I've made some very specific suggestions.

It is up to you if you want to do it, or not.

Maybe you got me wrong?! Of course I want to do it, but I'm not sure, how to code that...

 

 

Edited by FantomXR
Link to comment
Share on other sites

  • Replies 74
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Maybe you got me wrong?! Of course I want to do it, but I'm not sure, how to code that...

No problem, I'm happy to help, but have limited time to type long messages. So ask questions if anything is not clear, and carefully explain what you try and what you see or find out.

 

Each LED has six pins. So wether common cathode nor common anode. But I wired all three cathodes of a rgb LED together. So now it's common cathode.

Good to know.

Now we are going to temporarily abandon matrix mode, and drive the rows and columns manually to see what's going on.

  1. Comment out or delete the whole line beginning with "DOUT_MATRIX n=1"
  2. Now we address the rows and columns as if they are single wires with single LEDs attached to each.
  3. Please refer to MIDIbox NG Manual - First Steps - Let there be light! - and- "Remote me!". This demonstrates driving an LED line with a MIDI message from MIOS Studio.
  4. Note that in this instance "fwd_id=LED:1" actually relates to the first row driver pin in your design. Understand that LED:n addresses each pin of the DOUT SR array. 
  5. Set up EVENT_BUTTON definitions for each row and column, don't worry that you don't have DIN attached to your core because you will be activating these events from the virtual keyboard. 
#row 1
EVENT_BUTTON id=1  fwd_id=LED:1  type=NoteOn key=36 button_mode=Toggle 

#row 2
EVENT_BUTTON id=2  fwd_id=LED:2  type=NoteOn key=37 button_mode=Toggle 

#row 3
EVENT_BUTTON id=3  fwd_id=LED:3  type=NoteOn key=38 button_mode=Toggle 

#row 4
EVENT_BUTTON id=4  fwd_id=LED:4  type=NoteOn key=39 button_mode=Toggle

#column 1 red

EVENT_BUTTON id=5  fwd_id=LED:9  type=NoteOn key=40 button_mode=Toggle
  1. When you press key 36, row#1 should be active, press it again and it should go in-active.
  2. Measure the output pin of the DIN  with a voltmeter to see that this is so.

I'll stop at this point let me know how you get on, before we continue.

Link to comment
Share on other sites

Thanks for your help.

 

I tried, what you were suggesting.

At first I copy&past your code into my NGC. By pressing #36 nothing happened. Also pressing #40 all LEDs stay dark.

I replaced "type=NoteOn key=40" with "type=cc cc=1". When I use the slider, I can switch on and off a array of 4 LEDs. This is not working on the rows. If I replace "type=NoteOn key=36" with "type=cc cc=1", nothing is changing. It's still not working...

 

I measured the rows and it's at 2,8V.

Link to comment
Share on other sites

Can you unplug the matrix from the DOUT and just look at the pins from the shift register.

I would have thought that pressing note#36 SR1,D7 (row1 driver) should go to 5V. Measure signal before the ULN2803 (i.e on the input pin of the ULN)

The idea of the Button toggle mode is so that you have (push on/push off) toggle action, makes it easier to observe.

Edited by Duggle
Link to comment
Share on other sites

Hey!

 

I disconnected the rows from the DOUT but leave the coloums connected. Here is what I did:

 

I used this code:
 

 

#row 1
EVENT_BUTTON id=1  fwd_id=LED:1  type=NoteOn key=36 button_mode=Toggle

#row 2
EVENT_BUTTON id=2  fwd_id=LED:2  type=NoteOn key=37 button_mode=Toggle

#row 3
EVENT_BUTTON id=3  fwd_id=LED:3  type=NoteOn key=38 button_mode=Toggle

#row 4
EVENT_BUTTON id=4  fwd_id=LED:4  type=NoteOn key=39 button_mode=Toggle

#column 1 red

EVENT_BUTTON id=5  fwd_id=LED:9  type=NoteOn key=40 button_mode=Toggle

 

I measured the input of the ULN, which is 4.9V. I measured the outputs = 0V. I pressed key #36 and measured the outputs again = 0V.

 

I changed the code to:

 

 

#row 1
EVENT_BUTTON id=1  fwd_id=LED:1  type=cc cc=1

#row 2
EVENT_BUTTON id=2  fwd_id=LED:2  type=NoteOn key=37 button_mode=Toggle

#row 3
EVENT_BUTTON id=3  fwd_id=LED:3  type=NoteOn key=38 button_mode=Toggle

#row 4
EVENT_BUTTON id=4  fwd_id=LED:4  type=NoteOn key=39 button_mode=Toggle

#column 1 red

EVENT_BUTTON id=5  fwd_id=LED:9  type=NoteOn key=40 button_mode=Toggle

 

I measured the outputs = 0V. I pulled up the CC1 fader in MIOS Studio and measured again. D7 is at 1,2V. All the other outputs have a small voltage too. See picture attached.

 

I'm really not sure, where to look for the mistake. I also tested it with another DOUT module. Same here. Also it seems, that button_mode=Toggle isn't working at my side. I also tried to again upload MF_NG without any results.

post-10331-0-81625800-1372935551_thumb.j

Link to comment
Share on other sites

Lets just get the basics right, first, then take it from there.
If you could restore the definition for row#1.
As I understand it, without button_mode=Toggle, you should see 5V when key#36 is pressed and 0V when it is released.

With button_mode=Toggle, press the key ->5V, press the key again ->0V, and so on.

Either way we want to see 0v and 5V on the output of the DOUT under midi control.

Link to comment
Share on other sites

As I understand it, without button_mode=Toggle, you should see 5V when key#36 is pressed and 0V when it is released.

With button_mode=Toggle, press the key ->5V, press the key again ->0V, and so on.

Either way we want to see 0v and 5V on the output of the DOUT under midi control.

 

The 5V at the output of the SR / the input of the ULN are always there. It doesn't matter, if I press a key or not.

 

I need to replace "type=NoteOn key=36" with "type=cc cc=1" to get something out of the ULN. I get 1,2V out of the ULN to D7 by pulling up the CC1 fader in MIOS Studio. I never got 5V out of the ULN. If I leave "type=NoteOn key=36" I measure 0V with pressed AND depressed #36 at D7.

Link to comment
Share on other sites

For now, forget about the ULN (unplug it if you can).

We are only interested in being able to control the output of a DOUT pin so that it toggles 0..5V

Is the SR we are looking at really SR1? (the first in the SRIO chain)

Please disconnect any other SRIO's from the chain.



I just looked at your photo.

 

It really makes sense to use IDC connectors and ribbon cables when working with DIN and DOUT PCB's!!!!

 

You can split the ribbon and route the wires as needed, then you can disconnect the DOUT PCB easily!!!!

 

Another question: is the ribbon to J1 correctly connected to the core?



If you can't get basic LED on/off like in the "Getting Started" tutorials, then the fancy RGB matrix won't work either. This is why it would be good to follow the basic tutorial, make sure everything is set up and working right, then getting the RGB stuff to work will be straight forward.

Link to comment
Share on other sites

Hey,

 

thanks for the hints.

You are right. I will solder off all the wires and use ribbon cables. I'm busy for today so I don't have much time to test. But I will come back to you shortly.

 

But to answer your questions:

Yes, this one is SR1. I disconnected all other DOUT / DIN modules from this one in the picture.

I also checked the cable on J1. The cable makes a half twist and goes not 1:1. This should be correct. The 74HC595 are getting their 5V...

 

I really want to get this machine running in the next days. So I hope, I don't strain your attention to much.

 

 

Thank you very much!

Link to comment
Share on other sites

Okay!

Thats my code:
 

 

RESET_HW

LCD "%CHello World!"

EVENT_BUTTON id=2  fwd_id=LED:1  type=NoteOn key=36  lcd_pos=1:1:1 label="Button #%3i: %3d" button_mode=Toggle

 

I connected a DIN to my core with a button attached. This one works fine. Right after the DIN I put my DOUT but I removed the ULN.

Now I'm able to switch on / off the outputs of the first SR by changing the "fwd_id=LED:x"-number. I measure 5V when I press the button. And 0V when I press it again. So... it seems everythings fine here...

 

 

//edit: I put back the ULN into his socket. I'm able to switch on / off the outputs of the ULN. The output that's "active" has 1,2V, the other have those small voltages like in the picture above... like 0,1V. By pressing the button again, everything goes to 0V. I'm wondering, why the other outputs also get small voltages... this should be 0V or did I miss something?

Edited by FantomXR
Link to comment
Share on other sites

That's great!

The midi key #36 should work should work just like the button. If not, you need to check communication between mios studio and the core. Alternatively a midi keyboard plugged into MIDI IN1 can be used. 

Let me know when you want to continue...

But basically the next step is to set up a config that makes it easy to toggle any of 4 rows as well as 16 columns of (R,G,B).

So that's (4+16*3) EVENT_BUTTON definitions, but its mainly cut/paste. Using the virtual keyboard as switches is probably easiest.

 

Link to comment
Share on other sites

So your suggestion is, to connect all LEDs to the two DOUTs? Maybe I should start, setting up another matrix of LEDs, which is much smaler.. lilke 4x4 or so. Just for testing and before connecting all the 64 LEDs again to the DOUTs.

 

I want to change to ribbon cables so I need to rip up a few.... or a few more.... cables the next days. Got a gig on upcoming saturday so I don't think I will be able to do this tomorrow.

 

But the problem that I reported remains: I think, because of the small voltages at the outputs, which are not active, the LEDs will light up low. But that's not what we want, is it? I thought, it's possible, to switch all LEDs completely off. Where does these voltages come from?

Link to comment
Share on other sites

The LEDs will be completely off when turned off because the driving source will be very close to 0V.

So something is wrong...

Sometimes when single matrix LED is soldered in backwards, it causes other LEDs (some, but not all) to light or glow when they shouldn't.

 

The idea of energising all the rows and columns separately (i.e the EVENT_BUTTON stuff) allows to completely check the whole array and isolate problems much more easily because the matrix is not being scanned at high frequency.

If you plan on re-wiring the array you can do this (testing) as you go, to make sure you're on the right track.  

Link to comment
Share on other sites

So you think that the 0,1V, that I measure on the not-active outputs wouldn't be enough to let the LEDs glow?

 

I don't want to rewire the whole array. Just the last LEDs of every row, which goes to D0:D3 on SR1 and the last LED of every coloumn, which goes to D0:D7 of the other SRs. I don't plan to rewire the connections between the LEDs.... I hope I don't have to, because this took me two days...

 

Anyway.... I will get back to you as soon as I rewired the connections and setup the NGC.

 

Thanks!

Link to comment
Share on other sites

So you think that the 0,1V, that I measure on the not-active outputs wouldn't be enough to let the LEDs glow?

Definitely not, because the forward voltage before current flows in the LED is usually at least 2V.

 

I understand about re-wiring up to the start of every row/column. That's fine. Are you absolutely certain about the polarity of every LED? (something for you to check, when you get time)  

Link to comment
Share on other sites

Okay... let's move on...

 

I connected the rows to the LEDs via ribbon cable.

I did connect the first 8 red LEDs. So the 1st SR and the 2SR are equipped.

 

Here is the code again:

 

 

RESET_HW

LCD "%CHello World!"

EVENT_BUTTON id=2  fwd_id=LED:8  type=NoteOn key=36  lcd_pos=1:1:1 label="Button #%3i: %3d" button_mode=Toggle

 

It says fwd_id=LED:8 because I use D5:D8.

Now I push the button, that's connected to the DIN. I measure between the cathode and anode of the LEDs and it says 1.2V from cathode TO anode. I don't know, how this should work?! I thought, the voltage has to go from + to - and not the opposite. Anyway: The LEDs aren't lightning.

 

Hm...

 

 

//edit:
I took a look at the second page of this thread and I missed something in the code. So I added

EVENT_BUTTON id=5  fwd_id=LED:9  type=NoteOn key=40 button_mode=Toggle

 

But still... nothing...

 

 

 

//edit2:

I tried that:

 

DOUT_MATRIX n=1  rows=4  inverted=1  sr_dout_sel1=1  sr_dout_r1=2 sr_dout_r2=5  sr_dout_g1=3 sr_dout_g2=6 sr_dout_b1=4 sr_dout_b2=7  led_emu_id_offset=1001

EVENT_LED value=127 id=1001  rgb=15:0:0
EVENT_LED value=127 id=1002  rgb=15:0:0
EVENT_LED value=127 id=1003  rgb=15:0:0
EVENT_LED value=127 id=1004  rgb=15:0:0
EVENT_LED value=127 id=1005  rgb=15:0:0
EVENT_LED value=127 id=1006  rgb=15:0:0
EVENT_LED value=127 id=1007  rgb=15:0:0
EVENT_LED value=127 id=1008  rgb=15:0:0


EVENT_LED value=127 id=1017  rgb=15:0:0
EVENT_LED value=127 id=1018  rgb=15:0:0
EVENT_LED value=127 id=1019  rgb=15:0:0
EVENT_LED value=127 id=1020  rgb=15:0:0
EVENT_LED value=127 id=1021  rgb=15:0:0
EVENT_LED value=127 id=1022  rgb=15:0:0
EVENT_LED value=127 id=1023  rgb=15:0:0
EVENT_LED value=127 id=1024  rgb=15:0:0

EVENT_LED value=127 id=1033  rgb=15:0:0
EVENT_LED value=127 id=1034  rgb=15:0:0
EVENT_LED value=127 id=1035  rgb=15:0:0
EVENT_LED value=127 id=1036  rgb=15:0:0
EVENT_LED value=127 id=1037  rgb=15:0:0
EVENT_LED value=127 id=1038  rgb=15:0:0
EVENT_LED value=127 id=1039  rgb=15:0:0
EVENT_LED value=127 id=1040  rgb=15:0:0

EVENT_LED value=127 id=1049  rgb=15:0:0
EVENT_LED value=127 id=1051  rgb=15:0:0
EVENT_LED value=127 id=1052  rgb=15:0:0
EVENT_LED value=127 id=1053  rgb=15:0:0
EVENT_LED value=127 id=1054  rgb=15:0:0
EVENT_LED value=127 id=1055  rgb=15:0:0
EVENT_LED value=127 id=1056  rgb=15:0:0
EVENT_LED value=127 id=1057  rgb=15:0:0

 

I can switch on / off the LEDs with changing the value to 0. So, that's working fine. Should I start, connecting all the other LEDs?

 

 

//last edit for now ;)

I tried that:

 

DOUT_MATRIX n=1  rows=4  inverted=1  sr_dout_sel1=1  sr_dout_r1=2 sr_dout_r2=5  sr_dout_g1=3 sr_dout_g2=6 sr_dout_b1=4 sr_dout_b2=7  led_emu_id_offset=1001

EVENT_BUTTON id=2  fwd_id=LED:8  type=NoteOn key=36  lcd_pos=1:1:1 label="Button #%3i: %3d" button_mode=Toggle


EVENT_LED value=127 id=1049  rgb=15:0:0
EVENT_LED value=127 id=1050  rgb=15:0:0
EVENT_LED value=127 id=1051  rgb=15:0:0
EVENT_LED value=127 id=1052  rgb=15:0:0
EVENT_LED value=127 id=1053  rgb=15:0:0
EVENT_LED value=127 id=1054  rgb=15:0:0
EVENT_LED value=127 id=1055  rgb=15:0:0
EVENT_LED value=127 id=1056  rgb=15:0:0
EVENT_LED value=127 id=1057  rgb=15:0:0

 

Now I can use the button to swich a row on / off. But! As soon as I switch them on, all other LEDs start glimming too.

Edited by FantomXR
Link to comment
Share on other sites

OK, the aim of this exercise is to emulate the action of the matrix to find out what's going on....
Therefore, to illuminate a LED in the matrix you will be activating both a row and a column at the same time.

So you'll need a button definition that activates a column:

#activate a row
EVENT_BUTTON id=2  fwd_id=LED:8  type=NoteOn key=36 button_mode=Toggle

#activate a column
EVENT_BUTTON id=3  fwd_id=LED:9  type=NoteOn key=37 button_mode=Toggle


This should light the Red of the LED at row#4, column#1

 

 

 

Link to comment
Share on other sites

Just for understanding:

Do I need to keep "DOUT_MATRIX n=1  rows=4  inverted=1  sr_dout_sel1=1  sr_dout_r1=2 sr_dout_r2=5  sr_dout_g1=3 sr_dout_g2=6 sr_dout_b1=4 sr_dout_b2=7  led_emu_id_offset=1001" in the code or just your example?

 

I copied your code into my NGC and connected a second button to the DIN. The id=2 button first does nothing. id=3 activates #1 column (four LEDs). After activating the column with id=3 I'm able to switch on / off the LED at row#4 while the other LEDs are still on. But these LEDs get's lower, as soon as I activate the LED at row #4. And the opposite: When I switch off the LED at row #4 this LEDs is still glowing...

 

//btw.: the toggle-mode is not working on the MIOS integrated keyboard.

Edited by FantomXR
Link to comment
Share on other sites

That's interesting...

 

 

EVENT_BUTTON id=2  fwd_id=LED:9 type=NoteOn key=36  lcd_pos=1:1:1 label="Button #%3i: %3d" button_mode=Toggle

EVENT_LED  id=9  dimmed=1  type=CC cc=16

 

So I assigned the slider in MIOS to the brightness of the column. By moving the slider upwards, all LEDs start to glow. But the first LED is the most brightest... the more I move the slider to the right, the more bright the LED gets... after the first LED reaches full brightness, the next LED is getting brighter, and so on...

 

 

//edit: Okay... new try.

 

I disconnected all LEDs. I picked a brand new SMD LED. I soldered a cable that goes from SR2 to the LED anode and another one keeping it in my hands. Now, with the code mentioned above, I have the following result: At D0:D2 of SR1 the LED glows a bit. At D3 it shines bright as a star... so to me it seems, the problem is the LED itself.

I measured the mA. On D3 of SR1 I measure 6mA, on all others 0,4mA, which is not that much. But seems, it's enough, to let them glow.

 

If you wanna look up the LED's I have, than go to ebay and insert this: 390524816984

Edited by FantomXR
Link to comment
Share on other sites

Just for understanding:

Do I need to keep "DOUT_MATRIX n=1  rows=4  inverted=1  sr_dout_sel1=1  sr_dout_r1=2 sr_dout_r2=5  sr_dout_g1=3 sr_dout_g2=6 sr_dout_b1=4 sr_dout_b2=7  led_emu_id_offset=1001" in the code or just your example?

No, step #1 in post #27 (we are emulating the matrix by manually switching rows and columns, this means we dont want DOUT_MATRIX definitions for now...)

 

//btw.: the toggle-mode is not working on the MIOS integrated keyboard.

Does this mean that the midi keys are working (that is, activating the EVENT_BUTTON definitions), but only in a momentary way (not latching as in "toggle mode")?

 

Do you have a real midi keyboard you can use for this diagnostic task? 

 

 

 

Link to comment
Share on other sites

No, step #1 in post #27 (we are emulating the matrix by manually switching rows and columns, this means we dont want DOUT_MATRIX definitions for now...)

Okay!

 

 

Does this mean that the midi keys are working (that is, activating the EVENT_BUTTON definitions), but only in a momentary way (not latching as in "toggle mode")?

 

Do you have a real midi keyboard you can use for this diagnostic task?

 

Yes and yes!

 

By the way: I did the last test which I mentioned in my prev. post now with a normal 5mm LED. This one stays off on the other outputs. I tested also another SMD LED which is 0603 green. This one glims a bit, but thats a lot less than my other RGB LEDs.

Link to comment
Share on other sites

I'm out of here today... I think here is something else VERY buggy... maybe it's the SD Card...

 

I do changes in the code on the fly.... and I can see the changes in the LEDs. I save the NGC... I disconnect the core from the computer, connect it again and it's not working anymore. After a bit of writing in the code, it works again.... Troubleshooting without having a working base, is senseless... I will get a new SD Card tomorrow...

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