Sparkfun Button Pad 2x2 - Beakout - More power


The brightness of an LED is governed by the current flowing through it, if you keep the current at 20mA the brightness will not change.

There is a parameter in LED specs that gives a maximum peak current that the LED can withstand,
if you can check those and use that as a guide.

As the module is a Sparkfun device, you might be able to get that figure from them.

Tom... :smiley: :+1: :coffee: :australia:

This I think is the LEDs array they use.

It looks like 30mA may be the limit.

Tom.. :smiley: :+1: :coffee: :australia:

I guess that would be Ipf at 30mA?:

Edit: almost posted at the same time :smiley: So what i might (or will) run into is the GPIO-pin being limited in how much current (40mA, it seems?) it can supply to each LED?

i mus apologize. my proposal will not work.
this appear to be able to work:

This is the document you need.

See page 43.

You can draw up to 40mA per output pin, BUT if the pins are from the same output domian/port you would have to degrade that value to 10mA.

You will need BJT or MOSFET drivers by the looks of it.

Tom... :smiley: :+1: :coffee: :australia:

Does this require specific transistors or can i use my 2N3904s?

it is low power transistor, but of course u can try

2N3904 has collector current max 200mA so you should be fine.

Tom... :smiley: :+1: :coffee: :australia:

This whole discussion has become quite bizarre!

In summary, you have a microcontroller module which operates at 3.3 V and whose outputs are limited to a nominal 28 mA sink current which is inappropriate for driving LEDs as 3.3 V is too close to the necessary voltage for blue LEDs.

5 V would be quite adequate, but the LEDs are in a matrix which means that to control them individually, you need to multiplex them as one in four. So you cannot drive them to their specified 20 mA as you only have that 28 mA sink current for three LEDs simultaneously so the limit becomes 10 mA and for one quarter of the time.

You need extra components and to drive anodes HIGH you would need both NPN and PNP transistors. Common types are perfectly capable of 20 or 30 mA so that is not a problem. Cathodes can be driven with a single NPN transistor. In total, ten transistors and ten resistors.

We really need to look for an IC solution. The simplest that comes readily to mind - we are effectively driving 12 LEDs - is a MAX7219. One IC, one resistor and a couple of capacitors, three control pins and no requirement for tedious multiplexing code from your microcontroller. :sunglasses:

Note also that the single MAX7219 can drive four of these button modules together.

and additional profit from MAX7219:

if LED is lighted - it cost no more CPU time to maintain the state of the LED

As I said, "no requirement for tedious multiplexing code from your microcontroller. :sunglasses:"

Oh, that's very interesting! So i could do something like this?:

You might want to look again at the circled part of your diagram, you are grounding the 4 inputs.

Tom... :smiley: :+1: :coffee: :australia:

Something like it, but with all the mistakes corrected. Rset - R19 on your diagram - should be no less than 10k and the switch/ button common should be connected to ground using either the internal pullups or 4k7 pullups to 3.3 V on the buttons.

I suggest getting a max7219 matrix module kit rather than just the MAX7219 as then you have a nice PCB. Just ignore the actual LED matrix and its socket pins.

We pretty much all suggest getting a switchmode "buck" regulator to derive your 5 V from 12 V rather than the old 7805.

I totally forgot to change R19 (now R5). 1k is the default used by EasyEDA..

So now i'm using the built in pullups on the input pins, connecting the switch common is connected to ground.

I'm eventually gonna be making this into a full PCB with space for the regulator, microcontroller, MAX7219 and a bunch for screw terminals for easier connections.

The 7805 was just what i had lying around, but just for you i dug out a switching regulator :smiley:

@kolaha - isn't that exactly what i'm doing? Remember that PIN1 of JB2-JB5 are the switches and not LEDs