Delete Delete Delete - Page 1
Forum section: electronics / beginners

author: The_Almighty_Bacon_Lord
author_rank: Contributor
timestamp: June 07, 2017, 10:34:21 pm
content: Delete Delete Delete

author: ataradov
author_rank: Super Contributor
timestamp: June 07, 2017, 10:51:20 pm
content: Quite literally the first link from google on search "controlling transistors with arduino" yields thishttps://itp.nyu.edu/physcomp/labs/motors-and-transistors/using-a-transistor-to-control-high-current-loads-with-an-arduino/, which is exactly what you need.There are also plenty of tutorials on how transistors work, starting from Wikipedia.

author: Matir
author_rank: Contributor
timestamp: June 07, 2017, 11:14:59 pm
content: Transistors have a Collector, a Base, and an Emitter (the 3 pins). In the case of an NPN transistor, when the base voltage exceeds the emitter voltage by ~1 diode drop (0.7V for a silicon diode), current begins to flow through the base-emitter junction. This base-emitter current causes the transistor to allow current to flow from the collector to the emitter. This flow is proportional to the base-emitter current by an amount known as hFE, or the DC current gain. For the C945 you've specified, this is anywhere from 40-700, according to the datasheet (so not a precision instrument, but that's ok as a switch).So, for the transistor you have, putting >1 V (up to 5V, at which time the part will let out the magic smoke) on the base "turns on" the transistor in saturation mode (full on) and will allow anywhere from 40-700 times the base-emitter current through the collector to the emitter. You'll need a current-limiting resistor on the base (because once the transistor is on, the base-emitter junction is basically a short circuit). Something like 1k is common, which allows 5mA through base-emitter on a 5V source, in turn allowing up to 200-3500mA through from your LEDs (though the part is only rated for 150mA, so beware of that).If you look at the lamp example ataradov gave, it should give you an idea of how to hook things up, but make sure you check the pinout of your specific transistor -- there is no standard to the BCE order (or if there is, lots of manufacturers break it). Also, the example doesn't show a resistor on the base -- I'm not sure why, it might work with that specific transistor (I didn't look up a datasheet). Here's a couple of other examples:https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistorshttp://www.technologystudent.com/elec1/transis1.htm

author: CatalinaWOW
author_rank: Super Contributor
timestamp: June 08, 2017, 12:28:43 am
content: Saying the same thing different ways can help. The first two answers are correct, but may or may not connect for you.A transistor is an electrical valve. The valve action controls current flowing between the emitter and collector. For an NPN transistor like yours the collector will be connected to something more positive than the emitter, and current will flow from the collector to the emitter under control of the current flowing from the base to the emitter. Current can only flow in this direction, there is no way to make current flow from the emitter to the collector.Your LEDs can be connected either on the collector side (between the supply and the transistor) or on the emitter side (between the transistor and ground). Each has advantages, but you will probably find it easier to start by connecting your LEDs on the collector side.It takes a look at the data sheet to go much further.http://www.ges.cz/sheets/2/2sc945.pdfThe data sheet has a couple of important numbers - a max current rating of 150 mA and a gain (hfe) that varies from 70 to 700 depending on the grade and particular example. Using the minimum gain number it will take about 2 mA to drive the transistor as hard as it can be driven. To limit base current a series resistor between the Arduino and the base that will limit this is desirable. Assuming a 5V Arduino and 0.7 V of junction drop (standard for a silicon transistor) and using Ohms law gives a resistor value of a little over 2K ohms ((5V-0.7V)/2 mA=2.15K). The value is not critical so a nearby standard value like 1500 or 2200 will be fine.Since the gain can be much higher than 70 a resistor between the supply and the LEDs to limit current to 150 mA is desirable. Since the current will not be continuous you can cheat a little higher than this, but the calculations are obscure and it is safer to just use this limit. The actual limiting resistor will depend on the voltage drop across your LED string, but a similar Ohms law calculation will give you the value. Rlim=(Vsupply-LEDdrop-Vcesat)/150 mA. Vcesat from the datasheet is 0.3 volts.When you have set this all up the Arduino logic output will turn the LED string on and off. You will then vary duty cycle to control brightness.

author: john_c
author_rank: Contributor
timestamp: June 08, 2017, 12:41:15 am
content: Quote from: Matir on June 07, 2017, 11:14:59 pmIt's because in that case they are using a Darlington (TIP120). The beta is so high--1000 or so--that any collector load which can be safely connected (especially with no mention of a heatsink) necessarily implies base currents below the current limit on an Arduino output pin. It's not exactly spelled out, though. In that tutorial, they really want to avoid complication and use a design that makes the BJT interchangeable with a MOSFET.

author: ludzinc
author_rank: Unknown
timestamp: June 08, 2017, 01:09:15 am
content: Quote from: The_Almighty_Bacon_Lord on June 07, 2017, 10:34:21 pmUm, Nope.Read the tutorials linked above, but first recognise that you far from understand any of it.Then practice!Switch a small load with a push button controlling a transistor and go from there. Best of luck!

author: KL27x
author_rank: Super Contributor
timestamp: June 08, 2017, 02:11:02 am
content: QuoteIf you want to use it as a switch, you will typically use the NPN transistor to SINK current. So instead of attaching your LED circuit between power and ground, you connect it between power and the collector of your transistor. And you attach the emitter of the transistor to ground. The collector will be acting as the ground, and it will be switched on/off by the base-emitter current.The arduino pin connects to the base but you should use a resistor to limit current to somewhere between 1/10 and 1/20 of what the load is going to draw when it's on. The exact smallest amount of base current you can get away with depends on the hfe (IIRC) of the transistor. The hfe can be thought of as the sensitivity/amplification factor of the transistor, and typically it is on the order of 100. But if you put too little current through the base, the transistor won't turn on all the way, and it will act like a resistor, itself. This is a useful attribute, but if you are using it as a switch, you generally want to avoid that, so you can use the smallest/cheapest/fastest transistor possible and be able to essentially ignore the transistor resistance when calculating draw of the load. If you don't give it enough base current to saturate the transistor for the load, you will also have to derate the part. You might burn it out. Thus, the seat of the pants rule is to give the base about 1/10th of the current that you are switching, to be on the safe side. OTOH, if you forget to put a resistor between the arduino pin and the base you will probably burn out one of these devices.Notice that the base/switching current and the load current must both flow through the emitter. So the arduino and the load have to share the same ground for the circuit to work. This is one of many things which makes the transistor a little different from, say, a relay. So if your arduino is running off a 5 volt supply, and your LED is running from 12V supply, you have to connect the ground of both of these supplies together. With like a wire. Don't worry, nothing will blow up.(Technically, the two supplies have to be referenced to each other, at a minimum, and it does not necessarily mean a common ground, but don't worry about that for now. For this purpose, you need a common ground.) You might think this is lame, but it is very useful. Transistors are probably MOST commonly used for switching loads that share the same ground AND the same power rail, even. While seemingly useless, it allows conversion of a high impedance (small currenty) input to a low impedance (high currenty) output. And it also a way to invert the logic. If you need the supplies to be isolated, you can use a relay or an optocoupler.The configuration I just described is one of the most common ways to use an NPN transistor, although there are innumerable others. This is so common is has a name. Whenever you see "open collector output" this is pretty much what it is describing. The collector acts as a current sink/ground when it's on. And it is high impedance when it is off.

author: bson
author_rank: Unknown
timestamp: June 08, 2017, 08:55:29 pm
content: Vbe, the voltage between base and emitter, is a well-controlled property of a BJT, and will be close to 0.65 but a more precise value for a specific condition (voltages, current, temperature) can be found either from a datasheet or empirically.The voltage over R1 is Control-0.65, and hence Ie = (Control-0.65)/R1. If Control is a logic level signal that goes between two specific levels, then R1 effectively determines the emitter current. Note that this does not involve the poorly controlled hfe of the BJT, or any property other than Vbe and R1.But what about Ib? The resistance seen at the base is hFE*R1. So if Ie is 5mA, Ib = 5mA/hFE, or on the order of microamp, uA. No base resistor necessary.Ic = Ie + Ib which for any reasonable hFE, say > 100 makes Ic = Ie within a percent. Which for a load like an LED is way beyond the precision needed.Drawbacks: the control signal voltage sets a limit on the load current. In addition, BJTs are commonly limited to 5V between base and emitter, which isn't a problem when controlled by logic levels. But don't experiment by say using a 9V battery and hooking the base up to VCC. If you do this Vbe will spike to 9V before the transistor can turn on and bring it down to 0.65V, and each time this happens it takes a little damage that will add up over time making it eventually fail; if you do need to use base voltages greater than 5V then make sure to slow down the transition speeds on them to not exceed the switching speed of the transistor. These won't originate from logic circuitry so won't be fast, and deglitching e.g. a push button or relay will slow down transitions.For switching larger loads rather than finely controlling small currents, use a logic level MOSFET. An N channel MOSFET with a suitable gate threshold can be dropped in in place of the BJT in the emitter follower above. (It becomes a source follower.) R1 will still control the current, but the source of error will be Rds rather than hFE.So: you want 5mA of current through your LED, and Control is 5V TTL with a 4.85V high level. R1 = (4.85-0.65)/0.005 = 840ohm. The base resistance for the minimum hFE (look this up in the datasheet for your particular transistor) of say 75 is 840*75 = 63k. This makes the base current 4.85/63000 = 0.077mA when Control is high, which of course is a trivial load. Higher hFE will reduce this, making it even more trivial. A little bit of base current is good, too little and you'll be picking up noise instead.Basically, circuit analysis is needed to properly design around a transistor, especially a BJT. MOSFETs are easier in this regard, but have their own pitfalls.

author: Matir
author_rank: Contributor
timestamp: June 08, 2017, 10:43:02 pm
content: Quote from: john_c on June 08, 2017, 12:41:15 amI guess I should've looked up the datasheet. I wasn't familiar with the TIP120 before, so thanks for that information.I would've thought a beginner tutorial would start with a standard BJT, not a Darlington, and that assumption poisoned me.

author: eyiz
author_rank: Regular Contributor
timestamp: June 08, 2017, 11:54:48 pm
content: Every single thing in electronics is a "switch."We could say, there are two basic types of switches.Think of an ordinary light switch on the wall of your room.There are two types.A binary on/off switch. And a dimmer switch.But, a binary on/off switch is just a dimmer switch turned all the way on or all the way off.So, there really is just dimmer switches that make up all of electronics.A resistor is a switch that is like a dimmer switch "stuck" somewhere in the middle of its range.When the resistor is an "unstuck dimmer", it's called a potentiometer, you can manually change the flow of current through it by moving a slider or turning a knob.Many of the switches in electronics don't require you to "manually" change the dimmer action, with your hand. Instead the strength of current or height of potential, or some other parameter, at some other point in the circuit, acts as the "lever" to adjust the switch action.A capacitor is a switch that uses the frequency of the current flowing through it to determine it's dimmer setting. The higher the frequency the more the capacitor "turns on." The lower the frequency, the more it "turns off".An inductor is a switch, that works the opposite way. The higher the frequency the more the inductor "turns off", it "chokes" the current. Lower the frequency, and the inductor "turns on" more, letting the current flow freely.So, what is atransistor?It is essentially a "tranforming resistor".The "lever" is the current or potential acting at it's "base" or "gate" terminal. You connect it's base or gate to some other part of the circuit, and depending on what's going on there, the "resistance" between "Collector and Emitter" (JBT) or "Source and Drain" (MOSFET) changes, allowing more or less current to flow.Thinking in terms of dimmer switches, you can figure out, in general terms, what a simple circuit is supposed to do.

author: MrAl
author_rank: Super Contributor
timestamp: June 09, 2017, 06:48:56 am
content: Quote from: The_Almighty_Bacon_Lord on June 07, 2017, 10:34:21 pmHi,The simplest mode is the switching mode. That is when the transistor turns either on or off."ON" is when the collector emitter has a low resistance."OFF" is when the collector emitter has a high resistance.To turn on, you supply a current to the base emitter.To turn off, you remove that current (stop it from flowing).That's about the simplest way to start to understand how a bipolar transistor works.From there you can move on to biasing and amplification and other configurations.

author: tkarlmann
author_rank: Newbie
timestamp: June 09, 2017, 07:51:47 am
content: First, a Transistor CANNOT change frequency. Second a transistor is a current amplifier. When you supply a current into the base, that current is multiplied by the beta of the transistor as seen through the collector-emitter. Beta is a "gain" value unique to the transistor; it can vary between about 20 to about 200 and is a unitless number. So, you use a transistor by supplying a base current through a resistor, a higher value resistor. For an NPN, you can connect the emitter to ground and the collector to a smaller resistor and that resistor to V+. If the configuration has not saturated the transistor, (Vce > .2volts) then the Collector current should be the Base Current * the Beta of the transistor. That's one configuration. This will work at DC -- no frequency required. You need to find the data sheet for the transistor you are using. You need to determine which lead is which. Then look up the HFE of the transistor -- this is the same as Beta.Another configuration is to connect the collector to V+ and the base to a signal voltage Vin. Now, the current from the emitter should be Beta - Vbase-emitter (usually about 0.6V) times Iin. The DC current from Vin is then amplified or multiplied by the HFE or Beta. Try these out, then experiment from there. If base current is much greater than Beta times the collector current, then the transistor is in saturation, and collector-emitter (0.6v) voltage becomes less than base-emitter voltage (0.2V). Try this yourself. There is lots more to learn about transistors, but these are fundamentals.AC-coupled transistor amplifiers are more difficult to comprehend. Start with the configurations above that all work at DC.

author: KL27x
author_rank: Super Contributor
timestamp: June 09, 2017, 09:09:33 am
content: Wow.... Almight Bacon Lord is genius troll. The answers keep on rolling in, lol.

author: xrunner
author_rank: Super Contributor
timestamp: June 09, 2017, 12:04:45 pm
content: Quote from: KL27x on June 09, 2017, 09:09:33 amMy gosh, I think it's great that people want to help him here, but isn't the answer to how transistors work like the most explained thing on the internets next to how to boil an egg? I think they've done enough.

author: tooki
author_rank: Super Contributor
timestamp: June 09, 2017, 01:53:59 pm
content: Quote from: eyiz on June 08, 2017, 11:54:48 pmWell, kinda sorta not really:https://en.wikipedia.org/wiki/History_of_the_transistor#Origin_of_the_term

author: ebastler
author_rank: Super Contributor
timestamp: June 09, 2017, 03:31:32 pm
content: Quote from: xrunner on June 09, 2017, 12:04:45 pmI don't think Almighty Bacon Lord is a troll; he has engaged in genuine exchange in earlier threads. But I agree that it would be polite for him now to stop by again and provide feedback.I have a feeling that we are simply not providing the information in the right format for him:Quote from: The_Almighty_Bacon_Lord on June 07, 2017, 10:34:21 pm

author: tooki
author_rank: Super Contributor
timestamp: June 10, 2017, 10:40:27 am
content: OK, for the sake of Bacon Lord, I'll make a confession: transistors elude me, too, in a way.I understand them on an abstract level (namely, as current driven devices), but how my mind intuitivelywantsthem to work is actually met by the MOSFET.I think the issue is this (tell me if I'm wrong): transistors are often introduced to beginners asswitches or valves(i.e. something where one input controls another thing, with no intrinsic dependence between the size of the input and the size of the thing being controlled), but in reality, they're not, they'recurrent multipliers(an input controls another thing in proportion to itself).Is it correct to think that basically, as electrons flow from B->E, each electron picks up some friends from the collector and drags them along out to the emitter? (Conceptually, not physically.)In contrast, in a MOSFET, the gate is simply a doorman opening and closing a door through which electrons can flow, but fundamentally, there's no meaningful flow of electrons from gate to source?And then to boot, in a BJT, the PN junction itself is a diode, right, so there's the diode drop that must be overcome before any electrons begin to flow from B->E at all, correct?Hopefully me airing out my confusion helps me and Bacon understand.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: June 10, 2017, 05:11:33 pm
content: Quote from: tooki on June 10, 2017, 10:40:27 amAt one level these descriptions are correct. As you poke further into the details some of them might cause confusion. For example the diode drop doesn't stop current flow. There will be some small current flowing at any positive voltage, with the amount describe by the exponential diode equation.Most FETs have similar non-linear behavior at small and large gate voltages.The gain of most bipolar transistors is high enough that the mixing of input and controlled current is a non-issue. In your terms the input electrons bring along tens or hundreds of friends and get lost in the crowd.

author: tooki
author_rank: Super Contributor
timestamp: June 10, 2017, 07:15:12 pm
content: I get that, but isn't it correct, in essence, that in a BJT, the "control" electrons must flow through the transistor, whereas in a MOSFET, they basically just wait in the gate and hold the door open for the others, but don't go through? (Hence my analogy of anthropomorphized electrons dragging their friends in a conga line, vs a doorman who holds the door but doesn't actually go through it.)This, to me, was a key conceptual difficulty.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: June 11, 2017, 01:52:03 am
content: Quote from: tooki on June 10, 2017, 07:15:12 pmYou are correct. The most interesting thing is the illustration of the very different ways we come to understanding of these things, and the different things that are important to each of our different understandings of how these things work. Good to remember when bringing others into understanding of something.

author: tooki
author_rank: Super Contributor
timestamp: June 11, 2017, 08:51:25 am
content: Exactly. One of the problems I run into (I suppose everyone does) is that when asking for clarification, you often just get the same explanation repeated over and over. So if for whatever reason that explanation doesn't connect with you, hearing it another 20 times still isn't gonna further your understanding.