Go Down

Topic: Relay Board Connection help (Read 12756 times) previous topic - next topic

Okay if you have successfully connected your sensor shield to your relays and have been able to turn the relay off and on at will , how about adding a real time clock RTC so that you can have your various AC appliances turn off and on based upon the time of day using the RTC.

First of all you can get your RTC here:

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=48

or here:

http://www.sparkfun.com/products/99


And you have instructions on how to set this up here:

http://arduino-info.wikispaces.com/RTC

(Please note the code on this page is missing // after the semi colons  ; so you will have to add // if you cut and paste the code.)


Here is a sample code that will turn on a single relay after 1 minute of elapsed time then turn it off after another minute has lapsed. (You can adjust the time for your situation).



#include<WProgram.h>
#include <Wire.h>
#include <DS1307.h>
int Relay_1 = 2;     // relay_1 will operate through pin #2
int tmin = 0;        // tmin is a variable for storing time in minutes.

void setup()
{
digitalWrite(Relay_1, HIGH);   // relay set as inactive at startup
pinMode(Relay_1, OUTPUT);      // pin  #2 set as output
Serial.begin(9600);

RTC.stop();
RTC.set(DS1307_SEC,1); //set the seconds
RTC.set(DS1307_MIN,0); //set the minutes
RTC.set(DS1307_HR,12); //set the hours
RTC.set(DS1307_DOW,5); //set the day of the week
RTC.set(DS1307_DATE,8); //set the date
RTC.set(DS1307_MTH,9); //set the month
RTC.set(DS1307_YR,11); //set the year
RTC.start();

}

void loop()
{

Serial.print(RTC.get(DS1307_HR,true)); //read and print the hour and also update all the values by pushing in true
Serial.print(":");
Serial.print(RTC.get(DS1307_MIN,false));//read and print minutes without update (false)
tmin = (RTC.get(DS1307_MIN,false));
Serial.print(":");
Serial.print(RTC.get(DS1307_SEC,false));//read and print seconds without update
Serial.print(" "); //some space for a more happy life
Serial.print(RTC.get(DS1307_DATE,false));//read and print date without update
Serial.print("/");
Serial.print(RTC.get(DS1307_MTH,false));//read and print month without update
Serial.print("/");
Serial.print(RTC.get(DS1307_YR,false)); //read and print year without update
Serial.println();
delay(1000);

if (tmin==1){
   digitalWrite(Relay_1, LOW);     // set the Relay ON after the 1st minute has elapsed
}
else {
}
if (tmin==2){
   digitalWrite(Relay_1,HIGH);    // set the Relay OFF after the 2nd minute has elapsed
}
else {
}
}


Enjoy,

s



#16
Sep 21, 2011, 04:20 pm Last Edit: Sep 25, 2011, 02:29 am by tranquills0 Reason: 1
For a very good view of the 4 channel relay and the three terminals marked NO, COM, and NC go here:

http://arduino.cc/forum/index.php/topic,71403.0.html

s

So what type of "relay" do you need for your application? There are 4 types of switching mechanisms to choose from:

1) electromechanical relays -While the mechanical construction of electromechanical relays allows for much flexibility in switching capability, they have one important limitation: speed. When compared to other relays, electromechanical relays are relatively slow devices -- typical models can switch and settle in 5 to 15 ms. This operating speed may be too slow for some applications. (e.g. you would NOT use this for high speed switching projects.) Many EM relays can be made to handle higher voltages.

2) reed relays- Because of the smaller, less massive contacts and the different actuating mechanism, a reed relay can switch about 10 times faster than an electromechanical relay with equivalent ratings. The reed relays's mechanical lifetime is also much higher than an electromechanical relay. The tradeoff, however, is that the smaller contacts on the reed relay make it much more susceptible to damage from arcing when closing a circuit. (good for some high speed switching situations but are limited to lower voltages).

3) solid state relays- SSRs are a faster alternative to electromechanical relays because their switching time is dependent on the time required to power the LED on and off - approximately 1 ms and 0.5 ms respectively. Because there are no mechanical parts, their life expectancy is higher than an electromechanical or reed relay.
SSRs are useful for high-voltage applications because the LED actuation does provide a galvanic isolation barrier between the control circuitry and the MOSFET

4) FET switches- In general, FET switches are the fastest of the switches discussed here. Also, because there are no mechanical parts or LEDs in the packaging, FET switches can be very small. One major drawback of the FET switch, however, is that it lacks a physical isolation barrier and thus may only be used with low-voltage signals.

http://zone.ni.com/devzone/cda/tut/p/id/2774

s


retrolefty

Quote
SSRs are useful for high-voltage applications because the LED actuation does provide a galvanic isolation barrier between the control circuitry and the MOSFET


The vast majority of SSR use thyristor devices to do the switching, not MOSFET, either using a Triac or back to back SCRs.

terryking228

Quote
I am trying to find a source of a similar opto-isolated relay board with 4 relays. Some people don't NEED 8 relays!


OK! Found them...  http://arduino-direct.com/sunshop/index.php?l=product_detail&p=201

A look at a selection of different relay types:  http://goo.gl/8ZEQ8

DISCLAIMER: Mentioned stuff from my own shop...!

@tranquills0 - thanks for your really helpful information on relays here!
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

So you want to safely control and operate 110V and 220v appliances.

No problem generally with resistive loads- baseboard heaters, filament light bulbs, toasters, and stove top elements. 15Amp mechanical relays can handle most of these.

When it comes to inductive loads- devices with coils in them like motors, selenoids, contactor coils to name a few- you will need a heavy duty relay that can handle the intial demand placed upon the system.

A very safe method for handling these inductive loads is to utilize a heavy duty relay that has an energy coil activated by 110V. The relay in the link below is designed to turn on/off up to 60 Amps of current.

http://www.smarthomeusa.com/ShopByManufacturer/ELK-Products/Item/ELK-9200/relatedItems/

The powerswitch tail can be placed in line with the 110V that activates the energy coil of the heavy duty relay. The powerswitch tail can be activated with a current from 3 to 30 ma of current from your arduino uno. This allows current from your 110v wall outlet to activate the energizing coil of the heavy duty relay that can handle most inductive loads.

http://powerswitchtail.com/default.aspx

Cost to you is $75 for the heavy duty relay and $25.00 for the powerswitch tail. Add shipping of course.
You are not likely to get fried following this route and it will meet code if installed by an electrician.

s

#21
Oct 28, 2011, 03:37 am Last Edit: Oct 28, 2011, 03:40 am by tranquills0 Reason: 1
 In controlling heavy load devices  (inductive loads requiring 15 to 30 AMPS or higher-such as motors, deep well pumps, etc) you can actually use two relays..... one to control the other.

 The first relay could be the relays that can be actuated by an energy coil requiring only 3v-5v from your arduino board found here:

 http://arduino-direct.com/sunshop/index.php?l=product_detail&p=181

 The relay in the above link has the following specs: With high-current relay, AC250V 10A ; DC30V 10A   Size: 5 X 4.2 X 1.8 (high) cm

 This can be connected to your arduino uno or whatever.  This relay may be placed in line between a wall outlet and a house relay that is activated by an energy coil requiring 120v.   This first relay is activated by your arduino and is used to close the circuit on your 120v line from the wall to your second relay. The closed circuit activates the coil in your "house" relay.


A picture of such a "house" relay is given here:

 http://www.smarthomeusa.com/ShopByManufacturer/ELK-Products/Item/ELK-9200/relatedItems/

 or here:

 http://www.jmacsupply.com/SearchResults.asp?Search=mr-199


  Of course if you have an electrician friend they will give you the relay you want for next to nothing and then you need only a box.  You probably could get the job done under $20.00.

 
s


Go Up