Saturday, May 7, 2011

How to design a transistor circuit that controls low-power devices (tutorial)

I describe how to design a simple transistor circuit that will allow microcontrollers or other small signal sources to control low-power actuators such as solenoid valves, motors, etc.

44 comments:

  1. Wow, this is a great video! Looking forward to seeing more beginner stuff from you :)

    ReplyDelete
  2. Really great job! Thanks for that :)

    ReplyDelete
  3. Thanks! I've just started reading books on circuits and it helped me so much!

    ReplyDelete
  4. Great Video. Loved the step by step flow... but one question.

    when did half an amp become 56mA?

    ReplyDelete
  5. Awesome video! Thanks for taking the time to make it. I am new to electronics and this was very easy to follow and understand!

    ReplyDelete
  6. My understanding is that all silicon PN junctions have a voltage drop closer to 0.67 volts. Using either 0.6 or 0.7 is a close enough rule of thumb.

    I also understand that transistors are physically asymmetric to give them gain. A symmetric NPN would have an hfe closer to unity and the collector and emitter would be interchangeable.

    ReplyDelete
  7. So THAT'S why that bag of transistors didn't work for me. (now to do the walk of shame back to Fry's to buy some that I won't fry). This was extremely useful! Thanks!!!

    ReplyDelete
  8. This is really great, and right at my level. I am hoping that you can help me with a specific question. I saw a feature on "hack a day" a video of a 4-bit computer built with transistors (http://hackaday.com/2011/01/20/intermediate-concepts-building-discreet-transistor-gates/). My goal is to build this over the next few weeks. But I decided to start simple and built an OR gate using a schematic I found in Forrest Mims "Electronic Formulas, Symbols and Circuits Vol IV" --It has 6V power source, two 2N2222A transistors, the inputs into the bases have 10K ohm resistors, and the line to ground from each of the emitters are connected through a 47K resistor -- and it works well enough. How can I combine an LED with each of the two source signals so I can visually see the ON state. I had an example of connecting an LED to the output, so that was no problem. More generally, if you have some digital circuit, how does one integrate it with a second digital circuit? ( I tried just putting the LEDs in series with the inputs, which glowed with a very faint light when I switched on the signal. Not very satisfying)

    ReplyDelete
  9. Messing around with eletronics as a hobby for some time now, i know how difficult it is to find such good rookie material like yours. I still learn new basics every now and then. Thanks and keep up!

    ReplyDelete
  10. Great stuff! Have to make a breakout board for some surface mount LEDs today and never fully comprehended the design considerations for transistor switches...until now!

    ReplyDelete
  11. Awesome - Love it.

    - "Let's just shoot for a base current of 1mA" How can you be sure the transistor is fully on at that point?

    - I'd love to see some transistors tricks (that I'm sure there are tons of them) - like latching circuits and different handy combinations of transistors!

    Subscribed!

    ReplyDelete
  12. Really good. You pitched this just right. Not too complex but not dumbing down. Well done

    ReplyDelete
  13. awesome video, way better then trial and error in multisim till it works, now I know why I cant switch before the device because the device screws up the current flow to ground, next up should be a video on triacs

    ReplyDelete
  14. wmorse, you need a high-impedance amplifier circuit to allow LEDs to monitor the inputs to your logic gates. Using a darlington transistor might provide enough gain so that it can be used with a very high-value base resistor. Typical darlington transistors have gains of about 10,000, so if the transistor is controlling a small 20mA LED, the base current need only be 2uA. If you used a 1M Ohm resistor between the darlington base and the input line on your homemade logic gate, you can probably monitor the line's state without affecting the gate itself. This is basically how those handheld logic probes work.

    ReplyDelete
  15. George, in the example circuit, a minimum of .56mA was required flowing into the base, so choosing 1mA is more than the minimum requirement. It's OK to choose even higher values if you are worried that the load will draw more current than rated, or if there is some other reason to think the transistor may not go into saturation.

    I'll definitely be making more electronics how-to videos -- stay tuned.

    ReplyDelete
  16. Really GREAT VIDEO!! Thank you very much for this. Hope to see more just like it.

    !Bob!

    ReplyDelete
  17. "Great Video. Loved the step by step flow... but one question.

    when did half an amp become 56mA?"

    The value he used was 0.056 A which is not half an amp (0.5A). To get from Amps to milliamps, times by 1000, hence 0.056 * 1000ma = 56ma

    ReplyDelete
  18. Thanks a lot! This helps me a lot! Hope to see more of this kind of video! Thanks for your hard word!

    ReplyDelete
  19. Awesome video! Love that you actually provide a working example to prove the math and theory. You should definitely make more practical electrical engineering videos. Op amps, comparators, shift registers, adders, mux and demux, 555, PWM, latches / flip flops, gates, inverters... just to name a few. :)

    ReplyDelete
  20. This is a Great tut ! (notice the upper "G"). You just go through theory, answering a lot of basics concepts that newbies can't find find easily on the Internet.
    Thank you.

    ReplyDelete
  21. Why is it so simple when explained with a good little video. Hope I had back in college.
    Thanks, that's a good explanation that cleared some points in my mind :)

    ReplyDelete
  22. Ben,

    Thanks so much for posting this, I learned a few things. Do you have an email address, I might have a project you'd be interested in.

    Thanks again
    Steve

    ReplyDelete
  23. Thanks for the great tutorial, I've learned a lot! I also like the fact that you speak so clearly and slowly.

    Cheers from Hungary!

    ReplyDelete
  24. Hi,

    great Job!

    What is the book in the background?

    Thanks,
    Andy

    ReplyDelete
  25. This comment has been removed by the author.

    ReplyDelete
  26. Ben I've been using PN2222A for a long time on this kind of projects. However, I surely learned at least a couple of new things today thanks to your explanation. Thank you, great video.

    ReplyDelete
  27. Hey Ben

    I updated my blog profile, please email me.
    Thanks!,
    Steve

    ReplyDelete
  28. Hi Ben,

    I am interested in the Air Valve you used. I need to source something like that for an motorcycle project that I have on the go. Can you give me more information on it?

    Thanks,

    Leo

    ReplyDelete
  29. Leo, the air valve is made by Clippard. http://www.clippard.com/ The website is a little difficult, so you may want to request a print catalog. There is a helpful chart at the beginning of the electronic valves section that shows flow rate for all of Clippard's models. The one in my video is a manifold-mount 3-way "mouse valve"

    ReplyDelete
  30. Ben, I enjoyed your video as I am trying to figure out how to make a similar circuit.
    I would like to use 3 solenoids on a 12v dc system using 0-5 volt rheostat. The 1st solenoid needs to turn on around 1.5v, the 2nd at around 3v ( while turning off the 1st one), then the 3rd at 4.5v (while turning off the first 2). Assuming the same solenoid values as yours, how do I do this?

    Thanks
    Rob

    ReplyDelete
  31. Anonymous, your requirements will very likely require more than just one transistor for each solenoid. If I were building the circuit, I would be tempted to use a microcontroller with on-board ADC. These can be had for less than $5, and would allow fine-tuning of the setpoints, turn-off behavior, hysteresis, separate indicator LEDs, etc, etc. The whole circuit would only require one microcontroller, potentiometer, and three output transistors. Take a look at the Atmel ATtiny13 or ATtiny26.

    ReplyDelete
  32. Hi Been I would like to know if u have and more videos like this.Very Educational. -Jerry

    ReplyDelete
  33. A really good video on how to design a basic circuit and the points to take into consideration.. Thanks a lot..

    ReplyDelete
  34. this is a great video ! thanks !. i have a doubt that, what is the use of capacitors in electronic circuit and how can we easily find the value of capacitor we need ?. pls help me , i want to design a power amplifier then how the capacitor value will be calculated ?

    ReplyDelete
  35. sree, your question is go general, I really cannot give you an answer in these comments. Capacitors store electrical charge and are used to perform many functions in electronic circuits. I would suggest a book on introductory electronics and AC circuit theory.

    ReplyDelete
  36. thanks Mr.Ben for your kind replay.this is very helpful for me.

    ReplyDelete
  37. Hi Ben. Very well explained.
    Just a question, I would like to see how You did calculate the capacitor value and needed voltage value? Now it look like 'wet finger work' or a general known value. I guess that when it value is too big that the relay or coil get activated for a short moment when the capacitor get filled.
    Thank you very much.

    ReplyDelete
  38. RvA, it's just an estimated value. I believe it mostly serves to slow down the rise-time of the inductive kick so that the diode has time to start conducting. The voltage rating is more critical than the capacitance value since it must be able to control fast-rising voltages from the inductive load.

    ReplyDelete
  39. Hai Ben,

    Very nice explanation! This thread: http://forum.allaboutcircuits.com/showthread.php?t=9751 got me a bit confused, though. Let me quote the relevant part: "hFE is used to bias a linear amplifier transistor, not a saturated transistor. It has plenty of collector to emitter voltage when it is a linear amplifier. It has a very low collector to emitter voltage when it is saturated.". According to the same author, you would need to use the "force gain" instead of hFE, which never seems to be more than a factor 10 - 25 or so. Now I wonder if I should use 10 (force gain) or 100+ (hFE) in the calculations.

    ReplyDelete
  40. Anonymous, you should check the specific transistor's datasheet. For example, the Fairchild PN2222A shows an hFE of minimum 100 when the collector current is 150mA. This would imply a base current of appx. 1.5mA. When the collector current is 500mA, hFE is only 40, which would imply a base current of appx 12mA.

    hFE depends on a few variables -- notably temperature and collector current, so check the datasheet and looks for hFE graphs for your specific part. I've never heard of "force gain".

    ReplyDelete
  41. Hi Ben, what about a direct projection into eye, using a small projector from outside the eye? It could be done in such a way that the project get corrected to fit the eye geometry....

    Maybe projection is more suitable and plausible...
    I can´t think how to create such a small projection, its a challenge.. what do you think about that?

    ReplyDelete
  42. hey ben plz tell me why diode used in a tip120 darlington transistor circuit

    ReplyDelete
  43. Thanks Ben, very interesting, I just would like if you added there a base-emitter parallel resistor (high value) since transistors must not be used with open base.

    ReplyDelete
    Replies
    1. Anonymous, it's important to have such a resistor for insulated-gate transistors where the gate impedance is very high (eg MOSFETs) and may not be properly driven during microcontroller startup (for example). For bipolar transistors, the base impedance is very low once above the PN forward voltage. Adding a resistor wouldn't really accomplish much.

      Delete