I am thinking to add an LED based volume level indicator with 32 LEDs to my R-2R attenuator. The plan is to use two MCP23017 16bit I/O expander chips to control the LEDs. Looking at the datasheet it seems that each digital out of the MCP23017 can source/sink around 20mA which is plenty for LEDs (3~10mA). Could someone give me a hint if it is OK to drive LEDs directly by the MCP23017 digital outs or I would be better using transistor arrays e.g. ULN2803 after the MCP23017s?
Thanks!
Oleg
Thanks!
Oleg
Or consider the time honored LM3915/3916/3917 series of ICs designs to do exactly the job you propose: LED VU meter driver. The LM3916 comes to mind for me. Audio in, VU LEDs out. Single supply.
Thanks for the hint Enzo!
I should have made it clear - the plan is to statically indicate the selected attenuation level in dB and not the actual signal level like VU meters do. But maybe using the VU meter IC can help here too if I use analog outs from the uProcessor to set the necessary level.
Oleg
I should have made it clear - the plan is to statically indicate the selected attenuation level in dB and not the actual signal level like VU meters do. But maybe using the VU meter IC can help here too if I use analog outs from the uProcessor to set the necessary level.
Oleg
I am thinking to add an LED based volume level indicator with 32 LEDs to my R-2R attenuator. The plan is to use two MCP23017 16bit I/O expander chips to control the LEDs. Looking at the datasheet it seems that each digital out of the MCP23017 can source/sink around 20mA which is plenty for LEDs (3~10mA). Could someone give me a hint if it is OK to drive LEDs directly by the MCP23017 digital outs or I would be better using transistor arrays e.g. ULN2803 after the MCP23017s?
Thanks!
Oleg
Just include a current limiting resistor. If they are not bright enough you can tie another resistor to V+ and the logic level output.
Modern hi-brightness leds can be blindingly brilliant on well under 1ma so I wouldn't foresee an issue here as long as you choose suitable leds.
Thanks simon7000 and Mooly!
From your replies I assume that I can safely use digital outputs directly. I plan to use individual current limiting resistors for different color LEDs and a common higher power resistor to GND for easy brightness adjustment of the entire LED string. I actually do not need high brightness but rather "slow" glow.
Oleg
From your replies I assume that I can safely use digital outputs directly. I plan to use individual current limiting resistors for different color LEDs and a common higher power resistor to GND for easy brightness adjustment of the entire LED string. I actually do not need high brightness but rather "slow" glow.
Oleg
If you are going to have more than one led lit at a time then a common 'brightness controlling' resistor probably won't work to well as the brightness will vary as more or less leds are lit. The way around that is to common the leds to an adjustable voltage source. How you do that depends on whether the leds are commoned to the positive rail or ground.
So something like using a power transistor for common high(low) side control by adjusting the base potential by an analog out of uProcessor? Sounds even better than I originally thought since it would allow to do it in software.
Thanks,
Oleg
Thanks,
Oleg
Max Pdis is 700 mWPower dissipation is calculated as follows:
PDIS = VDD x {IDD - ∑ IOH} + ∑ {(VDD - VOH) x IOH} + ∑(VOL x IOL)
I've seen that. I guess if voltage drop on each of 16 digital outputs is around 0.5V and the current is around 10mA worst case the IC should dissipate around 0.5V*10mA*16 = 80mW so it should be fine. Thanks for making me do the math🙂 I should have done it earlier...
You are right... I overlooked it somehow. It only allows no more than 125mA/16 = 7.8 mA per output... or even less depending on how much current requires the IC itself. It may not be too bad but is also not flexible. With such a limit I would de-rate the current per output to 5mA if all LEDs are lit simultaneously.
Well, buffers are safe in this regard but they take space on the PCB. I'll have to dry fit the board to see if I have enough space.
Well, buffers are safe in this regard but they take space on the PCB. I'll have to dry fit the board to see if I have enough space.
Just looked at the MCP23008, the 8 bit I/O expander. It has the same max values as the MCP23017 but has only 8 outs so I can go as high as 10mA/output safely. Addressing the two MCP23008 ICs is as simple as a single MCP23017 IC via I2C. May be this is my solution...
So something like using a power transistor for common high(low) side control by adjusting the base potential by an analog out of uProcessor? Sounds even better than I originally thought since it would allow to do it in software.
Thanks,
Oleg
Yes, something along those lines.
You are right... I overlooked it somehow. It only allows no more than 125mA/16 = 7.8 mA per output... or even less depending on how much current requires the IC itself. It may not be too bad but is also not flexible. With such a limit I would de-rate the current per output to 5mA if all LEDs are lit simultaneously.
Well, buffers are safe in this regard but they take space on the PCB. I'll have to dry fit the board to see if I have enough space.
Get the led's first and see just how much current you need. You should be looking at under 1ma with efficient devices.
I already have the LEDs, will test them before deciding.
Also, what about more difficult case of dual LEDs with anti-parallel connection (2 legs)?
I guess I could use double the amount of MCP23017 expanders to be able to switch between colors but it will use all the available I2C addresses that I have. Another concern is the brightness of different colors due to common current limiting resistors and different operating voltages/currents. I think at this stage I have to assemble a small test setup and try it before designing a PCB but if someone has an experience with dual LEDs please advise.
Oleg
Also, what about more difficult case of dual LEDs with anti-parallel connection (2 legs)?
I guess I could use double the amount of MCP23017 expanders to be able to switch between colors but it will use all the available I2C addresses that I have. Another concern is the brightness of different colors due to common current limiting resistors and different operating voltages/currents. I think at this stage I have to assemble a small test setup and try it before designing a PCB but if someone has an experience with dual LEDs please advise.
Oleg
The bi and tri colour led's that I have used in the past have been nowhere near as efficient as single carefully chosen devices. Maybe modern ones are a lot better.
Or,
You can switch outputs on and off very fast so that total current never exceed the safe value.
This way the brightness may a little get lower.
Like, 4 Leds ON at a time. like a multiplexer. This way you will have to write some new codes.
You can switch outputs on and off very fast so that total current never exceed the safe value.
This way the brightness may a little get lower.
Like, 4 Leds ON at a time. like a multiplexer. This way you will have to write some new codes.
Last edited:
At the moment I do not know how efficient are my LEDs. May be I'm lucky and they do not require high current to be visible. I'll post my test results here. I have a collection of 2mm single color and bi color red/white LEDs to test.
Fast switching is a possibility but it would require a lot of communication via I2C bus which I would like to avoid.
Fast switching is a possibility but it would require a lot of communication via I2C bus which I would like to avoid.
Hi,
If you are going to use a micro to control the LEDs you should look into the TI 16 led driver TLC5940NT. Also do a research by reading the TI Application Report
SLVA259.
If you are going to use a micro to control the LEDs you should look into the TI 16 led driver TLC5940NT. Also do a research by reading the TI Application Report
SLVA259.
- Status
- Not open for further replies.
- Home
- Design & Build
- Construction Tips
- Driving LEDs by digital outs