How Electronic Switches Work For Noobs: Relays and Transistors by jpoopdog
relaysandtransistors.jpg
Hello,
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.
Alan Reyes says: May 15, 2013. 12:06 AM
thank you, I was very confused about relays and transistors, but after reading this everything is much more clearer
jethro1 says: Feb 3, 2013. 5:02 PM
Excellant tutorial.
Have you ever published any data to describe how a voltage regulator for an alternator works?
jpoopdog (author) says: Feb 3, 2013. 6:05 PM
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.
chithracj says: Jan 3, 2013. 2:46 AM
thanks for helping me to understand transistor working in a easy way
hollowijohn says: Dec 26, 2012. 4:26 PM
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?

Thanks.
jpoopdog (author) says: Dec 27, 2012. 3:44 AM
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.
danny59 says: Dec 24, 2012. 5:27 AM
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!
rippentorn says: Jul 6, 2012. 2:01 PM
Awesome job! I appreciate your thorough, simple, explanation!
jpoopdog (author) says: Dec 19, 2012. 9:09 PM
And i appreciate your telling me. Thankyou! :)
tyts7 says: Dec 19, 2012. 7:24 PM
Tku vm much clearer now.
jpoopdog (author) says: Nov 20, 2012. 12:42 AM
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.
feka says: Nov 5, 2012. 6:53 AM
The description of relay N/C and N/O workings is wrong.

"If input = on (power going through coil)
COM + N/C
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.
BasinStreetDesign says: May 19, 2012. 7:10 PM
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.
jpoopdog (author) says: Aug 2, 2012. 5:21 PM
i have just changed the swf files, all should be good now!
Soon i also plan on adding a demonstration video of a relay in action, my dad was kind enough to let me have the old relays for the fuel pump from his car after he replaced them, although not working in the car, they work fine off a 9v battery XD

the cases of them came off easily enough, and they might be more insightful than pictures might be.
jpoopdog (author) says: May 20, 2012. 6:41 PM
HAHAHAA, i hadnt realized this. ill change it right away.

When writing the instructable i kept thinking if the states of the relay being as they are when it is ON, not OFF
bwrussell says: Jul 5, 2012. 12:03 PM
"(As a general rule , avoid using more than 100mA from a 555 when powering any kind of coil including a relay)"

Can't you just place a diode between the 555 output and the coil (relay, motor, etc) to block the reverse current produced when an inductive load is shut off?
jpoopdog (author) says: Jul 11, 2012. 6:20 PM
reverse current isnt the problem, its forward current.
if you stall a small motor rated at 100ma for instance, it has the potential to draw a few amps, and similarly, with relay coils, you can get massive current spikes which can damage the 555.

even so, just because a 555 CAN source 200ma, doesnt mean its ok to run it non stop at 200ma, a 555 is a signal chip, and should only be used for just that, signals.

an electronics expert once told me that, you should never run ANYTHING from a 555, and this is a rule many follow. signal chips like the 555 and others also, are meant to drive transistors which then run things.
the exeption of course would be low current leds.
Do0dle says: Jul 3, 2012. 1:13 PM
Thank's so much. I have spent months trying to find out what a transistor does and all the books I read just didn't sum it up as well as you did. I totaly understand about the MOSFETs and why they were attatched to heat sinks.
fatboy07 says: Jul 1, 2012. 4:48 AM
well explained. :) thank you.
xtgirl says: Jun 3, 2012. 3:47 AM
I created an account ESPECIALLY so that I can say THANK YOU for this BRILLIANT instructable.

I am girl and always AVOIDED electronics because I always thought I will NEVER understand ANYTHING - but you have managed to explain it -- hope to find LOADS more from you!!

I can't wait to go and find some TVs and stuff to smash up and scavenge bits off!!

PS - you must make an ACE boyfriend, because you sure know how to communicate in a way that women can understand!
Noender says: Mar 18, 2012. 2:38 PM
Thank you Sir!

Even if I've been lurking around instructables for years, I finally created an account to thank you for posting this truly useful article. I've been trying to understand the proper use of this components for days and its finally clear now, even if I need to get more hands on experience on the transistors.
I can certainly understand the bother of explaining basic concepts, resulting even tedious chore for a knowledgeable individual.. But as the saying goes "Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime."

So then.. Thank you.
Dream Dragon says: Mar 13, 2012. 12:49 PM
There's a lot of informatio0n here, and I'll probably have to read it through several times. Thank you for putting it here all in the one place.

Now maybe you could help clarify a point or two from a practical level. I get that a Transistor can work as a switch, but I'm not clear how I'd specify the particular device for a particular job, is there a code like on resistors or something?

Say I want to use a computer or microprocessor to control something in my house. I live in the UK so Mains Voltage is 240v at 50Hz and most things require a 13A safety fuse. If I can get 3 to 5 volts out of the controlling circuit I'm guessing I'm going to need some kind of MOSFET and a BIG heat-sink. How do I specify the right part either to extract from another device or purchase from somewhere. Isolating the controlling circuitry is outside the remit of your instructable so let's just assume for the sake of argument that I've got a nice fat Opto-Isolator in there to protect things.

I can find a few places that give me part numbers for a similar device to work on AMERICAN power but no real real advice on how to make the conversion to UK. What numbers or codes or whatever should I be looking for?
jpoopdog (author) says: Mar 13, 2012. 7:20 PM

For one you cant use a single MOSFET to drive AC as it contains a diode which will rectify the mains. two on the other hand i know will work, just fine but need to be set up in a special way which i cannot help with

There is no secret code or anything. Do what i do when looking at parts inside stuff, and just look up the code on the part, and find its datasheet.

I am asuming you are searching for a MOSFET pairr though which can handle AC at 240v correct? Just look up on google, 300v mosfet with the current you need it to switch, simple as that.

On all parts just look up the data sheet via the part number (first line of numbers and letters), it will state its maximum voltage and current, generally you want to keep under that. But really there is no way to tell how just by looking at it, not that i know of.

since your switching AC mains, i would recomend you buy a relay driver circuit, which takes as little as 5uA-5mA to switch (typical driver). For mains generally everyone goes with relays, transistors are easily destroyed by static, which is caused by the inductance of your homes electrical wiring.

Looking at costs here, a small relay will cost allot less that the huge MOSFETS you are going to need for this, plus for the MOSFETS your going to need big heatsinks, and probably fans.

Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!