Author Topic: NPN with no base resistor to drive an LED from a GPIO  (Read 4328 times)

0 Members and 1 Guest are viewing this topic.

Offline DrGTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #25 on: January 23, 2021, 09:43:30 pm »
I wonder if an android magnetometer app would work?

From https://www.islproducts.com/design-notes/piezo-buzzers-vs-magnetic-buzzers/ :

Here is a piezo buzzer, note the lack of a magnet. This is what I thought that I was dealing with and others have disagreed.


Here is a magnetic buzzer, note the presence of a magnet.


So, I tested out whether the magnetometer inside my cheap phone could use an app https://play.google.com/store/apps/details?id=com.tuber.magneticsensor.magneticfield&hl=en_US&gl=US which claims "detects the magnetic field around you and measures the magnetic field accurately. " providing a value μT (micro Tesla).

First, a baseline measure:


Next, that little magnetic speaker that was included on the right of that three component picture and we can easily see there is a big-ass magnet there.


..and the buzzer that was included on the left of that three component picture.



..and finally, with all the drama of the big reveal of whether "you are the father"..... the actual buzzer board that started this great investigation.


The only conclusion that I can draw, apart from my future in ghost detection, is that it IS a magnetic buzzer [and the crowd goes wild]  :-DD
« Last Edit: January 23, 2021, 09:46:42 pm by DrG »
- Invest in science - it pays big dividends. -
 
The following users thanked this post: Ian.M

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11501
  • Country: ch
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #26 on: January 26, 2021, 07:45:12 pm »
Yeah, green is marginal, but still okay.

Note the distinction -- "traditional" GaP green has an acceptable voltage drop (about 2.2V), high efficiency (GaInN) green does not!

Amazingly, GaP is so inefficient (or, at least, so much harder to optimize?), that it pays to use a higher voltage material entirely (GaInN is ~3V, normally emitting cyan to ultraviolet depending on exact composition), using either a microstructure or a phosphor to make green out of it (I forget how they do it exactly).  Consequently, the green is a little different, usually more pure or "lime-green"-ish, in comparison to the slightly yellowish green of GaP.  It's close enough you wouldn't notice independently, but side-by-side it's pretty obvious.  Cool, huh?
Yes! (Heck, I still think LEDs are hella cool, even though they’re nothing new to me.)

To me, the difference in color between GaP green (which I describe as lime green) and GaInN green (which I describe as “emerald”) is striking. I can readily tell them apart independently. (But I am very, very good at color perception in general, apparently.)

I’ve never seen a green GaInN with phosphor (as in, I know they exist, I just haven’t seen one with my own eyes in real life), all the ones I’ve gotten have a bare die. So if the bandgap alone isn’t responsible for the color, it’s some other clever modification to the diode itself.

I once bought a cheap pack of “ice blue” (i.e. cyan, no phosphor) LEDs from China, and while it was evident that no meaningful binning had taken place, it was interesting that the range of colors within it ranged from a kinda cerulean blue all the way to turquoise with a distinct green tinge!
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11501
  • Country: ch
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #27 on: January 26, 2021, 07:52:13 pm »
It's not a piezo, but a magnetic buzzer. A piezo is high impedance so can be driven directly from a microcontroller output. That circuit won't drive a piezo very well, because a piezo is capacitive and would require a resistor in parallel, to discharge it.
In that same style of housing (which exists in various sizes), you can get both piezo and electromagnetic buzzers, both passive (i.e. just the transducer, which you must drive yourself) or active (with a complete driver built in, needing only a DC voltage to be applied). All four types are visually indistinguishable from the outside.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #28 on: January 26, 2021, 09:19:23 pm »
It's not a piezo, but a magnetic buzzer. A piezo is high impedance so can be driven directly from a microcontroller output. That circuit won't drive a piezo very well, because a piezo is capacitive and would require a resistor in parallel, to discharge it.
In that same style of housing (which exists in various sizes), you can get both piezo and electromagnetic buzzers, both passive (i.e. just the transducer, which you must drive yourself) or active (with a complete driver built in, needing only a DC voltage to be applied). All four types are visually indistinguishable from the outside.
True, but my judgement was not based on the appearance, but by the circuit. I did say that both types can be found in that package style.
Although it's possible to get piezo transducers in that package, it's more likely to be magnetic, given the circuit. There's no way of telling, just by looking at the front.

Yeah, green is marginal, but still okay.

Note the distinction -- "traditional" GaP green has an acceptable voltage drop (about 2.2V), high efficiency (GaInN) green does not!

Amazingly, GaP is so inefficient (or, at least, so much harder to optimize?), that it pays to use a higher voltage material entirely (GaInN is ~3V, normally emitting cyan to ultraviolet depending on exact composition), using either a microstructure or a phosphor to make green out of it (I forget how they do it exactly).  Consequently, the green is a little different, usually more pure or "lime-green"-ish, in comparison to the slightly yellowish green of GaP.  It's close enough you wouldn't notice independently, but side-by-side it's pretty obvious.  Cool, huh?
Yes! (Heck, I still think LEDs are hella cool, even though they’re nothing new to me.)

To me, the difference in color between GaP green (which I describe as lime green) and GaInN green (which I describe as “emerald”) is striking. I can readily tell them apart independently. (But I am very, very good at color perception in general, apparently.)

I’ve never seen a green GaInN with phosphor (as in, I know they exist, I just haven’t seen one with my own eyes in real life), all the ones I’ve gotten have a bare die. So if the bandgap alone isn’t responsible for the color, it’s some other clever modification to the diode itself.

I once bought a cheap pack of “ice blue” (i.e. cyan, no phosphor) LEDs from China, and while it was evident that no meaningful binning had taken place, it was interesting that the range of colors within it ranged from a kinda cerulean blue all the way to turquoise with a distinct green tinge!
It depends on the drive current. GaInN green LEDs, not the phosphor ones, have a positive frequency vs forward current coefficient, so they tend to look more bluish, at higher drive currents and will go cyan if heavily overdriven.  They do have a slightly lower forward voltage, than blue LEDs, but not by much.

I have seen the phosphor green type. They're often sold for use in grow lamps.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11501
  • Country: ch
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #29 on: January 31, 2021, 07:57:07 pm »
I’ve never seen a green GaInN with phosphor (as in, I know they exist, I just haven’t seen one with my own eyes in real life), all the ones I’ve gotten have a bare die. So if the bandgap alone isn’t responsible for the color, it’s some other clever modification to the diode itself.

I once bought a cheap pack of “ice blue” (i.e. cyan, no phosphor) LEDs from China, and while it was evident that no meaningful binning had taken place, it was interesting that the range of colors within it ranged from a kinda cerulean blue all the way to turquoise with a distinct green tinge!
It depends on the drive current. GaInN green LEDs, not the phosphor ones, have a positive frequency vs forward current coefficient, so they tend to look more bluish, at higher drive currents and will go cyan if heavily overdriven.  They do have a slightly lower forward voltage, than blue LEDs, but not by much.
Yes, I’m aware of that coefficient, but what does that have to do with what I was saying about the variation within one batch of cyan LEDs (as well as the existence of cyan LEDs)? They weren’t “heavily overdriven” green LEDs, they’re cyan at normal couple-of-mA current. As I said above, I’m very good at color perception, so I am not calling green GaInN “cyan”, I’m talking about a color clearly in between blue and green.

I have seen the phosphor green type. They're often sold for use in grow lamps.
That makes NO sense: plants are green because they reflect green light. So green light shone upon plants is wasted, as it’s not used for photosynthesis. Green light is the exact opposite of grow light.
« Last Edit: January 31, 2021, 08:00:35 pm by tooki »
 

Offline wizard69

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: us
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #30 on: January 31, 2021, 09:49:19 pm »


The author was kind enough to provide an explanation and I think I understand. I was reluctant at first because of a perceived rule to operate an NPN switch in saturation mode.

My question is simply; is there a disadvantage to doing it this way? Am I missing something?


If the transistor is functioning as a switch then yes it is better to operate it in saturation mode.   As for what is happening in your schematics it would be best to analyze the circuits to see if saturation is achieved.   Honestly it has been a long time and I would have to get out a handbook to do so right.  In either case you need to make sure your  base current is proper for the transistor being used and of course that your don't source more current from the microcontroller than you should.

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #31 on: January 31, 2021, 10:17:37 pm »
I’ve never seen a green GaInN with phosphor (as in, I know they exist, I just haven’t seen one with my own eyes in real life), all the ones I’ve gotten have a bare die. So if the bandgap alone isn’t responsible for the color, it’s some other clever modification to the diode itself.

I once bought a cheap pack of “ice blue” (i.e. cyan, no phosphor) LEDs from China, and while it was evident that no meaningful binning had taken place, it was interesting that the range of colors within it ranged from a kinda cerulean blue all the way to turquoise with a distinct green tinge!
It depends on the drive current. GaInN green LEDs, not the phosphor ones, have a positive frequency vs forward current coefficient, so they tend to look more bluish, at higher drive currents and will go cyan if heavily overdriven.  They do have a slightly lower forward voltage, than blue LEDs, but not by much.
Yes, I’m aware of that coefficient, but what does that have to do with what I was saying about the variation within one batch of cyan LEDs (as well as the existence of cyan LEDs)? They weren’t “heavily overdriven” green LEDs, they’re cyan at normal couple-of-mA current. As I said above, I’m very good at color perception, so I am not calling green GaInN “cyan”, I’m talking about a color clearly in between blue and green.
I was not disputing what you said, merely adding more information.

Quote
I have seen the phosphor green type. They're often sold for use in grow lamps.
That makes NO sense: plants are green because they reflect green light. So green light shone upon plants is wasted, as it’s not used for photosynthesis. Green light is the exact opposite of grow light.
That's what I used to think, until I noticed some green LEDs designed for use in grown lamps and it turns out that green light does have some benefits to plant growth.
https://gpnmag.com/article/growing-plants-with-green-light/
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11501
  • Country: ch
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #32 on: January 31, 2021, 11:53:00 pm »
Quote
I have seen the phosphor green type. They're often sold for use in grow lamps.
That makes NO sense: plants are green because they reflect green light. So green light shone upon plants is wasted, as it’s not used for photosynthesis. Green light is the exact opposite of grow light.
That's what I used to think, until I noticed some green LEDs designed for use in grown lamps and it turns out that green light does have some benefits to plant growth.
https://gpnmag.com/article/growing-plants-with-green-light/
I have definitely heard of full-spectrum grow lights that include green and IR (and generally, other wavelengths in between the red and blue peaks), and that that is beneficial. But just green?!? I looked, and it seems those are sold as "dark cycle" bulbs so that humans can navigate the greenhouses without "waking up" the plants so to speak.
 

Offline DrGTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #33 on: February 01, 2021, 12:32:58 am »


The author was kind enough to provide an explanation and I think I understand. I was reluctant at first because of a perceived rule to operate an NPN switch in saturation mode.

My question is simply; is there a disadvantage to doing it this way? Am I missing something?


If the transistor is functioning as a switch then yes it is better to operate it in saturation mode.   As for what is happening in your schematics it would be best to analyze the circuits to see if saturation is achieved.   Honestly it has been a long time and I would have to get out a handbook to do so right.  In either case you need to make sure your  base current is proper for the transistor being used and of course that your don't source more current from the microcontroller than you should.

So, when I said "switch", I meant it in a very simple way - turn the LED on/off. If you read the the explanation for the "Q2" circuit, he explicitly says:

...The first thing to note is that the transistor can't saturate in this circuit. Since the base is driven to at most 3.3 V, the emitter is never more than 2.6 V due to the 700 mV B-E drop. That means there is always a minimum of 700 mV accross C-E, which is well above the 200 mV saturation level...

https://electronics.stackexchange.com/questions/60865/how-to-drive-a-20ma-led-from-a-4ma-max-gpio-pin (the point was also noted in this thread).

That is why I was, initially, reluctant to use it (my level of experience is with using a transistor as a switch in saturated mode and why I posted the question. As I mentioned, I feel more comfortable (but not "kick back and a have a beer" comfortable) with the emitter follower configuration now, at least with regard to how I am using it in the project.

- Invest in science - it pays big dividends. -
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #34 on: February 01, 2021, 01:41:03 pm »
I looked, and it seems those are sold as "dark cycle" bulbs so that humans can navigate the greenhouses without "waking up" the plants so to speak.
That's an interesting application, but I would thought a very narrow band light source would be required for that to work well. The LED I was using certainly wouldn't be suitable for keeping the plants dormant. It was a broadband yellowish-green emitter, with the data sheet stating a better PPF for the lime green, than cold white LEDs.
https://docs.rs-online.com/21af/0900766b8152e85f.pdf


The author was kind enough to provide an explanation and I think I understand. I was reluctant at first because of a perceived rule to operate an NPN switch in saturation mode.

My question is simply; is there a disadvantage to doing it this way? Am I missing something?


If the transistor is functioning as a switch then yes it is better to operate it in saturation mode.   As for what is happening in your schematics it would be best to analyze the circuits to see if saturation is achieved.   Honestly it has been a long time and I would have to get out a handbook to do so right.  In either case you need to make sure your  base current is proper for the transistor being used and of course that your don't source more current from the microcontroller than you should.

So, when I said "switch", I meant it in a very simple way - turn the LED on/off. If you read the the explanation for the "Q2" circuit, he explicitly says:

...The first thing to note is that the transistor can't saturate in this circuit. Since the base is driven to at most 3.3 V, the emitter is never more than 2.6 V due to the 700 mV B-E drop. That means there is always a minimum of 700 mV accross C-E, which is well above the 200 mV saturation level...

https://electronics.stackexchange.com/questions/60865/how-to-drive-a-20ma-led-from-a-4ma-max-gpio-pin (the point was also noted in this thread).

That is why I was, initially, reluctant to use it (my level of experience is with using a transistor as a switch in saturated mode and why I posted the question. As I mentioned, I feel more comfortable (but not "kick back and a have a beer" comfortable) with the emitter follower configuration now, at least with regard to how I am using it in the project.
The emitter follower is no better, nor worse, than the common collector configuration. It depends on the application. If it's driving an LED, with a resistor and there's sufficient voltage headroom, it makes little difference, since the extra voltage has to be dissipated as heat, at some point. The advantage of the emitter follower is speed. Add a diode (anode to the LED's anode and cathode to collector) to speed up the turn-off time, by providing a path to discharge the LED's parasitic capacitance into the MCU IO pin.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: NPN with no base resistor to drive an LED from a GPIO
« Reply #35 on: February 11, 2021, 02:12:07 am »
My question is simply; is there a disadvantage to doing it this way? Am I missing something?

There is no disadvantage other than the additional loss of one Vbe or about 0.6 volts.

In the past when TTL (transistor transistor logic) was common the second circuit would have problems because of a poorly defined output high level and poor output high drive.  This could be solved by using a pull-up resistor but this adds another part and increases current draw.  In the past I often got around this by using a PNP transistor to pull the LED down which works just as well then and now but the application might require the LED to be illuminated with a high instead of low level.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf