Skip to content

Arduino LED's

What It Does

LED drivers are especially handy for microcontrollers like the Arduino. Please also take a look at the general LED drivers.

Bi-color LEDs

A minimal way to drive a bi-colored LED with just two digital pins .

  • Notice that digital OUTPUTS can also sink current.
  • Alternatively, instead of using a bi-colored you can use two different LED's.
OUTPUT 1OUTPUT 2COLOR
HLRED
LHGreen
LLNo light

Charlieplexing

Charlieplexing is a way to drive many LED's with minimal components by a microcontroller. Wiki.

  • Notice the usage of tri-state buffers.
  • Notice only 4 digital outputs are required for driving 12 LED's !
  • Notice only one LED can be driven at a time.
  • To set an Arduino pin as input use pinMode: INPUT.
  • To set an Arduino pin as high-impedance use pinMode: OUTPUT.

Formula

Usable LED's = 2 * ( [number of pins] nCr 2 )

As you can also see in the table below the amount of LED's you can control exponentially increases with the digital pins you use.

PinsLED's
10
22
36
412
520
630
742
856

TIP

If you want to show multiple LED's at the same time that technicaly can only be lightend one at a single time, like with the Charlieplexing, just quickly alternate between them. Switching between LED's from 24Hz or higher is too much for the eyes to see as alternation. The downside is the more LED's you alternate between the less bright they will be.

LED expansion

With this trick you can double the LED's you drive from your Arduino, MCU or shift registers etc.

  • Notice that the counter represents digital outputs of the Arduino.
  • Please play with the HIGH / LOW setting to change the color of the LED's.
  • Notice that the Arduino is sinking and sourcing current depending on the logic.
  • Please check if the Arduino can handle the total amount of current for both sinking and sourcing.