Instruction manuals

Home Automation How to Add Relays to Arduino

Description
Home Automation - How to Add Relays to Arduino
Published
of 8
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  http://www.instructables.com/id/Home-Automation-How-to-Add-Relays-to-Arduino/  Food   Living   Outside   Play   Technology   Workshop Home Automation - How to Add Relays to Arduino by drmpf  on September 13, 2014 Table of Contents Home Automation - How to Add Relays to Arduino .....................................................................................1 Intro: Home Automation - How to Add Relays to Arduino .............................................................................2 How to select Relays – Its all about Power. ..........................................................................................2 Step 1: Relay selection based on what you want to switch on and off. ...................................................................2 Reed Relays ...............................................................................................................2 Power Relays ..............................................................................................................2 Step 2: Relay Module selection based power required to drive the relay ..................................................................3 Direct Driven Reed Relays ....................................................................................................3 Direct Drive Clamping Circuit ................................................................................................3 Step 3: 5V power relay modules powered from the Arduino board's 5V supply .............................................................4 Step 4: Four Channel Relay Shields using a Separate Supply .........................................................................6 Step 5: Separate multi-relay 5V and 12V modules, high triggered and low triggered .........................................................6 Separate multi-relay 5V and 12V modules, high triggered and low triggered ................................................................6 Separate multi-relay 12V modules, high triggered and low triggered ......................................................................6 Step 6: Modifications for Driving a 5V relay module from a 3.3V Arduino board .............................................................7 Step 7: Conclusion .........................................................................................................7 Related Instructables ........................................................................................................8 Advertisements ...............................................................................................................8 Comments ................................................................................................................8  http://www.instructables.com/id/Home-Automation-How-to-Add-Relays-to-Arduino/  Intro: Home Automation - How to Add Relays to Arduino How to select Relays – Its all about Power. When you are selecting a relay to connect to your Arduino you need to considera) the power (voltage and current) of what you want to switch on and off andb) the power (voltage and current) required to drive the relay (i.e. to energise the relay coil)We will look at a number of configurations for connecting relay modules to Arduino boards:-1) Direct driven reed relays2) Single 5V power relays powered from the Arduino board's 5V supply3) Four (4) relay shields using a separate supply. The shield powers the Arduino board.4) Separate multi-relay 5V modules high triggered and low triggered5) Separate multi-relay 12V modules high triggered and low triggered6) Modifications for Driving a 5V relay module from a 3.3V Arduino board Step 1: Relay selection based on what you want to switch on and off. This is relative straight forward so we will consider it first. While there are may different types of relays (see http://en.wikipedia.org/wiki/Relay), for home automation andcontrol there are three main types that would be used.i) Reed relay for switching low voltage and low current devicesii) 110V Power relay for switching 110V mains powered devicesiii) 240V Power relays for switching 240V mains powered devices (can also be used for 110V applications) Reed Relays Reed relays are small low power relays suitable for switching <100V at current <0.5Amps. While designs vary, total switched power is usually less than 10 VA (volts xAmps < 10). Examples of IC form factor reed relays are TRR-1A relays and COTO TECHNOLOGY – 8L01-05-001 Power Relays Most relay modules sold to connect to Arduino are power relays and are rated for either 110V or 240V. The ratings are usually printed on the relay case.Notice that the maximum DC voltage that can handled is much less then the AC rating.This is the type of relay you will need to use of switch mains powered devices. These relays will handle most devices used in homes except the highest powered oneslike room heaters, stoves, motors. Make sure the VA (Volts x Amps) of the device you are switching on/off is less than the relay rating. Any wiring to the mains power should only be done by a qualified electrician. A final point, the power relays commonly use silver alloy contacts and are not suitable for switching very low currents like switching Arduino digital inputs. If you are onlyswitching a few milliamps, for example by putting a relay across a low voltage garage door push-button, you should use a reed relay (or a relay with gold contacts) as thepower relays need a “wetting current” to break through the surface film resistance and will not switch very small currents reliably.“Normally, a switch's wetting current rating is far below its maximum current rating, and well below its normal operating current load in a properly designed system.However, there are applications where a mechanical switch contact may be required to routinely handle currents below normal wetting current limits (for instance, if amechanical selector switch needs to open or close a digital logic or analog electronic circuit where the current value is extremely small). ... Normal silver or copper alloycontacts will not provide reliable operation if used in such low-current service!” (http://www3.eng.cam.ac.uk/DesignOffice/mdp/electric_web/Digital/DIGI_4.html )  http://www.instructables.com/id/Home-Automation-How-to-Add-Relays-to-Arduino/  Step 2: Relay Module selection based power required to drive the relay The Arduino digital outputs can only supply +5V (or +3.3V) and less than 40mA max. (typically <20mA for continuous use). So, except for some reed relays, you cannotdrive the relay coil directly from the digital output since 5V power relays typically require ~100mA to operate the relay coil. This means for most (all) relay modules youneed to provide a separate supply to the module in addition to the Arduino digital output which is used to control the relay switching.We will look at a number of configurations for connecting relay modules to Arduino boards:-a) Direct driven reed relaysb) Single 5V power relays powered from the Arduino board's 5V supplyc) Four (4) relay shields using a separate supply. The shield powers the Arduino board.d) Separate multi-relay 5V modules high triggered and low triggerede) Separate multi-relay 12V modules high triggered and low triggeredf) Modifications for Driving a 5V relay module from a 3.3V Arduino board Direct Driven Reed Relays 5V Reed Relays can be driven directly from the Arduino digital output provided their coil current is less than 20mA. TRR-1A relays and COTO TECHNOLOGY – 8L01-05-001 only require 10mA each so you can easily drive 8 or more of these relays from an Arduino board supplied by a USB 500mA power supply plugged into the USBconnector (The Arduino Uno has 500mA resetable fuse on the USB input).Alternatively if the Arduino board is powered via 12V to its power plug, limit the number of 10mA reed relays to less than 6 as the on board 12V to 5V regulator limits themaximum current that can be drawn from the 5V supply to about 70mA or so.Above is a circuit for a single 5V reed relay being driven directly from D7 Direct Drive Clamping Circuit Two things to note:a) The 1N4004 diode across the coil of the relay andb) the 33 ohm resistor between D7 and the relay coil +The diode is there to clamp the voltage/current spike the relay coil produces when it is switched off. Do a search on “flyback diode” for more details on this. (http://en.wikipedia.org/wiki/Flyback_diode for example)The 33 ohm resistor protects the D7 output from excessive current and allows the diode to do the clamping. When a digital output is turned off it does not go open circuit,rather it connect the output pin to GND via a very low resistance. Without the additional 33 ohm resistance, the current spike from the coil would preferentially go backinto the microprocessor via D7 to GND.The coil resistance is about 500 ohms so when D7 is high (+5V) most of the voltage appears across the coil (I.e ~4.7V ) (search for Ohm's Law or checkout Sparkfun'stutorial) The “pull in” voltage on the datasheet for the TRR-1A 5V reed relay is 3.75V which means any voltage higher that than must close the contacts so 4.7V is morethen enough to ensure the relay operates.All commercial relay modules should already have the clamping diode fitted across the relay coil.  http://www.instructables.com/id/Home-Automation-How-to-Add-Relays-to-Arduino/  Step 3: 5V power relay modules powered from the Arduino board's 5V supply There are a number of different single 5V relay modules available on-line. But most do not have any circuit diagrams available. Here are two examples (the first one fromDX.COM's website).Both operate the relay when the input (IN) is HIGH (+5V). The second board as an optical isolator and separate connectors for the IN ground (COM) and the main 5Vsupply ground (GND). The jumper is connecting these two grounds together so you can use it just like the left hand board.Removing the jumper lets you have isolated supplies, one for the the Arduino and another completely separate one for the relays. Separate supplies provides some extraprotection against mains volts getting back into the microprocessor. But this extra protection is mostly illusory. The pcb tracks on the back of the board are quiet close andnothing will protect you against a lightning strike on the power line outside your house.So for either board, connect the relay GND to one of Arduino's GND pins and the relay 5V or Arduino's 5V pin and the relay IN to one of Arduino digital outputs, say D4.Then when the digital output, D4, is High the relay will operate.The photo above shows this wiring. Note the Arduino is being powered by the 5V USB power. The relay is 5V so everything is at the same voltage.The relay's contacts consist of a Normally Closed (NC) and Normally Open (NO) connection and a COM connection. When the relay is un-powered the NC terminal isconnected to the COM terminal and the NO terminal is not connected. When the relay is operated, the COM terminal switches over and is now connected to the NOterminal and NC terminal is not connected. The screw terminals are either marked NO, NC and COM or small drawing is shown like the image above. It the image above,the top terminal is the NO one the centre terminal is the COM and the bottom terminal is the NC one.Connecting these relay modules to the Arduino's 5V pin means both the trigger current (IN) and the current to drive the relay coil are being supplied by the Arduino board.From the datasheet for the SRD-05VDC-SL-C you can read that the relay coil takes ~72mA to operate. Added to this is the current required by the IN input to trigger thecoil. For the optically isolated relay that is about 4mA and perhaps a bit more for the non-isolated one. (Measure it for your module).In any case each of these relay modules will take <100mA from the Arduino's 5V supply. So if a USB supply is used to power the Arduino,you can attach up to 4 of thesemodules. Indeed that is just what the 4 channel relay shield from Seeed Studio does.In Seeed Studio's 4 channel relay board, the relays are controlled by D4,D5,D6 and D7 so you can just plug this relay shield on top the Bluetooh Shield V2 to get acomplete remote control of up to 4 relays controlled by Android and pfodApp. Use pfodDesigner to design the Android menu and generate all the code you need. This shield is quoted as drawing 250mA, but 300mA would be more realistic based on the datasheet for the relays. In any case it is fine if you are powering the Arduinoboard via a USB supply. However it is not suitable if you are using a 9V or 12V supply due to the limitations of Arduino's on-board regulator.

Essay on Science

Jul 23, 2017

Pil

Jul 23, 2017
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks