How Electronic Switches Work For Noobs: Relays and Transistors

This Instructable is targeted at those just stepping into the world of electronics.

In this guide I will explain how the two main types of electronic switches work, these being relays, and transistors.

Firstly, what is an electronic switch?

An electronic switch is essentially just a switch that uses an electrical current, to turn on, usually turning off when the current is turned off. Some applications of switches can be quite inconvenient for someone to go and press a button to turn on or off, such as for the starter motor in a car, or the "turn off nuclear meltdown" button inside a nuclear reactor, or in an electronics project, a small low power device such as a receiver, must somehow power a large energy guzzling component, like the motor in a garage door opener. And others just want to control their houses with their computer's, which could never possible supply the 240v/120v mains needed to run some appliances.

This guide will include a very noob friendly explanation of the internal workings of relays and transistors. First, we will begin with the simplest one to explain, the relay!
Remove these adsRemove these ads by Signing Up

Step 1: What is a relay

For the beginner, a relay can be a very difficult application to first understand, it was for me, i spent 3-4 days researching for a simple explanation as to how a relay works, and quite recently found myself being asked for an explanation, by a clueless noob who didn't understand.

In simple terms, a relay is a device that uses an electromagnet to mechanically pull two connections together to complete a circuit, in the exact same way your finger mechanically pushes two contacts together in a toggle switch.

A relay is used wherever a small low power device or power supply needs to switch on a much larger one, usually completely isolated from the signals power source, or at a much higher voltage than the signal could provide.

However this is usually not enough to help someone really grasp the idea of how these mysterious boxes work.

Move over to the next step for a better explanation along with an flash animation to show you how it all works.
1-40 of 50Next »
Franscois5 days ago

Thank you so much. Will certainly use some of the tips. Cheers.

ktow9 days ago

Fantastic overview. Thanks for all your work. It was well written and the animations were very helpful!

Good effort on how to explain about transistors. Keep it up!!

This document is nice..

vimalrkv1 month ago


what is the difference between current controlled switch and voltage controlled switch?

how it differs from each other?

jpoopdog (author)  vimalrkv1 month ago

a current controlled switch is controlled by current, a voltage controlled switch requires a set amount albeit tiny amount of current, but the resistance is determined by the voltage. voltage controlled transistors are FETs like MOSFETs

mufazin3 months ago

the gain proportion mentioned here is the transconductance (Gm) ??

jpoopdog (author)  mufazin2 months ago

i dont actually know. Ive only ever known it as "gain", look up a datasheet and it should hold them term if its not the common aplification gain.

Hailstorm996 months ago

Would I be able to use a FET transistor to turn on/off the signal to an ESC signal wire to control a brushless motor, or would it distort the signal? I want to be able to control whether the signal comes from an Arduino or a RC receiver by switching on or off a FET (one FET for each signal source). I would be controlling the "gate" voltage with the Arduino.

jpoopdog (author)  Hailstorm996 months ago

it wouldnt distort the signal, or at least, not enough to do anything if it did, the PWM signal varies in the milliseconds, so you could probably even do it with a relay.
however, a fet isnt really suited to the role, youde just want a regular transistor, Mosfets are sensitive to static and cost more than the same power rated transistor. since your just controlling a pwm signal, which i beleive is around 5v at a few mA, and most any transistor could turn on and off a thousand times between each cycle of the signal, a transistor is much more suitable.

in short, you dont need a mosfet, a high gain transistor will be fine.

mosfets are only really suited for fast repeated switching of extremely high currents. or super accuracy/precision waveforms.

Oh ok. I was talking to my electronics teacher, and he said that Field Effect Transistors would work better. Then again I don't think he understood my question.
jpoopdog (author)  Hailstorm996 months ago

well yes, it would work better, but its totally unnecesary, like in the same way a Ferrari is better than a station wagon, but that fact is irrelavent when you just need to drive down the road to the supermarket

cmusada6 months ago

Hi i would like to ask some help after reading your tutorial about transistors ive understande the use of transistors a bit more. but still not much but i would like to ask some help. can i use a transistor as a switch to control charging/discharging of a battery. what transistor should i use? thanks in advance :)

jpoopdog (author)  cmusada6 months ago
well this gets a bit tricky. no, you wont want a transistor any more than you would use a push button switch, its possible yes but its wasteful, inneficient and difficult.

for batteries like SLA nimh and nicad, all you need is to output 1.8-2.4v in a bistable circuit that turns off when you reach a certain voltage, that function though is done with transistors. for adjusting the voltage youll want a 5v variable voltage regulator, it uses 3 pins, in, adj/gnd and out, and the output voltage is determined by a resistor connected between two of the 3 pins. for lithium based batteries you need a special kind of variable charger specific to that kind of battery, or just a slow charger which takes days at a safe minimum
cmusada jpoopdog6 months ago

i just wanted to make a circuit to measure the capacity of a rechargeable li-ion battery with the use of a arduino. so i cant you use any transistor? how about a relay?

jpoopdog (author)  cmusada6 months ago

Im not sure exactly of the function you want to perform, if you for whatever reason just wanted to do a low voltage cutoff with the transistor then thats fine, for that ide recomend to use a relay though moreover, since its going to be always on, and also, for 3.7v lithium cells, try to find a 5v-12v transistor since they have lesser resistance.

reddynet8 months ago

Great tutorial. Thank you

didgitalpunk9 months ago

what transistor(s) would you recommend for doing the setup you have described above? I'm trying to make a strobe light, but the LED I have is a high power Luxeon LED, wich obviously can't run off my 555 timer.

jpoopdog (author)  didgitalpunk9 months ago

well, this depends on the required current, if its an amp or more, just do a general search for transistors which are classified as "power" transistors. In general power transistors are never used for signal deliveries, but instead, switching heavy loads.
one in particular i know and use is called the sd882 NPN (sb772 is the pnp version), it can handle at least an amp but i think can go as high as 2, with a peak of 3 amps. Its a medium-low power transistor and is very cheap.
On the other hand, keep in mind that you can use several transistors in parallel if individually they arent up to the task, though its not recommended since the failure of one could damage the rest.

Thanks for the quick answer!
kgwolf10 months ago

This was a great tutorial; very informative. I am just getting into the world of building circuits, and this write-up was very clear and easy to follow. With regard to switches, is it correct to say that all they do is enable a secondary power source (switch it on)? So if, for example, I wanted to turn a lamp on and off with signals from a microcontroller, it would still need to be plugged into the wall, but with an open circuit, which the switch would then close? Thanks!

jpoopdog (author)  kgwolf10 months ago
yes, but keep in mind, its not so much the fact its a switch, as it is, its a low energy high speed switch which can offer variable currents between saturation and being completely off, plus it CAN be controlled by a microcontroller, wheras a relay or mechanical switch cannot.
A transistor for example, unlike a relay might be used at a super high frequency with PWM, to dim a lamp which which wont turn off between the ON-OFF-ON phase. SOmething like a incandescent bulb would do this.
But in essence yes, a transistor just enables a secondary power source, though, since the signal is encorperated into the current, its primarily thought of an an amplifier
mrmerino1 year ago
Say I had a circuit that used a manual button to do something. How would I connect a transistor to the existing circuit, without removing the button, so that the transistor can activate the circuit in the same way the button can?
jpoopdog (author)  mrmerino1 year ago
well, the simplest way would be to use an NPN transistor. since it operates best when your working with positive voltages, or rather its easier to understand.

Now, find the directionality of current, find which terminal on the button is connected to positive voltage, and which is negative in comparison. Power needs to flow INTO your collector and OUT of your emitter, so find which button terminal is the IN and which is the OUT. if it leads directly to ground or negative then that terminal is your OUT.
When triggering the transistor make sure you use a lesser voltage than your transistor is driving, and ensure that if you are using a seperate power supply to trigger the transistor as what you are driving with the transistor, it wont work unless you connect your negatives together, because the base input needs to circulate through ground/- and back through your power supply to complete a circuit, you know how it goes.

Does this answer your question?
To reiterate, Collector takes current in and emitter emits current out.
I got the gist of it, and that's certainly a more thorough explanation than I've th gotten from anywhere else. If I understand this right, I want to put the transistor circuit in parallel with the switch. That makes sense. Thank you!
actually depending on . how old yr set up might be. it could be the electronic board in side could be screwed up.
urekaeee1 year ago
thank u really this notes useful for me
Alan Reyes1 year ago
thank you, I was very confused about relays and transistors, but after reading this everything is much more clearer
jethro11 year ago
Excellant tutorial.
Have you ever published any data to describe how a voltage regulator for an alternator works?
jpoopdog (author)  jethro11 year ago
sorry no, but i wouldnt imagine it to be that complex, it would likely be a typical regulator, the output, rectified to DC, and trimmed with a capacitor to reduce the voltage spikes and declines, rounding them off so to speak, so they are friendlier to the regulator.
The voltage regulator would then work by trimming off and dissipating excess voltage, while completely maintaining the current output.
It would either be super heavy duty, and dissipating allot of heat, or just heavy duty, but able to regulate the voltage within significantly less heat dissipation. Truth be told i dont know much about the workings of the alternator and its regulator, so dont quote me on this.
But in simple terms thats about it.
chithracj1 year ago
thanks for helping me to understand transistor working in a easy way
Question: I am a notice...I have a cordless lithium drill a little over a year old, so out of warranty. The battery works as the "tiny LED work light" works fine and the battery check shows full charge. I have checked the motor and it is good. But when i pull the trigger on this little 4V drill the drill will not work and the "work-light" cuts off. When I release the trigger the light comes back on, but with a micro-second of hesitation. What component would/could be the problem? I actually have 4 of these drills and 3 of the 4 don't work with the same identical symtoms...Any idea?

jpoopdog (author)  hollowijohn1 year ago
Sorry i didnt quite get that, you need to type more clearly.
What is the "work" light your speaking about?
does it indicate your battery is functioning or the drill is turned on? If its turning off when it is normally meant to be on, this indicates a short circuit occurring somewhere. meaning no power can go to the light.

if you can open the drill and post a photo of the circuit board i would have a better idea of whats going on. Chances are though that the transistor responsible for driving the motor is damaged. Its quite easy to perform a test also to see exactly whats wrong.
danny591 year ago
I don't know if your a teacher by profession, but you would make an excellent one. You have a way of explaining things that make it very easy to grasp, and your animations are also an excellent tool for learning. Great Job!
rippentorn2 years ago
Awesome job! I appreciate your thorough, simple, explanation!
jpoopdog (author)  rippentorn1 year ago
And i appreciate your telling me. Thankyou! :)
tyts71 year ago
Tku vm much clearer now.
jpoopdog (author)  liamm13202 years ago
the link was unnecesary, although i dont really care, you might want to remove it as it could be interpreted as spam, also, my instructable is awsome, it should have cleared things up 150%! so theres that.
feka2 years ago
The description of relay N/C and N/O workings is wrong.

"If input = on (power going through coil)
Else/otherwise (no power)
COM + N/O"

COM+N/C and COM+N/O should be swapped to tell the story correctly. I am a noob in this, but the swf and your description says this short description is wrong. Correct me if I am mistaken.
The Diagram shows the N/O (normally OPEN) and N/C (normally CLOSED) contact labels swapped. The one which is closed when the power is OFF should be labelled Normally CLOSED and so the other is the Normally OPEN one.
1-40 of 50Next »