Author Topic: How do I programtically change power to bi-polar leds  (Read 86 times)

AVGresponding and 1 Guest are viewing this topic.

Online RAPoTopic starter

  • Frequent Contributor
  • **
  • Posts: 708
  • Country: nl
I want to create an array of 64 bipolar 2-pin LEDs arranged in a de Bruijn cycle, lighting up 6 consecutive LEDs in one of the two colours.

What I need is a method (by programming an Arduino or something like that) that
changes a chosen subset of LEDs to the opposite colour, i.e. reversing the plus and minus applied to the LEDs.

What is the best way to do this with minimal component count?

To be explicit, the question is not about how to extend the number of GPIO pins,
but is about the way to change the plus/minus voltages applied to a set of pins.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2695
  • Country: us
Re: How do I programtically change power to bi-polar leds
« Reply #1 on: Today at 03:38:40 pm »
To be explicit, the question is not about how to extend the number of GPIO pins,
but is about the way to change the plus/minus voltages applied to a set of pins.

It's not really possible to separate the two.  There are many ways to solve the problem, but the best one will depend on how many IO pins you have available and what kind of control you want to have over the LEDs.

Do you need to be able to turn individual LEDs off as well, or just select one of two colors?  If you just need one color or the other, then you could use a single IO line per LED, route that directly to one side of the LED, and then through an inverting buffer to the other side of the LED.  The state of the IO pin then selects the color.  If you need to be able to turn LEDs off as well, then you can connect one side of the LEDs all together, drive that side with a pair of transistors (sufficient to handle the combined current of all of the LEDs), and then wire the other side of each LED to an independent IO line.  Set each of those IO lines high for one color, low for the other color, or tristate for off, and then toggle the common side between high and low.  That effectively multiplexes the LEDs by color, so all of the LEDs set to color A will be on, then all those set to color B, etc.  You can use fewer IO lines by multiplexing somehow, but that's challenging with bipolar LEDs -- in any sort of matrix arrangement, there will be parasitic paths that will carry current through LEDs that should be off, and they might light up when you don't want them to.  Modern LEDs are crazy efficient, and can visibly glow at surprisingly low votlage/current.

Are you trying to control the brightness as well or just the color?  Generally you wouldn't change the voltage to change the brightness -- if you want analog dimming, then it's better to control the current through the LEDs rather than the voltage.  But it takes fewer components to do the dimming digitally, by controlling how much time each LED is on.  Exactly how you accomplish that will again depend on how they are connected. 
 

Online RAPoTopic starter

  • Frequent Contributor
  • **
  • Posts: 708
  • Country: nl
Re: How do I programtically change power to bi-polar leds
« Reply #2 on: Today at 04:21:12 pm »
Thanks for your quick answer ajb.

My situation is a bit more complex: each led can be one of three states: Off,Red,Yellow. Red color is +/- power, Yellow color is -/+ power.
The program calculates a new state for each of the leads, and the LEDs will have to be powered off/on.

A simplified example with 4 LEDs and two LEDS on goes as follows
Initial led 1= off, led 2=Red, led 3 Yellow, led 4 =off.
The program calculates the new state as display LED 1 and LED 3, all in color Red.

So LED 1 has to have +/- power, LED 2 = off, LED 3=+/- power, LED 4 is off.
Each of the possible states is possible, so in a next round LED 3 can be yellow (-/+ power) and LED 4 RED etc
« Last Edit: Today at 04:49:04 pm by RAPo »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf