Transistors and resistors
#1
Posted 15 April 2012 - 10:59 PM
#2
Posted 16 April 2012 - 03:52 AM
From what I understand, you have several kinds of load (relays, leds, fans, etc), and you'd to drive them by using transistors.
The very first task is to collect the voltage drop, and the current required from any of the various loads.
To check whether a particular load could be driven using the transistor mentioned, you should ensure that the required current is below the max allowed. For example, for the 2N3904 is 200mA.
Another check is about the voltage required by your load. If you have a certain supply (e.g. 12V), the load should also accept that voltage. You can't get lower (nor higher) the voltage using the transistor.
Just to be clear, when you connect a normal led, you do NOT change your supply. Instead, you accept it, and you use a resistor to limit the current.
So, if your supply is +12V, any of the loads must be supplied at +12V, without any problem.
Saturation.
The transistor saturation is a particular point of working, which is non-linear. It's useful just because the transistor acts as a switch: nothing more.
When a transistor is saturated, its VCE is very low (about 0.2V), thus it can be ignored from the load perspective.
How to keep the transistor in the saturation?
Simply applying the following formula:
IB > IC / hFE
That is, the base current must be higher than the collector current divided by the hFE, which is the transistor's current gain.
Since the collector current is a value imposed by the load (seen above), and the hFE is somewhat "unknown" a-priori, the simplest way is to use an over-current into the base.
Example.
Let's say your load requires 100mA when is +12V powered.
The required current is below the max allowed for the 2N3904, so you can use this transistor.
Now, let'see the specs: it has a current gain (hFE) of about 30 when the IC is 100mA. The VCE is about 1V, which is pretty higher than the expected 0.2V, but we could still forget the drop.
At this point, let's calculate the equivalent base current:
IB > IC / hFE = 100mA / 30 = 3.3mA
Now, you *never* should use the bound value, because any of the parameter could easily change, and the transistor can quit the saturation.
It's safer to keep the base current pretty far from the 3.3mA limit: let's take it twice or three times higher. Also depends on the current source.
Suppose to feed that current using a Netduino port, which is able to feed up to 8mA.
The base resistor is, correctly, from the formula you have used:
RB = (VDD - VCE) / IB = (3.3V - 0.95V) / 8mA = 293 Ohms
I guess you could use the closest standard value as 330 Ohms, which is still saturation-safe, but also make a bit less current flowing. Bear in mind that 8mA is about the max allowed by the Netduino, so it's better to avoid jump over that bound.
Hope it helps.
Cheers
- Arron Chapman likes this
#3
Posted 16 April 2012 - 08:43 PM
So a little out with my 2k5! But I guess I was on the right lines with the last formula...
Any way, the estimated current drop of the relays (they are chinese and have absolutely no specs available but looking at very similar relays I guess I can go off this...)
They are opto isolators 25amp rated @ 250v min switching voltage is 3v max is 36v. At a guess the volage drop is around 2.5v and the current drop around 25ma. I have powererd these directly off the netduinos 3.3 through the shift registers with no resistors and haven't damaged anything. So I am going to go with these figures as a fair estimate.
In terms of the LEDs that will be in series with the relays to act as an indicator; that again is no straight science, they are prewire 12v rated but prewired means they already have a reistor. Is there any way I can check what current/voltage is been droped through the prewired LEDs?
Finally there are some 12v 120ma pc fans (2 of to be precice) I could again use the transistors I guess as they are under the 200ma rating of the transistors, but don't mind using something else like some little optos if you suggest them as being better? Although I guess you can safely deal with reverse current on the transistors with a diode right? Any way the pupose of listing the fans is purely to give background on what load the entire power supply will be dealing with.
Based on this how can I go about:
a, Working out the voltage/current drop for the leds and maybe more accurately for the Relays?
b, Once I have the rating for both the LEDs and relays how do I then work out the resistors required?
c, Are there any other considerations in this circuit (I have drawn a rough guess at the schematic see below) perhaps any other protection, and does the circuit have variance based on the number of relays/fans that are drawing current at any one time?
d, How do I distribute the supply 12v 1amp (or 12v 500ma I have both) and in thoeretical terms how does the current flow throughout the circuit (this relates to the above question about current variance) For example do you the transitors (and relays and leds) in series and the resistors change as you go along or do you have them in parallel and have equal reistor values and does the above mentioned variance take any bearing?
e, Finally the Fan circuit I appreciate is slightly different, these will be controlled via PWM either as suggested of the netduinos PWM ports or off the 2 remaining TLC ports. How would I go about this? Are there any examples you can give, and is it possible to use the same transistors with some diodes to catch the reverse current or would you suggest a better approach.
This is ultimately controlling mains voltage so I tend to sway towards 6;catious with things (like my overkill SSR 25amp relays and massive heat sinks).
Thanks again for all the help!
Andy
This was just my first attempt, at the bottom are 3 netduino digital signals (there is my 2k5 resistor there but this would be Mario's correct calculation of 330Ohm.
This shows 3 of the 6 transistors, you can see the netduino control logic signals at the bottom, then the gnd rail and the 12 rail at the top.
The 12v rail is split in parrellel and flows throug resistor A which is unknown, then the relay, then LED (this should be LED then relay on reflection as the LED has an unknown 12v rating) and finally any remaining voltage is removed with unknown resistor B.
#4
Posted 17 April 2012 - 03:52 AM
#5
Posted 17 April 2012 - 03:54 AM
#6
Posted 21 April 2012 - 10:13 AM
#7
Posted 21 April 2012 - 10:15 AM
#8
Posted 21 April 2012 - 10:16 AM
#9
Posted 21 April 2012 - 10:25 AM
#10
Posted 21 April 2012 - 02:53 PM
I have drawn up a fritzing, the resistor values haven't been set, but just to clarify, will the reistor value be the same for each of the transistor circuits i.e. would be relative to 12v 1amp?
Here is my fritzing any comments/ improvements welcome, one question though do you have 12v flowing into the transistor collector then out of the emitter to the leds etc and do you put a resistor between the 12v supply and the transistor or would you have the 12v supply go through a resistor, in to the led and relay then go through a transistor?
Finally for the last component in your circuit chain (i.e. the one next to ground) do you make sure the voltage/current coming out is near to 0v/0a?
Thanks,
Andy
#11
Posted 21 April 2012 - 06:10 PM
#12
Posted 21 April 2012 - 06:24 PM
#13
Posted 21 April 2012 - 06:50 PM
#14
Posted 21 April 2012 - 09:21 PM
Here is how the circuit should be designed ...
I think you got the diode and the LED the wrong way round smarcus3. The larger bit inside the LED is the cathode, and the line on the diode is the cathode.
Also I think it would be better to have the LED (and suitable resistor) on the output side of the transistor (in parallel with the relay coil and its protection diode), rather than on the base.
Paul
#15
Posted 21 April 2012 - 09:32 PM
#16
Posted 22 April 2012 - 03:50 AM
#17
Posted 22 April 2012 - 06:39 AM
#18
Posted 22 April 2012 - 07:08 AM
Yes I just threw the LED in and didn't pay attention to its orientation.
Per the placement, you could do that but I don't think it makes a difference. You need a resistor on the base anyway.
LEDs aside, the placement of the protection diode in your fritzing sketch is dangerous.
If you switch to the schematic view in Fritzing I believe you will see the diode is the other way up to the famous relay diagram you linked to above.
As you currently have it, when(if) the transistor turns on the diode will conduct and little or no current will flow in the relay coil. A very large current will flow through the diode and transistor until one of them breaks down.
It must face the other way (the line needs to be facing the positive supply).
Sorry if it feels like you are being ganged up on - I am not trying to ridicule you, I just want to make sure Andy gets everything in the right place.
Regards - Paul
#19
Posted 22 April 2012 - 05:33 PM
Thanks everyone for all the help, I know this is a rather simple concept but understanding this will help me no end with all my projects.
Taking in to account all of the advice and comments you have given I have had another go and have redrawn the fritzing.
To calculate the actual resistors I have gone off the following (which are actual values)
LEDs: 2v Fwd/ 30ma Fwd
Relays: 2.5v Fwd/ 25ma Fwd
Resistor:
(12v - 2v - 2.5v) / (30ma + 25ma) = 7.5v/0.055a = 150Ohm +/- 10%
Does this look right? And is there any other comments, suggestions or additions you would make?
PS Red wires are mains live, green main earth (neutral is not shown but can be assumed to be split for each IEC.
Brown is positive from the 12v supply and blue is the ground for the 12v supply.
The 12v gnd and netduino ground are tied together.
Thanks again,
Andy
#20
Posted 22 April 2012 - 05:39 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users