Go Down

Topic: Arduino relay control - Why the resistor and transistor? (Read 1 time) previous topic - next topic


I am a complete beginner to electronics and microprocessors and am designing a project that uses an Arduino to switch a kitchen appliance on/off and also to control a linear actuator.

I've got a big SSR to switch the appliance and a small one for the actuator which operates on 12 VDC at 50mA.

I've been looking at some schematics for circuits that feature Arduinos controlling things like solenoids and have notices that the circuits always seem to include a resistor and a transistor.

I thought the whole point of using a relay was that it allowed you to switch relatively large currents using small control voltages so I'm surprised that a transistor would be necessary. So why can't you just control the relay directly with the Arduino?

Also, in the attached schematic there is also a resistor - what is its purpose?

Will I need to design separate circuits like this to control both of my relays?



Some relays can be controlled with 5V and <35mA of current so the arduino pin can drive them directly.

Other relays need more current, or a higher voltage, so  a transistor is needed to switch that higher current.

The base of an NPN transistor looks like a diode to ground. The resistor limits the current to keep the arduino pin from being damaged.

(5V - 0.7V)/35mA = 123 ohm, so use something like a standard 150 ohm resistor to turn the transistor on full, and protect the arduino output pin.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.


Thanks Crossroads.

So the Arduino is limited to an output of 5V @ 35mA?


Thanks Crossroads.

So the Arduino is limited to an output of 5V @ 35mA?

Technically, individual pins of the ATMega328 are limited to 40mA @ 5V (HIGH), but you never want to hit this "absolute maximum" amount; so you should limit to something lower than this. 35mA to me seems like cutting it close; I would actually limit things to something even lower in a design (especially if you are using more than one pin; more on this in a moment) - maybe 20-25mA. If you are using more than one pin, though, the ATMega328 (IIRC) is limited to a total output of 200mA @ 5V (thus, if you limited your current draw on all pins to 20mA each, you could "turn on"/"set HIGH" up to 10 of them at one time).
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


Well a lot my Seniors CrossRoads and Crosh have defined  already.
but on following:


So the Arduino is limited to an output of 5V @ 35mA?

I want to say that it's a lot(the current), always the Micro-ontrollers which ever you take up whether they are picaxe(another nice forum backed microcontroller) also the many others like PIC, Parallel Propeller etc all supply current nearby this level only, The thing they are there to process the code made by you and then achieve the final result via. supporting circuitry the same you are doing now giving resistance and diode and a relay to handle high current stuff.
                                                      Not only Microcontroller/Microprocessor's work like this other sort of IC's also call for supporting circuitry to achieve a goal.
"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

????? ???? !

Go Up