I'm fairly a newbie to electronics and Arduino. I've been struggling for the last days to adjust the voltage fed onto a piece of LEDs strip. I found out and understood the PWM concept and have been trying several setups.
Using the LED fading example on pin 13, and assuming proper resistor values, NPN pins order: C B E
The one below works just fine. Assuming the battery being a 12v power adapter plugged into the barrel.
The next one doesn't work. Assuming the battery being a 12v power adapter, and the Arduino being fed through the USB port.
Since the first example works, I'd expect I'm reaching saturation with the proper resistor in the transistor base, so the transistor is working as a switch, and so PWM is working.
But I don't understand why the second example isn't working. The led seems constantly lit at a lower bright. I'm wondering whether this is an issue with both currents, the one from collector to emitter, and the one from base to emitter, being out of phase because they come from different sources. Or maybe since there are different grounds, the B->E current is changing voltage and affects the transistor performance in some way? What's going on?
I'm not sure I understand you jcallen. What would this jumper look like?
Also, please note that I've tried the second example but wiring the emitter to Arduino's GND and it didn't work. Is it really okay to do that? What if the power adapter was 100v? Would it still be okay to wire the emitter onto the Arduino GND?
Also, please note that I've tried the second example but wiring the emitter to Arduino's GND and it didn't work.
Then you have not done what your words say you have done. Did you wire the emitter to the Arduino ground and leave the 12V supply ground where it was? You need to.
Is it really okay to do that?
Not only OK but essential.
What if the power adapter was 100v? Would it still be okay to wire the emitter onto the Arduino GND?
Thanks for the comprehensive document, Mike. I really liked it and it made it clearer for me, just as your post did.
I now see I wasn't connecting both grounds together when it didn't work. I merely wired the emitter onto Arduino's GND, but didn't use the external supply GND.
@RP, sorry about that. In fact I'm using the only spare NPN transistor I got around, which I bought long ago to use as a kind of rheostat with a pot. It's BU406 and its pins are BCE. I just thought CBE might be the usual configuration since it would resemble that of its symbol.
It's all good now. Again, thank you all, specially Mike. You've been of great help.
@Mike: I wonder if it wouldn't be too off-topic and much asking, to ask how a diode exactly prevents reverse currents from inductive loads... If you'd had a document for that I'd be most happy.
how a diode exactly prevents reverse currents from inductive loads
A diode lets current flow only in one direction. It is placed across the load so that when the load is normally powered no current flows through the diode because it is the wrong way round. However when load is turned off the magnetic field collapse and produces a voltage in the opposite direction. Now the diode is the right way round to let current flow through it and it "shorts out" the reverse voltage.
Excuse my ignorance: If I had a circuit running on a battery, and I were to run a parallel wire onto its terminals, short-circuiting it. Would no current or virtually no current run across the original circuit anymore?
Excuse my ignorance: If I had a circuit running on a battery, and I were to run a parallel wire onto its terminals, short-circuiting it. Would no current or virtually no current run across the original circuit anymore?
Excuse my ignorance: If I had a circuit running on a battery, and I were to run a parallel wire onto its terminals, short-circuiting it. Would no current or virtually no current run across the original circuit anymore?
I'm trying to follow the diode logic.
Yes but if the batteries were inverse parallel, that is + of one to the - of the other then bang, short circuit.
oxiii: @RP, sorry about that. In fact I'm using the only spare NPN transistor I got around, which I bought long ago to use as a kind of rheostat with a pot. It's BU406 and its pins are BCE. I just thought CBE might be the usual configuration since it would resemble that of its symbol.
It's all good now. Again, thank you all, specially Mike. You've been of great help.
A bit of historical background.
At one time most small signal (TO92 or smaller case) "american" transistors (2N numbers) had the base in the middle and most "Japanese" transistors had the collector in the middle. For something of recent vintage, ECB is most likely for all origins.
It is not a good idea to short things out.
So source don't like that.
A coil that is quickly turned of will want to keep the
current flowing. If it doesn't have a low resistance path,
it will raise the voltage until it finds a path. Possibly your
arduino.
Typically a diode is used back biased across a coil.
when the current is turned of, the current from the coil will
forward bias the diode and the resistance of the coil along with the diode
will dissipate the power in the coil, at a low voltage.
A typical buzzer coil can create a spike of several hundred
volts.
Coils store energy in the magnetic field. When the field collapses
it induces a current in the windings. This will decay but at first,
it can create a large voltage spike.
Dwight