Jump to content

Led's turn on one by one as resistance -

cleb

So I'm working on a senior project for my electronics class(In high school)  and one of the things we'll need to make it work is we want a row of leds (Or a strip depending) to light up but only one by one as resistance changes. So say resistance is set at x one led will be on but then you turn it down and led one and 2 turns on, then 1 and 2 and 3 and so on and so on. I haven't been able to get anything with just resistors and leds working. Perhaps I need another component, or a diode of sorts? Perhaps some sort of IC. I'd really appreciate any input. 

Link to comment
Share on other sites

Link to post
Share on other sites

Lots of options available, here are a few just off the top of my head:

  • Using the classic lm3914/lm3915 with a voltage divider as a means of getting your input voltage
  • Using a bunch of comparators (either jellybean op-amps or actual comparators)
  • Using an arduino with a voltage divider and multiple LED's (either individual LEDs or some WS2812 pixels)
  • Using an array of zener diodes and LEDs (along with some other passives)

If you could provide more info on your project I could maybe point you to some tutorial or at least tell you which one is better for what you need. Anyway hope it helps.

Cheers

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, dany_boy said:

Lots of options available, here are a few just off the top of my head:

  • Using the classic lm3914/lm3915 with a voltage divider as a means of getting your input voltage
  • Using a bunch of comparators (either jellybean op-amps or actual comparators)
  • Using an arduino with a voltage divider and multiple LED's (either individual LEDs or some WS2812 pixels)
  • Using an array of zener diodes and LEDs (along with some other passives)

If you could provide more info on your project I could maybe point you to some tutorial or at least tell you which one is better for what you need. Anyway hope it helps.

Cheers

Well essentially what we want is for a temperature sensor that reacts and causes this effect on leds. I've seen some ardunio solutions but we want it to be as compact as we can make it. 

Link to comment
Share on other sites

Link to post
Share on other sites

which temp sensor in particular? There are LOTS of ways for a sensor to interface with control logic. Is it a thermistor? the classic LM35? Some digital one? Or can you choose the sensor? I you can, go for a lm35 and a lm3914. That combo is probably the simplest to implement.

Cheers

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, dany_boy said:

which temp sensor in particular? There are LOTS of ways for a sensor to interface with control logic. Is it a thermistor? the classic LM35? Some digital one? Or can you choose the sensor? I you can, go for a lm35 and a lm3914. That combo is probably the simplest to implement.

Cheers

It is up to us what we use so any will do. I will check out the lm35 and lm3914 as I've seen it come up a few times in my research. Thank you. 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Rakcom said:

Here is a video on how to use the LM3914 

 

Oh nice Dave has a video on that IC, I had forgotten about that one. @cleb this is probably the simplest option

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

The easiest would be with a microcontroller. You use a pin for ADC (you put that resistor in a voltage divider and as the resistance changes so does the voltage on the input pin) and simple code in the microcontroller turns leds on or off , one led per pin in series with a resistor to limit the current (each output pin on a microcontroller typically can do up to around 15mA but in total a microcontroller may only be able to do around 100-150 mA on all output pins.

So for example if you use a 28-40 pin microcontroller you could potentially use 16-24 leds so in that case you would limit the max current to something like 5mA (enough with modern leds)

Excluding the cost of the programmer, microcontrollers are also often cheaper than chips like LM3914 , LM3915  etc and also allow to you interact with other things like i2c based temperature sensor ICs or optical sensors, whatever.

Link to comment
Share on other sites

Link to post
Share on other sites

57 minutes ago, mariushm said:

The easiest would be with a microcontroller. You use a pin for ADC (you put that resistor in a voltage divider and as the resistance changes so does the voltage on the input pin) and simple code in the microcontroller turns leds on or off , one led per pin in series with a resistor to limit the current (each output pin on a microcontroller typically can do up to around 15mA but in total a microcontroller may only be able to do around 100-150 mA on all output pins.

So for example if you use a 28-40 pin microcontroller you could potentially use 16-24 leds so in that case you would limit the max current to something like 5mA (enough with modern leds)

Excluding the cost of the programmer, microcontrollers are also often cheaper than chips like LM3914 , LM3915  etc and also allow to you interact with other things like i2c based temperature sensor ICs or optical sensors, whatever.

Simple != Easy. But it is true that a micro gives you much more flexibility

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

A NPN transistor + resistor voltage divider for each led would also work.

The transistor will only start conducting when there's about 0.7V between the BE junction. By calculating different voltage dividers for each transistor you can make the transistors turn on one by one as voltage rises.

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, i guess that would work, but must keep in mind that base-emitter voltage is usually limited to small values, and you also have small collector-emitter values.  So if you use same npn transistor for multiple leds and just change the voltage divider resistors, you may damage npn transistors.

 

For example, jellybean npn transistors like BC849 have Vce of only 30v and the Vbe is maximum 5v and the transistor starts to work from about 0.7v (0.58 min ..0.7v max for 2mA Ic)

 

Let's say you have a strip of leds with minimum 0v and maximum 25v, one led for each 5v. 

If you want the first led to light up between 0v and 5v, you would use a voltage divider of 1:2 giving you 0.7v on the base from around 1.5v, so the led would light up between 1.5v and 5v. But, when the voltage is 20..25v, the voltage divider will still be 1:2, so you'll have a voltage on the base of 20v..25v/2 =  10v..12.5v, which is much more than the maximum 5v, so you'd damage the npn transistor.

 

I suppose you could have some fun with zener diodes and do something similar. could turn on leds on and off with quad channel opamps or all kinds of logic ics, can't even be bothered to search.

 

Link to comment
Share on other sites

Link to post
Share on other sites

17 hours ago, mariushm said:

Yeah, i guess that would work, but must keep in mind that base-emitter voltage is usually limited to small values, and you also have small collector-emitter values.  So if you use same npn transistor for multiple leds and just change the voltage divider resistors, you may damage npn transistors.

 

For example, jellybean npn transistors like BC849 have Vce of only 30v and the Vbe is maximum 5v and the transistor starts to work from about 0.7v (0.58 min ..0.7v max for 2mA Ic)

 

Let's say you have a strip of leds with minimum 0v and maximum 25v, one led for each 5v. 

If you want the first led to light up between 0v and 5v, you would use a voltage divider of 1:2 giving you 0.7v on the base from around 1.5v, so the led would light up between 1.5v and 5v. But, when the voltage is 20..25v, the voltage divider will still be 1:2, so you'll have a voltage on the base of 20v..25v/2 =  10v..12.5v, which is much more than the maximum 5v, so you'd damage the npn transistor.

 

I suppose you could have some fun with zener diodes and do something similar. could turn on leds on and off with quad channel opamps or all kinds of logic ics, can't even be bothered to search.

 

No, The BE junction will always have 0.7V over it max, it's like the Vf of a diode. The resistors limit the current, just calculate the resistor divider to never allow more base current then the transistor can handle at the maximum voltage. The range in minimum base current for the transistor to start conducting upto maximum current is so huge it won't pose a problem.

Link to comment
Share on other sites

Link to post
Share on other sites

I suppose you could be right, I don't have much experience with transistors.

 

Something's still bugging me though .. have a look at this :  http://goo.gl/3ilW2w  (it's a link to circuit simulator on falstad.com)

 

You can double click the power supply on the left to adjust voltage, hover mouse over potentiometer and double click to change total resistance or use scroll wheel to change the ratio, and you can hover mouse over the npn transistor to see it on the scope at the bottom.

 

With a 5v source and the 10k potentiometer with the wiper on middle, you have less than 1mA on the base but that's enough to start the npn transistor, which having a hFe of 100, it means it lets up to 70 mA through it which is bad.

 

Even if you adjust the potentiometer to simulate an 8k and a 2k resistor, you'll have about 0.65v on the base (probably enough to turn on the transistor) and about 0.2 mA  and the transistor will let 20 mA so the led will light up and work fine.

However, change now the power supply to 25v and things change .. with the same 8k and 2k resistors, you now have 2.6 mA on the base and about 260mA going through the transistor  --- you'll blow up the led if you let so much current go through it.

So you'd still have to add a resistor before the npn transistor collector to limit the maximum current to a reasonable value for the leds.. now we have at least 3 resistors and a npn transistor just to turn on a led.

It would also be very power inefficient .. waste 4mA on the transistor base, waste 0.7v x whatever mA in the transistor,

 

A microcontroller would take less pcb space and you could simply use one or several resistor networks to limit current of each led (7-8 resistors in one package with all the leads on one side connected to one pin which goes to ground). Can't get simpler than that.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

You indeed have to add a series resistor to each led.

The resistor divider values can be magnitudes higher, negating the power loss.

It's a bit overkill to use a microcontroller for this imo. Also, with all this microprocessor playing ppl lose basic analog circuit knowledge (or never learn it). I'd suggest doing it with transistors simply for the knowledge, this is very basic stuff anyone serious about electronics should learn.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×