Twilight switch with latching relay operated lights

MisterBill2

Joined Jan 23, 2018
19,588
What makes this project challenging is that the control is an alternate action single input relay. If there were separate controls for on and off the task would be quite a bit simpler.
Is there a single point where monitoring the daylight intensity will be done? So that a single sensor will be satisfactory? And how much complexity is acceptable? It is easy to accomplish with a very small PLC: Two outputs, (Lights feed control and sun sensor power), and three inputs, (lights power on, sunlight detected, and push-button pressed.)
This could be a low-priced unit from Automation Direct, or some other supplier .
The lights power on input is required because there is no absolute control as to if the next pulse switches the light on or off.
 

sghioto

Joined Dec 31, 2017
5,438
I really want something to turn off the light where there is lot of sun but still be able to operate it manually
That sounds like the old adage "having your cake and eating it too"
The sensitivity of the LDR circuit can be set has high as needed so the lights still work on a cloudy or rainy day.
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
8,013
OK, here's my stab at this challenge: The 5V USB provides sufficient current for a 5V relay. D1 is for catching the inductive kickback when the relay goes off. C1 (Value to be determined by experimentation since I don't know your relay coil resistance) draws a current, activating the relay until the cap has sufficient charge, then the relay will drop out. R1 is a 10KΩ resistor to drain the cap for the next event while R1 prevents the relay from being held on for any length of time.

I've drawn a relay with a cam internal to make or break contact for the 220 lighting. The relay is shown in the OFF position. When the cam rotates 90K the lights are energized through the microswitch. (bear in mind I'm making some assumptions about a lot of things). When the lights are turned on the 5V USB charger presents a voltage for the photo sensor. Here again I'm assuming your photo sensor holds the red line OFF until dark, when it will switch on. When it switches on current flows into C1 with sufficient pull in force to activate the relay. The relay clicks in and bumps the internal switch to C & NO until the cap has charged enough and current stops flowing. The relay clicks out and the lights are fully under control of the momentary push button switches. I THINK this will work. As for the relay and cap trick - I learned that here on this website. I've even experimented with a few different relays. Depending on the coil resistance a given cap will respond differently to different coil resistances.

1643220128011.png
 

MisterBill2

Joined Jan 23, 2018
19,588
OK, here is the very simplest that I can think of. The one challenge will be obtaining a solar sensor with contacts that close when the light gets bright, and open when the device power is removed. The concept does not address the problem of leaving the lights on all night. That is a separate circuit.
It would work like this:
The power for the sensor would come from the switched lighting circuit, thus it will only be active when the lights are on. The normally open contacts would be across the push-button connection. So when the lights are on and the outside light is bright enough, the contacts will close, activating the relay to switch to OFF, removing power from the lights and the light sensor.
 

Tonyr1084

Joined Sep 24, 2015
8,013
The only thing I'm wondering about is that since the charger is only on when the lights are on, if the sensor has turned the lights off then the charger shuts off too. As soon as you push the button to turn the lights on the charger will activate because it thinks it doesn't have sufficient light and it will shut the lights right back off. It's possible that holding any of the push button switches for a few seconds will get past the time it takes for the capacitor to charge fully. One would have to experiment to see if and how it will react.
 

Tonyr1084

Joined Sep 24, 2015
8,013
The one challenge will be obtaining a solar sensor with contacts that close when the light gets bright, and open when the device power is removed.
The one I have turns on when the light level is below a threshold. The exact light sensor the TS is using will make the difference. But I think in my configuration it might work. Only thing I'm left wondering is whether the sensor will immediately turn the lights back off. It may be possible to hold a push button switch for a few seconds. It all depends on the relay coil resistance and the size of the capacitor. Then again, turning the lights on might activate the relay so quickly that the system will think I'm still holding the button; which should cause no harm since the switches and relay contacts are all in parallel.
 

sghioto

Joined Dec 31, 2017
5,438
The power for the sensor would come from the switched lighting circuit, thus it will only be active when the lights are on. The normally open contacts would be across the push-button connection. So when the lights are on and the outside light is bright enough, the contacts will close, activating the relay to switch to OFF, removing power from the lights and the light sensor.
Which is exactly the circuit I proposed in post #9.:)
 

MisterBill2

Joined Jan 23, 2018
19,588
Which is exactly the circuit I proposed in post #9.:)
Certainly you did, but that was a much more complex circuit. I was thinking about reversing the contact sense on one of those thermal relays, where normally the thing heats up and the contact opens. Now I need to think about it a bit, because it must not have any contact chatter when the contacts close.
 

Thread Starter

zouloufr

Joined Jan 24, 2022
9
That sounds like the old adage "having your cake and eating it too"
The sensitivity of the LDR circuit can be set has high as needed so the lights still work on a cloudy or rainy day.
To make myself clearer what I would like is a circuit that shuts off lamps when natural light goes from dark to bright.
It shouldn't turn lamps off if natural light is already bright at turn on, natural light would need to get back to dark and then bright for the circuit to turn off lights.
 

Thread Starter

zouloufr

Joined Jan 24, 2022
9
This is not as easy as I thought and I think would require another IC.
I found this DIN WIFI relay that would be a drop in replacement of my latching relay while keeping the ability to use my in place wall swicth buttons.
Then I can use a wifi connected light sensor and do this with some automation rule.
61yYPkcPQRL._AC_SL1500_.jpg
 

MisterBill2

Joined Jan 23, 2018
19,588
OK, now with additional specifications the project becomes more complex. Unfortunately my recent proposal would probably switch the lights off a minute after they were switched on, if the sunlight were already bright.
So now a question as to how much electronic building skill does the TS have available? Certainly a circuit with a few integrated circuits can be created, but not everybody is able to assemble such a circuit into a package suitable for controlling lights in a commercial building.

So once again I will suggest using a small PLC (Programmable Logic Controller), which is already in a package suitable for even industrial control installation,
It is easy to accomplish with a very small PLC: Two outputs, (Lights feed control (The light control relay) and the sun sensor power), and three inputs, (lights power on, sunlight detected, and push-button pressed.)
This could be a low-priced unit from Automation Direct, or some other supplier .
The lights power on input is required because there is no absolute control as to if the next pulse switches the light on or off. In addition, a PLC could provide an automated switch off and switch on with no extra hardware, as well as implementing additional control functions selected by holding the button pressed for several seconds.
Additional items required might be the DC supply for the PLC and some device to convert the lights power voltage to whatever input voltage the PLC will require.
I suggested Automation Direct because that company provides the programing software for the PLC at no additional charge, while some other companies charge a great deal for the software.
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
8,013
With regards posts #23 and 25, the capacitor trick will allow the relay that acts like a push button to energize then de-energize in a very short period of time. I've done some bench testing using a 12V relay and a 24V solenoid. In both cases I used a 4700µF cap and both the relay and the solenoid activated for a period of close to but less than one second. So in the event that the natural light is sufficient to turn the lights off - holding a push button for a second (or two) will bypass the function of the light sensor. The parallel resistor can be changed to a higher resistance to prevent the cap from discharging too fast, thus giving you more time to get to the switch to turn the lights back on without having to deal with the One Second Push rule.
 

sghioto

Joined Dec 31, 2017
5,438
I'm still trying to wrap my head around your logic.
To make myself clearer what I would like is a circuit that shuts off lamps when natural light goes from dark to bright.
OK, so I come into the building at 7AM and turn the lights ON. At 10AM it's really bright outside and the circuit turns the lights OFF. Are we on the same page here?
It shouldn't turn lamps off if natural light is already bright at turn on
At 11AM it's still bright outside but I want to turn the lights on again and they should come ON even if the outside light is brighter then it was at 10AM. This makes no sense to me and is the opposite of the previous statement.
natural light would need to get back to dark and then bright for the circuit to turn off lights.
Say what? So I turned the lights on previously at 11AM, now it's 12PM and the outside light is even brighter. At 4PM it's getting darker but the circuit won't turn OFF the lights again until it gets brighter. When 10AM the next day?
 

MisterBill2

Joined Jan 23, 2018
19,588
I'm still trying to wrap my head around your logic.

OK, so I come into the building at 7AM and turn the lights ON. At 10AM it's really bright outside and the circuit turns the lights OFF. Are we on the same page here?

At 11AM it's still bright outside but I want to turn the lights on again and they should come ON even if the outside light is brighter then it was at 10AM. This makes no sense to me and is the opposite of the previous statement.

Say what? So I turned the lights on previously at 11AM, now it's 12PM and the outside light is even brighter. At 4PM it's getting darker but the circuit won't turn OFF the lights again until it gets brighter. When 10AM the next day?
The system is a mix of manual plus a bit of automation. No way is the intent for full automation, which would only seldom get things exactly right. But when the sunlight gets really bright it is easy to forget that the lights are still on, THAT is the time for the automated switch off. And then clouds appear during work hours and the light drops slowly and folks do not notice. THEN is the time for an automated switch on. Then, a bit after quitting time might be another time for an automatic switch off.
 

sghioto

Joined Dec 31, 2017
5,438
But when the sunlight gets really bright it is easy to forget that the lights are still on, THAT is the time for the automated switch off. And then clouds appear during work hours and the light drops slowly and folks do not notice. THEN is the time for an automated switch on. Then, a bit after quitting time might be another time for an automatic switch off.
I agree, that all makes sense. Certainly auto shut off when it gets really bright outside, I think the TS agrees with that.
Then later if it gets cloudy and the light level drops below the sensor threshold you can manually turn the lights back on and they will auto shutoff again when or if it gets brighter outside.
According to the TS the last person out turns the lights off so no auto switch needed there.
This is what the circuit I suggested will do. Why would you need anything else?
 

MisterBill2

Joined Jan 23, 2018
19,588
I agree, that all makes sense. Certainly auto shut off when it gets really bright outside, I think the TS agrees with that.
Then later if it gets cloudy and the light level drops below the sensor threshold you can manually turn the lights back on and they will auto shutoff again when or if it gets brighter outside.
According to the TS the last person out turns the lights off so no auto switch needed there.
This is what the circuit I suggested will do. Why would you need anything else?
The "anything else " would be for when the last one out forgets to push the button. Or the cleaning crew comes in and can not find the off button and so they leave the lights on.
 

sghioto

Joined Dec 31, 2017
5,438
The "anything else " would be for when the last one out forgets to push the button. Or the cleaning crew comes in and can not find the off button and so they leave the lights on.
According to the TS it's a non issue but that causes other problems. What will determine when it's time to auto shut lights off at night?
 
Top