Relay contact ON OFF before the cut

Hi ,

sorry for my bad english .
I would want to make a realization with push-buttons who would light(switch on) lamps with relays.
Only has the cut of the supply, I would like that the lights stops but on the return to the food supply the lights are in the state before the cut ( on or off position as before the cut ) .

is it possible to do this ? this is software programmation or special relay ?

Do you want to

Use buttons to turn lights on or off.
If there is a power failure, lights turn off.
When the power returns, the lights return to the state they were in before the power failure.

This is all a simple program. We need to know if the power failure will turn off the Arduino as well. If so, it is necessary to save the state of the lights in EEPROM. When power returns, you read the EEPROM to get the state of the lights.

Start your program by reading the button to toggle the state of the light. Each time you press the button you change the state of the light. Use this to turn the light on or off.

Once you get this working, save the state of the light in EEPROM.

Then when you turn on the power to start the program, read the state from the EEPROM and switch lights as required.


Or, just leave out the Arduino and get a super cap/gold cap. Okay, it might not work for very long power out's but for some hours you are fine :slight_smile: And the schematic can be a lot simpler/cheaper.

relay, DPDT

common to NO, NO to coil.

press momentary switch, coil makes relay change state.

relays contact now pass voltage and feed the relay coil.

you have to interrupt that wire to allow the relay to return to idle.

the un-used contacts on the DPDT are for your lights.

thanks weedpharma .

i think a can use normal relay for do it .
for the memory is it possible to add a power supply like a battery for extend the memory or it is not necessary ?

i'm a total benigner and i try to make this program and i hope you can help me ....
weedpharma , you are from country ? i come from france .

LightState = value stored in EEPROM. //save value of light on or off


If lightState =0
Turn light off
Else turn light on

If button pressed
Toggle value of lightState.
Save new value to EEPROM.

Look here for more information on EEPROM

I am in West Australia.


ok , i make the complet program and i come back if i have some difficulties because what i want is with many options as delay and more .

i think i need 2 entry for the power supply . exemple : turn off the power but the light must be stay 10sec more or a relay with auto power supply ; the ardiuno open the relay for cut the circuit after 10sec , great !

You are adding more to the original question. This just confuses people when they answer.

Please give all the information on what you want help with rather than drip feed.