Btn/LED matrix vs direct configurations

Hi,

i wonder about pro/cons of matrix configurations vs direct connections (DIN/DOUT/DIO). What i’ve found so far is lower led brightness in matrix configs and different wirings.

I’ll have 30 encoders, 60 btns and 90 leds mounted all over a fairly large (80x25cm) frontpanel perf board. To me it seems that direct connections to DINX4/DOUTX4 modules would lead to cleaner wiring in my case. Would that many IO modules result in bad performance as in higher core/cpu usage?

 

ps Additionally the controller will have 40 pots, a 4 octave keybed and 8 oleds.

LEDs in matrices are only on 1/8 of the time, so naturally they’re dimmer. Are you using sink transistors, or at least no resistor on the sink side?

Matrices are designed to save pins, but it only makes sense when you have close to a grid arrangement. 

Count your pins for individual wiring:

30 encoders = 60 DINs

60 buttons = 60 DINs

90 LEDs = 90 DOUTs

120 DINs /8 per chip = 15 165 chips = 4 DINX4 modules

90 DOUT /8 per chip = 12 595 chips = 3 DOUTX4 modules

MIOS32 allows for a maximum of 32 shift registers (I think this is 32  DIN + 32 DOUT), so you’re okay.

 

 

I hope we get to see it one day.

Thanks for your input

 

39 minutes ago, latigid on said:

Matrices are designed to save pins, but it only makes sense when you have close to a grid arrangement.

I anticipate the distances between LEDs/Btns etc. will be too large. So i’m leaning towards direct connection via DIN/DOUT modules.

 

35 minutes ago, latigid on said:

Are you using sink transistors, or at least no resistor on the sink side?

Unfortunately i’ve no idea what do you mean by this. For the LEDs i’d have 220ohms resistors on the DOUT modules. Is this what you’re referring to? Do i need something like that with that many LEDs?

My current thinking is that i would need to power the core via a dedicated power supply (20mA * 100 = 2A max for LEDs alone).

 

42 minutes ago, latigid on said:

I hope we get to see it one day.

I hope too :slight_smile: It’s a slow process because i’m a beginner.

 

4 minutes ago, tago said:

Thanks for your input

 

I anticipate the distances between LEDs/Btns etc. will be too large. So i’m leaning towards direct connection via DIN/DOUT modules.

It creates more wiring work/mess and potential for mistakes, but can be simpler to address individual elements. With the NG if you have a missing/swapped connection, it should be quite simple to identify and fix.

 

4 minutes ago, tago said:

Unfortunately i’ve no idea what do you mean by this. For the LEDs i’d have 220ohms resistors on the DOUT modules. Is this what you’re referring to? Do i need something like that with that many LEDs?

It doesn’t matter if you go for single wiring, because you’re addressing individual LEDs, with the DOUT pin via a resistor to the anode, and the cathode tied to ground.

However, when using a matrix, you want a constant current sink on the cathode side, so you bridge the resistors only on that DOUT section with wire. Otherwise, your total series resistance is ~440 ohm at a duty cycle of 0.125, and this will lead to dim LEDs! The other method is to connect the sink side resistors to the base of NPN transistors (collector to LED cathodes, emitter to ground/0V), or you could consider the ULN2803 octal Darlington driver. (The latest rev DOUT boards from SmashTV can fit sink or source driver chips directly on the PCB.)

 

4 minutes ago, tago said:

My current thinking is that i would need to power the core via a dedicated power supply (20mA * 100 = 2A max for LEDs alone).

For red/yellow/yellow-green LEDs with Vf ~2V, your consumption is approximately (5-2)/220 = 13.6mA for each LED. Don’t forget the OLEDs can have reasonable consumption too. 

 

4 minutes ago, tago said:

I hope too :slight_smile: It’s a slow process because i’m a beginner.

Keep at it, you’ll get there eventually!

A small side note: don’t wire up the encoders in matrix configuration. The normal encoder pulses will be high-speed and may not be “caught” by the reduced sampling rate of an input matrix leading to erratic encoder behaviour. At least that is my latest tech info, please correct me, if i am wrong :-). No problem on the LED output side, though, 8x8 matrices are great with low-power LEDs. This also drops your estimated current consumption a lot, a single LED will then not consume 20mA, only 1/8th of that, because of the reduced duty cycle.

Many greets,
Peter

That’s right Peter, encoders should be directly connected to 2* DIN pins. With button/LED matrices it can work and does save lots of pins and power, but the additional wiring might be suboptimal. For instance, anything other than a clean, square array will mean rows will be split, but the columns still need to be wired together. Of course, a way around this is to create multiple matrices based on smaller sections, even if not all positions are filled.

Best,
Andy

1 hour ago, latigid on said:

However, when using a matrix, you want a constant current sink on the cathode side, so you bridge the resistors only on that DOUT section with wire.

Like shown in this schematic:http://www.ucapps.de/mbhp/mbhp_dout_8x8leds.pdf ?

 

1 hour ago, latigid on said:

or you could consider the ULN2803 octal Darlington driver. (The latest rev DOUT boards from SmashTV can fit sink or source driver chips directly on the PCB.)

I made my own DIN/DOUT boards and forgot to add the ULN2803 option. So i can only mount standard resistors or bridges :frowning:

 

 

1 hour ago, Hawkeye said:

A small side note: don’t wire up the encoders in matrix configuration. The normal encoder pulses will be high-speed and may not be “caught” by the reduced sampling rate of an input matrix leading to erratic encoder behaviour.

Thanks for the hint Peter, sounds plausible.

 

 

4 minutes ago, latigid on said:

With button/LED matrices it can work and does save lots of pins and power, but the additional wiring might be suboptimal. For instance, anything other than a clean, square array will mean rows will be split, but the columns still need to be wired together. Of course, a way around this is to create multiple matrices based on smaller sections, even if not all positions are filled.

How would that smaller sections look like? Two 4x4 (32 LEDs) instead of a single 8x8 (64 LEDs)? Is 4x4 even possible?

56 minutes ago, tago said:

Like shown in this schematic:http://www.ucapps.de/mbhp/mbhp_dout_8x8leds.pdf ?

 

I made my own DIN/DOUT boards and forgot to add the ULN2803 option. So i can only mount standard resistors or bridges :frowning:

 

 

Just try with the bridges, it should be okay with single anode columns

 

Just now, tago said:

How would that smaller sections look like? Two 4x4 (32 LEDs) instead of a single 8x8 (64 LEDs)? Is 4x4 even possible?

4*4 = 16 :slight_smile:

For this, please read the NGC section:

 

Quote

DOUT_MATRIX

The DOUT_MATRIX command configures LED matrices which are connected between multiple DOUT shift registers.

Usecases:

  • Already with 2 DOUT shift registers it’s possible to control 64 LEDs. One DOUT is used to select the column, the second DOUT to set the row pattern. By using the led_emu_id_offset parameter they behave like common EVENT_LED elements and can be controlled individually. This saves some hardware! (only 2 DOUT shift registers instead of 8 to drive 64 LEDs).
    Other useful hardware configurations: with 1 DOUT assigned to the column, and two assigned to the row, up to 128 LEDs can be controlled from 3 DOUT shift registers. With two DOUTs assigned to the column, and two assigned to the row, up to 256 LEDs can be controlled from 4 DOUT shift registers.
  • Actually each matrix provides three separate “row layers”, called r, g, b (red, green, blue). You get the message: this allows you to control multicolour LEDs!
  • LED Rings and Meters - see also the LED_MATRIX_PATTERN configuration below. The led_matrix_pattern can be passed from a control element (e.g. EVENT_ENC) to the LED matrix in order to output a pattern based on the event value.
  • LED Digits (7-segment displays) are controlled from a DOUT_MATRIX as well. Here are some interconnection diagrams with the appr. .NGC configuration examples:
  • Interconnections for 5 7bit displays (cfg/test/leddig1.ngc)
  • Interconnections for MTC and Status LED Digits of a Logic Control Emulation (cfg/test/leddig2.ngc)

Available configuration parameters:

DOUT_MATRIX Parameter Description
n=<1..8> Specifies the matrix number which should be configured; it can range from 1..8
_rows=<4 8
  • rows=4: 4 selection pulses are output by the DOUT register specified with sr_dout_sel1. The pulses are available twice: at D7:D4 and D3:D0.
    This configuration allows to scan up to 4x8 LEDs with two DOUTs, or 4x16 LEDs with three DOUTs.
  • rows=8: 8 selection pulses are output by the DOUT register specified with sr_dout_sel1. The pulses are available at D7:D0
    This configuration allows to scan up to 8x8 LED with two DOUTs, or 8x16 LEDs with three DOUTs.
  • rows=16: 16 selection pulses are output by the DOUT registers specified with sr_dout_sel1 and sr_dout_sel2. The pulses are available at D7:D0 of each register.
    This configuration allows to scan up to 16x8 LEDs with three DOUTs, or 16x16 LEDs with four DOUTs.

|
| inverted=<1|0> | DOUT selection lines will be inverted with inverted=1. This is required if the LEDs of the matrix have been connected in the opposite order:

  • inverted=0: Cathodes are connected to the DOUT selection lines, see also this schematic.
  • inverted=1: Inverting sink drivers have been added to the DOUT register.
  • inverted_sel=1 and inverted_row=1: Anodes are connected to the DOUT selection lines (swapped polarity)

|
| inverted_row=<1|0> | DOUT row patterns can be inverted with inverted_row=1 |
| sr_dout_sel1=<0..16> | Sets the first DOUT shift register which should output the row selection signals. |
| sr_dout_sel2=<0..16> | Sets the second DOUT shift register which should output the row selection signals in a row=16 setup.
Set this parameter to 0 if a second DOUT is not required. |
| sr_dout_r1=<0..16> | Sets the first DOUT shift register of the LED matrix row. |
| sr_dout_r2=<0..16> | Sets the (optional) second DOUT shift register of the LED matrix row. |
| sr_dout_g1=<0..16>
sr_dout_g2=<0..16> | These parameters allow to drive duo-colour or RGB LEDs by using a second set of DOUTs connected to the green LEDs. |
| sr_dout_b1=<0..16>
sr_dout_b2=<0..16> | These parameters allow to drive RGB LEDs by using a third set of DOUTs connected to the blue LEDs. |
| mirrored_row=<1|0> | The pins of the DOUT rows can be mirrored. This happens only for the shift register value itself. Means: if two DOUT shift registers are assigned to the row, they won’t be swapped. If this is desired, just change the sr_dout_r1/sr_dout_r2 assignments. |
| led_emu_id_offset=<1..4095> | With a value >0, the LED matrix will listen on EVENT_LED events instead of EVENT_LED_MATRIX, starting with the specified ID. A matrix of 8x8 LED can emulate 64 LEDs with individual event assignments this way.
In order to avoid conflicts with LEDs which are directly connected to DOUT pins (and which are accessed with LED:1 .. LED:256), it’s recommended specify emulated ids outside this range, e.g. led_emu_id_offset=1001. |
| lc_meter_port=<USB1..USB4|IN1..IN4> | Special option for the Logic/Mackie Control emulation. It allows to transfer incoming Poly Preasure events (which are used by the protocol to trigger the meters) to LED bars. An usage example can be found in following template (search for “meter”): logictrl.ngc |

 

 

1 hour ago, latigid on said:

4*4 = 16 :slight_smile:

But TWO 4*4 = 32 :slight_smile:

I thought SR1/SR2 (D7-D4)  = one matrix and SR1/SR2 (D3-D0) = second. But according to the docs it looks like 4x8 is the smallest.

The main problem is how to keep the wiring clean with perf boards.

 

Another problem is that i’d like colored LEDs. I assume i have to use different resistors to get an even brightness between them.

11 hours ago, tago said:

Another problem is that i’d like colored LEDs. I assume i have to use different resistors to get an even brightness between them.

The way around this is to arrange LEDs of a single colour for each column. It’s also important to do this when the Vf values are different, otherwise the current takes the easiest path through the wrong LED.

You can use strip board either vertically or horizontally to reduce you wiring if it makes sense for your layout. It should cut your individual wires almost in 1/2.

3 hours ago, gerald.wert said:

You can use strip board either vertically or horizontally to reduce you wiring if it makes sense for your layout. It should cut your individual wires almost in 1/2.

I have 500x200mm perf boards (hard paper) for now, it’s not perfect.

Do you know a supplier for large sturdy strip boards? At Reichelt they only have max. 500x100mm (hard paper). I would prefer epoxy for more mechanical stability. My frontplate dimension is 800x250mm.

 

I tested some 20mA LEDs and found they could be dimmer. Low-current LEDs (2mA) would be to dark. Is it ok to halve the current via higher resistance sink resistor? Or will there be too much loss/ bad efficiency?

Just now, tago said:

I tested some 20mA LEDs and found they could be dimmer. Low-current LEDs (2mA) would be to dark. Is it ok to halve the current via higher resistance sink resistor? Or will there be too much loss/ bad efficiency?

Matrix or direct drive?

Just now, latigid on said:

Matrix or direct drive?

Direct, i assume in a matrix they would be fine.

How does the dimmed parameter work? Is it via pulsing with variable frequency? Could it be more energy efficient than higher resistance?

Try dimmed and see how it works for you. Dimming doesn’t work properly in a matrix.