HomeНаука и техникаRelated VideosMore From: Justin LaRoche

Transistor Amplification - Arduino Workshop Project Video #2

296 ratings | 90455 views
This is the 2nd video in the Arduino Workshop tutorials series in which I show how to properly use a transistor to amplify a digital output pin. This is a must when you have to drive high current devices from an arduino like high power led's and motors. Any questions or comments are welcome please post them! PARTS Resistors 470 ohm 1/4W 5% Carbon Film Resistor pk/5 Diode Catalog #: 271-1317 http://www.radioshack.com/product/index.jsp?productId=2062342 10K Ohm 1/4-Watt Carbon Film Resistor (5-Pack) Catalog #: 271-1335 http://www.radioshack.com/product/index.jsp?productId=2062347#showFullReviews 1N4001 Micro 1A Diodes Catalog #: 276-1101 http://www.radioshack.com/product/index.jsp?productId=2036268 Transistors RadioShack® NPN Transistors (15-Pack) Catalog #: 276-1617 http://www.radioshack.com/product/index.jsp?productId=2062586 LED's 5mm High-Brightness White LED (2-Pack) Catalog #: 276-017 http://www.radioshack.com/product/index.jsp?productId=3060980 LINKS TO SCHEMATICS AND MORE INFO ON TRANSISTORS! LED SCHEMATIC http://yfrog.com/jmledschematicp INDUCTIVE SCHEMATIC http://yfrog.com/jminductiveschematicp MORE INFORMATION http://www.kpsec.freeuk.com/trancirc.htm
Html code for embedding videos on your blog
Text Comments (56)
조국 (11 months ago)
good!
Luv patel (1 year ago)
codeing???
crackmaster88 (1 year ago)
i don't have yellow wire... can i put purple? i kidding. great vid dude, thanks!
2000jago (1 year ago)
By connecting power to "Raw", how much current is available to the motor? It's obviously not getting current out of the GPIO pin. And how many volts is that motor? 5V? 12V?
xs2ahmed (2 years ago)
Is all the load still not on the UNO because you have no other power source all power is coming from arduino because all power wires come from it ?
Luv patel (1 year ago)
xs2ahmed he is showing alternative ways...
Marin Radjenovic (3 years ago)
I am very new to electronics in general. So I have nodemcu board which outputs 3.3v on pins and I have relay that needs 5v in order to work. Can you pls tell me what kind of setup do I need in order that to work. thanks
Mile Test Lab (3 years ago)
this is not amplification of the signal... you just using PWM... SUCH A SHAME
I am Addicted (3 years ago)
great video.. (:
Michael Scott (3 years ago)
What's say I want to supply something more like 9v to a motor?
Sumanta B (4 years ago)
isn't the pin output 40mA per pin and 100mA for all pins combined?
Tripledonkey (4 years ago)
I would think that motor would be overloading a pn2222 which only rated for 350mW.  So you might want a beefier transistor for a motor.  Fine for relays and some LEDs though.
Tripledonkey (4 years ago)
my bad, I see your circuit diagram has a PN2222A which is good for 625mW apparently.
2012daffyduck (4 years ago)
Excellent video! However do you mind sharing the maths behind the 470 ohm and 10k ohm resistor? Cheers!
etcher1981 (4 years ago)
or try Taydaelectronics too for cheap prices
Yuval Kohavi (5 years ago)
great video! just what i needed. thanks!!
Jonatan Dhon (5 years ago)
I think the PWM method don't work whit an other source power. If you dont want to burn your arduino you need yo place a diode in the base, the resistor in the collector and a jumper in the emitter... that is Common Emitter Voltage Gain, you can see that here pdjinc.com/Transistor%20configuration.JPG
cozzm0AU (5 years ago)
Thanks mate, was having trouble driving a relay, realised it needed at least 50mA to latch (and could draw as much as 70mA ! scrounged the parts box to find a transistor (random part number) and wired it up, works perfect every time.
Austin Hill (5 years ago)
Great video! Thank you for taking the time to make this. I am looking to power and fade (slowly on and off) multiple 1 watt LEDs with my Arduino. Will your process facilitate this? If the answer is "yes" will the LEDs be at full brightness? If you can time to find to answer I appreciate it!
ComputerGuy201 (5 years ago)
My right ear enjoyed this.
David Lee (5 years ago)
you can get parts way cheaper from Digi key or night fire electronics. I f you buy enuf at once to over come $4.60 shiping
ntigravty (6 years ago)
What would you use to block a back spike of energy, when you pulse a coil on and off an arduino board?
Andrew Schembri (6 years ago)
Great tutorial! Thanks a lot! priceless, i actually know many of these thinks but great when i forget how to wire things up
kennyfication88 (6 years ago)
Hey Guys, I need this method to amplify a microphone. The Mic uses about 20µV and needs to be amplified for use with the arduino. Can somebody tell me how to connect everything? Thanks :)
kennyfication88 (6 years ago)
Thanks man, you helped me a lot.
Justin LaRoche (7 years ago)
This motor came from a little robot kit. It had 4 AA batteries powering it so I am assuming the motor is rated for 6v. Most of these little motors can take 3 - 9v without any real problems it just that a higher voltage with increase rpm and heat. That will reduce motor life. As to how much current it draws or any specs I don't really know it was just a little motor I found for use in the video. Hope this helps!
bluemarvel5 (7 years ago)
Do you have the data sheet for the motor because I think it is a 3V motor.
Justin LaRoche (7 years ago)
Yes that is entirely possible you would just have to select a transistor capable of pulling the amount of power your led's will draw. Datasheets for the led's will tell you how much each will draw. Then you would have to get a resistor rated for the correct wattage (one big one) or you could split it up (1 per led, 1 per group of 10 ect...). Big transistors need a good deal of juice to turn them on so you may need a 2nd tiny transistor to pre amplify the arduino signal. Hope this helps!
Justin LaRoche (7 years ago)
I don't remember exactly just look around this is a pretty common model. I don't even use this anymore my new breadboard is 6 of these put together its huge got it for $30 on ebay.
AKSoapy29 (7 years ago)
Where did you get the breadboard?
emihackr97 (7 years ago)
te chip has an output of 40 mA per pin and a total of 920mA max!
jn777 (7 years ago)
@Halo2maniaccc thanks for your answer I took the time to read about it and I got your point, it acts as a switch because it is at the saturate region and can't amplify more. Keep the good work with the videos I like them, regards!
Scott Eldridge (7 years ago)
@jn777 youtube.com/watch?v=ZaBLiciesOU <note at the end where he mentions a transistor can be a powerful amplifier
Justin LaRoche (7 years ago)
What I meant was that in this circuit the signal is amplified from the digital output pin its not just a switch there is amplification involved. With a gain of 100 I can put 1milliamp in and get about 100 out. So this switch is not really just an open/close switch the larger the amount of current from the digital output pin the more current that can flow to the device (amplification).
Justin LaRoche (7 years ago)
The transistor is an amplifier, it takes the small signal from the digital pin and has a gain on it. If you check the packaging it will tell you what the gain is typically its around 100 alot of people call it the amplification factor. When the transistor is energized in this circuit it acts as a switch but seriously google around for other little projects. I did a few of them and learned a tremendous amount about transistors, they are anything but simple switches.
jn777 (7 years ago)
Really Nice video, but the transistor is not really amplifying, the transistor is acting like a switch controlled by the digital pin out.
Justin LaRoche (7 years ago)
It depends on exactly what type of fan your dealing with. There are much more advanced higher end pc fans today that have integrated speed controllers. Those are really easy to set up you just give it power, a pwm signal and your good to go. If you have just a regular old fan with power input then you will need a circuit like in the video to control it. Make sure you use the circuit with the diode as it is an inductive load. The temperature sensor has nothing to do with this that is separate
Justin LaRoche (7 years ago)
You don't use PWM like you would for a servo. You have to use digitalWrite in arduino on the pwm pin. That will create the speed control you want. Also you could hook it up to an analog pin and try analogwrite. I don't have the code for it but if you google for examples of analogwrite/digitalwrite you will find a few examples.
AKSoapy29 (7 years ago)
How did you do the PWM of a motor? Can you PM me the code? Cause I can't get it to work.
Justin LaRoche (7 years ago)
You can use any standard npn transistor the 2n2222 just happens to be easily available at radioshack.
AKSoapy29 (7 years ago)
And do I have to use the 2N2222 or can I use a different one?
Justin LaRoche (7 years ago)
Yes you can hook up an external power source to it as long as the arduino is connected to ground. It doesn't have a set power rating it depends on what transistor you use some can handle small loads while others can handle massive loads. This transistor can work up to 36v. Look up the datasheets for these transistors they will tell you all you need to know.
sinnerrom (7 years ago)
hello instead of the Arduino power source can be used to connect to another power source? and which is the maximum and minimum volts and amps of that? thanks
Tiputipu Tipu (8 years ago)
hi, can you tell me for building a AM transistor radion, if i want to use 2 transistors as darlington...then use amplifier for further amplification... ,,what should be the value of bias resistor(collector. base)in darlington.....i usually use bias resistor 100k for single transistor ...similarly if i use 3 transistors as darlington..what should be the bias resistor..similarly if i use 4..5..6...
Justin LaRoche (8 years ago)
The motor was pulled from a 6v rc car so I would assume its rated for between 5v and 7.5v to be safe. The max load of the circuit isn't based on voltage, instead its watts (voltage x current). There is a max voltage of about 30v for that transistor but it can only push about 600mw so the current would be low. So the circuit doesn't have to run at the running voltage of the arduino which allows a world of possibilities.
Samuel Berryman (8 years ago)
So by using this circuit what is the max load that you can power? I am guessing 5v as that is what the Arduino board runs at?? Also can you remember the voltage of that motor?
Justin LaRoche (8 years ago)
An LED is still a diode so I would assume that it SHOULD work. I would ask someplace like 4hv because I don't really know every difference between the two. My personal suggestion would be to just get the proper diodes from radioshack or online.
herctrap (8 years ago)
@herctrap we can use it but how we can?
herctrap (8 years ago)
can we use a mosfet?
Justin LaRoche (8 years ago)
The transistor I used in the video has the same pin out as the one from Radioshack. Look at the flat and convex side of the transistor in the video. I don't know why Radioshack doesn't have them online but the diagram will be on the back of the package that they come in. It has tech specs about it as well as the basic pin out. Make sure you use the 2n2222 transistor because that "pack" of 15 only has 5 of them, the other 10 are different types. They will work but have different power ratings.
Edicus Hirotaki (8 years ago)
Great video, but what are the pins for the transistor? I looked for the data sheet on the Radio Shack web site and couldn't find it.
Justin LaRoche (8 years ago)
O yea thanks to addzkebabs I just remembered that you can get them at Radioshack if you really need to go local or sometimes at hobby shops. However I would recommend that you DON'T go to Radioshack. It may be convenient but they will charge you like $20 for a breadboard that is slightly larger then the one in the video. If you go to ebay you can get one that is like 6 times larger, w/ free jumper wires and shipping for around $18!
Justin LaRoche (8 years ago)
The white board with all the holes in it is called a breadboard. It is used for rapid prototyping of circuits. You simply put component's on the board and use wires and things to jump power around. This is a MUST HAVE and yes it will work for those LED's. The blue circuit was the programmable part the white board was only for connecting it all together! You can get them at Sparkfun or ebay just search for "breadboard". The ones on ebay are just huge w/ free shipping for a really low price!
Justin LaRoche (8 years ago)
Thanks
Justin LaRoche (8 years ago)
No problem!
Justin LaRoche (8 years ago)
Well if you get four of these and place them in an H bridge configuration you can have bi directional speed control but only for brushed motors. For brushless I believe controlling them in more complicated so I would have to check in with that. As for servos they already have the circuitry inside, all you have to do is connect them to a power supply and send them a pwm signal. Thanks for watching!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.