Hi!
I made this circuit to control a transistor, but I realized that I don't know how to ground it properly.
Is it okay to do what I did in this schematic?
(Note that the Arduino has its own power supply.)
Hi!
I made this circuit to control a transistor, but I realized that I don't know how to ground it properly.
Is it okay to do what I did in this schematic?
(Note that the Arduino has its own power supply.)
the 'load' would be your led and its resistor, you also need a resistor in between your arduino and the base
A couple of points on your sketch.
An LED is a diode (Light emitting diode) so there is nothing to be gained from putting another in series but there is something to be lost and that's 0.7 ish of a volt.
By putting a resister in series with the gnd of the output pin means you shift the ground level and generally this isn't good in digital systems though some do use it to try and match voltages it is generally better to try and match the + side of the circuit and leave the gnd as gnd. You should (IMHO) always have a resister from the output to a device this will protect your board if the transistor goes short circuit.
So in short I'm agreeing with Osgeld with his suggestion but thought I should explain why.
I'm going to also add some more explanation. The "load" in the Osgeld schematic is a resistor followed by an LED. To determine the size of the resistor, first determine the max current draw of the LED. Using 20 ma as an example and +5 V as +V, Ohm's law states:
R=E/I
where
E=5 - 0.6 = 4.4 V (the 0.6 is the drop across the diode)
I = 0.020 A
R = 4.4/.020 = 220 ohms.
As suggested you need a resistor in the base circuit. Assuming a beta of 20 (which is ridiculously low) we'll want the transistor Ice current to be 0.020 and the Ibe will be 0.020 / 20 or 0.001 or 1 ma.
We'll assume the voltage drop across the BE junction to be about 0.6 volts. So we want to use Ohm's law again thusly:
R = E / I
R = 4.4 / 0.001
R = 4.4K ohm
Since it won't hurt a thing to pass a bit more current than that, I'd go with a 3.3K ohm resistor since that is a standard size. Practically I suspect anything in the 1K to 10K range would work.
Note beta is a measure of the gain of a transistor and the beta of a 2n3904 is more like 100 so these calculations are very conservative.
YMMV
Jim.
You know what we really need in the playground? We need to gather all of these little tidbits of information (ie, calculations of base resistors and why, calcs for LED current resistors and why, etc) - in one spot.
For myself, I have been trying to come up with a list of these items, following things from these forums, and things online (I found this resource, which seems pretty good, actually - but there are others):
http://www.kpsec.freeuk.com/ - "The Electronics Club"
Its been almost 2 decades since I really calculated out these values (back when I went to a local "tech voc school" here in Phoenix); since then when I built things I essentially have done the "guess and pray" method, and if things got hot, changed the values up, if things didn't work, drop 'em down. That's not a good method, and I know this, but I hate doing math. With that said, for the project I am working on I want things to be more solid. This has led to me seeing these calcs everywhere, and I understand ohm's law and such, but it has been a while since I looked at this stuff...
So - refresher course time for me - no problem here, and it is coming back to my old-fart brain. But for others, newbies to electronics, it would be great to have something local to arduino.cc that we can point to (ie, on the playground, or somewhere) and say "see - this is what you need to do".
This resource should encompass things like LEDs and transistors, what and how to use resistors, capacitors, diodes, coils, etc - everything - in the proper way, with the proper math to calculate values and how, and why - plus rules of thumb.
Other things I have found helpful (which may already exist somewhere on the playground, I haven't looked) would be resistor color codes (or a calculator - I love the one on my google phone, beats having to remember the "bad boys ..." mneumonic) as well as a capacitor value conversion chart (plus perhaps an inductor chart); I have found ones online that have been immensely helpful, but it is another area that I need to refresh my old head on. I guess I have been involved in software waaaay too long; oh well.
These things just seem scattered; I have found the site I referenced earlier to be very helpful, although it is UK/euro-centric (in a way, this is nice, because they use a slightly different - actually I think it is SI - method of representing certain values and such for resistors/inductors/capacitors - and it has helped me to get my head around those notations). Rather than referencing that site, though, I would prefer something local to arduino.cc (or at least maybe a local copy of the site with permission of the author?).
Thanks to all of you!
I still have a lot to learn, apparently
it starts getting easier once you play around with the formulas and get a grasp on everything, but aside from maybe grumpy mike we all have a lot to learn still
aside from maybe grumpy mike we all have a lot to learn still
Hey don't cut me out learning is a lot of fun, there is still lots to know.
A young engineer at work asked me how long was it before you knew everything. I told her you never did but you got better at hiding the things you didn't know.
Great idea cr0sh.
As a relative newbie what I'd really like to see is a simple how-to on every bit of kit, showing how to wire it up and how to code to use it.
Generally I can search for the kit on here but quite often the result is far more complicated than I need, I don't understand everything that's going on and it's not quite specific to my hardware.
A section of the site which is listed by hardware would be great.
I understand we couldn't do it for every bit of kit, but we could at least say give generic wiring and say how it might be different for other similar parts.
Just to add a bit and hopefully make it easier.
For jobs like this i.e. LED or some other on/off load don't worry about the gain of the transistor just go for one that will handle the load current that you need.
Gain only really plays havoc when you are amplifying analogue signals and or you need to know the exact relationship between input volts or current and output volts/current in these digital examples of switching on an LED you don't care about distortion, over drive or quiescent points etc etc. All you need to know is put a voltage on the base and the LED will light..hmmm I hope I've made it simpler anyway.