saw same results with both
what device are you using to control your lights? how is it powered?
what powers the arduino? during setup(), should it determine if the lights should be on or off?
saw same results with both
what device are you using to control your lights? how is it powered?
what powers the arduino? during setup(), should it determine if the lights should be on or off?
I use a solid state relay to power the light, the arduino is powerd from a 12 volt power supply, i need ot to check of it is between 6 and 18 to see if the light should be on or off
I'm assuming you have some kind of backup power for the lights if mains power goes off at night, correct? Please post a wiring diagram of all your components and explain in plain language how it should work.
I dont have a back up, the light needs to be on diring the day, and off at night, the issue i was getting was when the power goes off at night it ussaly goes off for 2 to 3 hours when it comes back on it awitxhes the light on as well, let me try it with the eeprom and see what it does, thanks for the advise man
[quote="Mushroom_man, post:22, topic:1007787, full:true"]i need ot to check of it is between 6 and 18 to see if the light should be on or off
[/quote]
i think that is clear
so presumably, the arduino looses power with the lights
will the solid state relay be on after power is restored if it was on when power was lost?
That depends on weather it is during the day or thr night
If the power cuts is at night after 1800 then it must digital write light off if the power cut is during the day it must digitalwrite light on
i hope you see my point
if the solid state relay is on when power is lost, there needs to be a check when power is restored to put it in the proper state: Off if before 6 and On if after 6, and what if power were lost before1800
Yes, and that point was made in reply #8.
that's a bit more complicated, rather than simply checking once at startup().
And how would you do that i am not sure
consider
void setup() {
Serial.begin(9600);
rtc.begin();
pinMode(exhaust , OUTPUT);
digitalWrite(exhaust, HIGH);
pinMode(resetpin, OUTPUT);
digitalWrite(resetpin, LOW);
pinMode(RelayPin, OUTPUT);
digitalWrite( RelayPin, HIGH);
pinMode(LIGHT, OUTPUT);
if (OnHour <= t.hour && OffHour >= t.hour) {
if (OnMin <= t.min && OffMin >= t.min) {
digitalWrite(LIGHT, HIGH);
Serial.println("LIGHT ON");
}
}
else {
digitalWrite(LIGHT, LOW);
Serial.print("LIGHT OFF");
}
}
Just use a non-latching coil relay. Power arduino from main supply. When power is off the relay will switch off. Set relay state to off in setup so that when arduino boots back up everything is off. Then the arduino can do whatever checks you like to decide if power should go on again
Thank you will gove it a bash and see what it does
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.