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!

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.


<p>Is the description of N/C and N/O backwards in his description? : &quot;N/C: Short for normally closed, this terminal is not connected to COM when there is no signal, but when there is a signal, the pin inside the relay is pulled down until it touches N/C, which would connect it to COM&quot;</p><p>I thought N/C should mean that without input(relay off), it's closed in a circuit, i.e. connected to COM. ??, </p>
<p>it's correct, open means incomplete and closed means complete'</p><p> think of a wire and imgaine a closed loop / open loop.</p>
<p>Yes I agree that it is written backwards.. </p>
<p>Exactly my thoughts. In the animated .gif it is also different from the description (the gif is the correct one).</p>
<p>thanks for this...I am new to this electronics ...I would just like to confirm...the programmer (arduino) sends a small 5v signal to the relay which electromagnetically</p><p>opens or closed the points through which a higher voltage (26v) can flow....the 5v voltage runs in a totally independent circuit to the 26v...so the 26v can in no way fry the programmer...</p>
<p>Correct. The relay keeps the circuit that activates its coil (turns it on) is separate from the circuit that the relay is controlling.</p><p>The Arduino voltage goes through the electromagnetic coil of the relay. This causes other, separate connections to be made and allows larger voltages to flow through the controlled (or switched) circuit. The larger voltages will NOT come back to the Arduino circuit. Just be sure you connect the relay properly and don't accidentally connect the larger voltage circuit to the coil/Arduino circuit.</p>
thanks Shannon....I came across about a dozen of these little servo motors in the tool box that I inherited from my dad...really fancy little things running on 26v and with many wires...some of them are geared..one has twelve wires,, dad worked in the military aircraft industry and I suspect these motors come out of a mirage or one of the French helicopters as all the writing is in French...ive got some of them to turn on a 12v battery but im sure they will be powerful on 26v...am looking into powering and controlling them with arduino...as I say im new to electronics but am getting there quickly...have really enjoyed doing some of the arduino LED tutorials...moving on to motors and relays next.
<p>Ah, yeah, electronics are fun. I've been salvaging parts (fun in itself) and building amps and guitar effects for years. No motors, just the audio side of things. However, I'm brand new to Arduino and really starting to enjoy that. I'm a programmer by trade, so that aspect is coming fairly easily. Yeah, I was pretty happy to see that onboard pin 13 LED flash the way I wanted for the first time on my Nano. I'm about to build a pedal board using Arduino to read the button presses and then power a transistor to flip a DPDT relay, which will engage/disengage various effect pedals. Came across this page trying to refresh myself on using transistors as switches instead of amplifiers.<br><br>You may want to look into using a MOSFET to run your motors. I am thinking you will need something that will handle a bit more current than just a general BJT transistor. If the motors will turn in both directions, you might search for &quot;complementary MOSFET motor control&quot;. Its a way of setting up two MOSFETs and then being able to send a HIGH or LOW signal from the Arduino to make the motor turn in either direction. An &quot;H-bridge&quot; is a more controllable version (2 sets allowing full stop, forward and backward from Arduino logic signals on 4 pins). Good luck!</p>
<p>nice chatting with you Shannon....from many thousands of miles away...I too play guitar and fiddle around with fruity loops and a Yamaha keyboard...gets a bit noisy round our place at times...been looking into making a synth ....need some potentiometers which are cheap enough ...its just shipping them around the globe is way too expensive to be feasible...I refuse to pay more for shipping than the cost of the product.....I shall research the mofset thingy...keep well sir.</p>
3 of these motors are connected to a housing containing a very fancy arrangement of very intricate gears,, ,including a planetary gear...fascinating and beautiful piece of equipment...its incomplete but I suspect it is some kind of gyroscope.. very interesting to play with..
<p>Thanks for taking the time to explain the concept. The drawings were very useful for me.</p>
<p>Thanks for sharing! The diagrams really helped.</p>
<p>Thanks for sharing valuable information.</p>
<p>Thanks for sharing this wonderful explanation with diagram</p>
<p>Hello, After reading this I have a question about a setup I want, not sure where to connect the relay. I want the relay to turn on a PMW that will be used by an other device. The &quot;Other PSU&quot; is the one that provides the signal for the relay to turn on. Now I'm not sure I can connect the positive one to COM and other to NO, because you said only to connect negative to COM. The &quot;Other PSU&quot; will be connected to Port 1 and Port 2, that is not the problem. I want to switch the positive wire from the PMW not the negative one. Here is a crude image of the settup:</p>
<p>this was very helpful</p>
<p>Hello, </p><p>I want to use an electronic switch in a project of mine. I have connected an Arduino to a external chip and want to trigger that chip using a transistor or relay. Which should I use, transistor or relay?</p>
<p>Very useful. Many thanks</p>
<p>The animation is great. I suddenly understood. Just be careful though, the negatives of your power supplies need to be tied together, I nearly fried one of mine! Thanks for the instructable. </p>
<p>Finally i can actually different relays and transistiors. Although, what does npn and pnp mean?</p>
<p>This site may help you: </p><p>http://www.learningaboutelectronics.com/Articles/Difference-between-a-NPN-and-a-PNP-transistor</p>
<p>A great wealth of information! Thank you for explaining the difference between the components in an easy to understand way. It's just what I was looking for. I look forward to reading more of your instructables! </p>
<p>Thank you!<br>Finally i catch up with transistor's mechanics! ^_^</p>
<p>Great work.Would like to get more knowledge about relay. A brief history of relays and their applications in the electrical.</p>
<p>Nicely done with excellent examples... I appreciate all the time you put into this...!</p>
<p>Great explanation! Thank you! <br><br>Does that mean that if 2.5mA was applied to the Base only 250mA would be allowed through the Collector creating a total of 252.5mA at the Emitter?<br><br>Also why do people say that transistors amplify? - is it just based on the fact they combine both the Collector and the Base?</p>
<p>Thanks for this tutorial man, this exactly what i was looking for. But I still need to ask you this. Can i use a regular transistor to replace a burnt out mosfet in a pioneer 760w car amplifier? Or would it cause it to get worse? The transistor i want to use is a ML7808A and the mosfet i want to replace is a P55NE06FP.</p><p>If not possible, can you suggest what other kind of transistors I could use to replace it? Just like you i took apart old electronic devices that i had in my garage and wouldn't like to drive an hour to the closest electronic store for such a small component. Thanks in advance.</p>
<p>To answer your question simply: no, you can not replace the MOSFET with the transistor. Now here comes the disclaimer/explanation: the circuit in that amp was designed to drive that MOSFET not a transistor. A transistor uses current at it's base to &quot;control&quot; the flow of current through the collector and emitter pins. </p><p>Think about a transistor as a garden hose with your thumb over the end (pretty sure we've all used that trick to squirt someone). The flow varies with the way you move your thumb, just like a transistor. The MOSFET, however, is like the super-soaker. As soon as you pull the trigger (apply voltage), the gun is shooting water. There is no half way off or half way on, you either are blasting someone with as much water as possible or you're not (and usually running cause you're out of water).</p><p>The most important thing to anything electronic is the datasheet. The datasheet will tell you EVERYTHING about the device you are working with... even the maximum limits... which... well... you can test if you want. Hence the name, Fusekiller. </p><p>Use websites like: datasheetcatalog.com or findchips.com to look up who sells the parts. Even the search engines can lead you to the datasheet. Most of the time they are PDFs. </p><p>Putting P55NE06FP into findships.com came up with a distributor offering it for $8.0880. Now, with the datasheet, you can find a cheaper, comparable MOSFET from Newark.com, digikey.com, mouser.com, etc. by using the specs in the datasheet!</p><p>Hope this helps,</p><p>Fusekiller</p>
<p>I've guessed how relays work since I've opened a few of my car but never understood the transistor switch. Helped me a great deal. Thank you very much.</p>
<p>Thanks very much for this. I understood relays and I thought I understood transistors but could never get them to work on my project board but I didn't know the base current had to be lower than the collector and how you explained that was perfect. Nice one!</p>
<p>Hey Can I use any transistor to Flash LED If yes then how........</p><p>If no then Explain............</p>
Thanks man, that post really helps understand the relay.The one I'm wiring is in a motor control panel and has 8 &quot;pins&quot; though. I'm familiar with NO and NC, COM is a new term to me. I'm not sure how to see what's what with my meter while I'm putting it together inside the panel with no power on. here's a picture that points to it
<p>Great Instructable!</p>
<p>Thank you for taking the time to write this, it's explained very nicely.</p>
Hi. Thanks for the write up, much appreciated and massively useful. I've been told I can use a power MOSFET insted place of a relay on an automotive circuit. The circuit is designed to switch in excess of 14 volts to the headlight bulbs. In the relay circuit, the existing feed to the bulbs is used to trigger the relay and heavier gauge wiring is used to supply the switch side with full power (via a fuse) to the bulbs. <br><br>At maximum, ie. for main beam, having both bulb filaments on (H4 bulb), the combined wattage would be 120 watts. A fully charged auto battery with a charging system in good order, supplies in the region of 14.4 volts. Therefore the current requirement for the relay is 8.33 amps.<br><br>Most auto relays are easily capable of this and are very resilient devices. For my circuit, would a power transistor suffice or do I need a MOSFET as I've been advised??<br><br>Many thanks :-)
<p>great introduction for someone who know nothing about the concept. thank you</p>
<p>Thank you very much for this!</p>
<p>Thank you so much. Will certainly use some of the tips. Cheers.</p>
<p>Fantastic overview. Thanks for all your work. It was well written and the animations were very helpful!</p>
<p>Good effort on how to explain about transistors. Keep it up!!</p>
<p>This document is nice.. </p>
<p>hi,</p><p>what is the difference between current controlled switch and voltage controlled switch?</p><p>how it differs from each other?</p>
<p>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</p>
<p>the gain proportion mentioned here is the transconductance (Gm) ??</p>
<p>i dont actually know. Ive only ever known it as &quot;gain&quot;, look up a datasheet and it should hold them term if its not the common aplification gain.</p>
<p>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 &quot;gate&quot; voltage with the Arduino.</p>

About This Instructable




Bio: I enjoy building things which i need or want, like coilwinders, coilguns, laser burners ect. I am into a bit of everything, electronics, programming, animating ... More »
More by oldmanbeefjerky:how to make your own blank clear acrylic paint medium cheap How to assemble a 1W TO-5 9mm Laser burner Module Lip Syncing in flash 
Add instructable to: