Go Down

Topic: home automation / relay (Read 809 times)previous topic - next topic

thqxtian

Feb 20, 2017, 02:31 pm
Good Day Everyone we built a school project using arduino uno and 5v 8 channel relay with 220v AC on it . we created a 3 way switch using switch and relay and we're having trouble indicating if the switch is on/off on our mobile application can anyone please help us how to know how we can show in our application that the switch is already open .

mistergreen

#1
Feb 20, 2017, 06:31 pmLast Edit: Feb 20, 2017, 06:32 pm by mistergreen
Hard to help when you don't show your code. Use the code tag!

SureshKumar2610

#2
Feb 21, 2017, 08:23 am
Please explain share your code and what is you facing the problem ?.
Goto youtube and type this    "Free Teaching Embedded Systems"    then click subscribe if you like

ssnover95

#3
Feb 22, 2017, 06:35 pm
Without more information I would guess you're using one of the Sainsmart Relay Modules. Along with whatever data is being passed back and forth you could add the state of the switch. Whenever you update the relay's position update this state variable and add a getter function.

MikeLittle

#4
Feb 26, 2017, 04:36 pm
By 3 way switch, do you mean a setup where there are 2 switches controlling the load? If that is the case, then you will need to look at the load to see if it is on. At 220V, that needs to be done with care.

Get an opto that is rated for the voltage and put it in parallel with the load.

Or, if you are using only one relay to send power to the load, you should know when that is on from your code.

surajmane331

#5
Feb 27, 2017, 11:22 am
how to connect Internet shield with arduino

kukainc

#6
Feb 28, 2017, 01:10 pm
Hello.
How can i run this relays (1+2 and 3+4) at same time?

int relayPin1 = 5;                 // IN1 connected to digital pin 5
int relayPin2 = 6;                 // IN2 connected to digital pin 6
int relayPin3 = 7;                 // IN3 connected to digital pin 7
int relayPin4 = 8;                 // IN4 connected to digital pin 8

void setup()
{
pinMode(relayPin1, OUTPUT);      // sets the digital pin as output
pinMode(relayPin2, OUTPUT);      // sets the digital pin as output
digitalWrite(relayPin1, HIGH);        // Prevents relays from starting up engaged
digitalWrite(relayPin2, HIGH);        // Prevents relays from starting up engaged

}

void loop()
{
digitalWrite(relayPin1, LOW);
delay(2500);
digitalWrite(relayPin1, HIGH);
delay(2500);
digitalWrite(relayPin2, LOW);
delay(2500);
digitalWrite(relayPin2, HIGH);
delay(2500);
}

void setup ()
{
pinMode(relayPin3, OUTPUT);      // sets the digital pin as output
pinMode(relayPin4, OUTPUT);      // sets the digital pin as output
digitalWrite(relayPin3, HIGH);        // Prevents relays from starting up engaged
digitalWrite(relayPin4, HIGH);        // Prevents relays from starting up engaged
}

void loop ()
{
digitalWrite(relayPin3, LOW);
delay(500);
digitalWrite(relayPin3, HIGH);
delay(500);
digitalWrite(relayPin4, LOW);
delay(500);
digitalWrite(relayPin4, HIGH);
delay(500);
}

#7

Jordo

#8
Mar 14, 2017, 04:54 pm
Hello.
How can i run this relays (1+2 and 3+4) at same time?

Code: [Select]
`int relayPin1 = 5;                 // IN1 connected to digital pin 5 int relayPin2 = 6;                 // IN2 connected to digital pin 6 int relayPin3 = 7;                 // IN3 connected to digital pin 7 int relayPin4 = 8;                 // IN4 connected to digital pin 8  void setup() {   pinMode(relayPin1, OUTPUT);      // sets the digital pin as output  pinMode(relayPin2, OUTPUT);      // sets the digital pin as output   digitalWrite(relayPin1, HIGH);        // Prevents relays from starting up engaged   digitalWrite(relayPin2, HIGH);        // Prevents relays from starting up engaged pinMode(relayPin3, OUTPUT);      // sets the digital pin as output  pinMode(relayPin4, OUTPUT);      // sets the digital pin as output   digitalWrite(relayPin3, HIGH);        // Prevents relays from starting up engaged   digitalWrite(relayPin4, HIGH);        // Prevents relays from starting up engaged } void loop() {digitalWrite(relayPin1, LOW);digitalWrite(relayPin2, LOW);          delay(2500);   digitalWrite(relayPin1, HIGH); digitalWrite(relayPin2, HIGH);      delay(2500);   digitalWrite(relayPin3, LOW);       digitalWrite(relayPin4, LOW);          delay(2500);   digitalWrite(relayPin3, HIGH);                    digitalWrite(relayPin4, HIGH);      delay(2500);                 }`

Is this what you mean?

- Jordo
- Jordo

ElCaron

#9
Mar 14, 2017, 04:58 pm
Look at the "Blink without delay example" in the Arduino IDE.

Go Up

Please enter a valid email to subscribe