Saturday 29 July 2017

Choosing a relay to control outlets from Arduino


I'm working on a project that involves an Arduino Uno and some external electronics. I have a 12 V power supply that will connect to an outlet, and I want to be able to control this power using a relay connected to the Arduino (i.e. the Arduino will control the voltage that turns the switch on or off).


Though I understand it theoretically, I have no idea what I'm actually looking for. I was hoping someone here could point me in the right direction. All my searching has brought me to larger components. I was hoping I could find something that would fit on a typical breadboard. Do relays like this exist? Or is there another, easier method of doing what I'm trying to do?


EDIT: I went to RadioShack and tried to pick out things that fit the descriptions you guys described. Here's what I got:


Relay: http://www.radioshack.com/product/index.jsp?productId=2062480


Diode: http://www.radioshack.com/product/index.jsp?productId=2036270


Transistor: http://www.radioshack.com/product/index.jsp?productId=2062610


I also picked up some 1.5k Ohm and 1k Ohm resistors.


Will these work with the circuit diagram below?




Answer



What are those "larger components"? The only larger thing is the relay, and most relays will fit on a breadboard.


enter image description here


This is how you control the relay (the coil is shown next to the diode), it assumes you can connect the 12V's ground to the Arduino's. Resistor, transistor and diode are normal, small components. This relay is just a few cm long, wide and high. It can switch 10A and 230V. If you tell us more about what you want to switch I can give you more directed advice.


edit re your shopping
The relay requires 90mA from your 5V power supply. That will add a couple of hundreds of mW in the Arduino's voltage regulator. At 12V in that would be 630mW, which is a pity. If you have 12V in it would have been better to use that for a 12V relay.


The TIP31 transistor is overkill. It's a power transistor, and they don't have very high \$H_{FE}\$ (the current gain). Next time go for a TO-92 general purpose transistor like the BC547. The BC547B variant has an \$H_{FE}\$ of minimum 200. Go for a high \$H_{FE}\$. This one is still OK at an \$H_{FE}\$ of 100, but I would take a safety factor, and calculate with 40. Then the base current has to be 90mA/40 = 2.25mA. A 1k\$\Omega\$ base resistor will give you 4.3mA, so that's OK.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...