Maker Pro
Maker Pro

Dual controlling of a Relay

Hello,
I am designing a project of home automation where i am using Arduino YUN board for the automation purposes. I want to design a circuit so that my relay can be controlled through two ways.. Like my project will be comprising of Auto/Manual mode. When i go in manual mode the lights can be turned on manually by using switch buttons. But when i go in Auto mode i want my lights to be turned on only if the arduino sends a signal to turn it on. Even if the user manually turns on/off the switch button the light wont turn on/off.. It can only be controlled through Arduino. Personally, i designed a solution to use two relays for controlling one light, but i am not sure and dont want to use two relays and want to know if theres some way i can design it using a single relay.
Feedback will be appreciated.
Thank You
 
Manual is manual...over-rides everything.
Only way I can see to disable manual is feed the manual switch via an arduino pin.
Drive the relay via steering diodes from each pin, auto and manual.
Depends on size of relay but probably need to use transistor to switch the relay also.
 
Bluejets is on the right track, but there is no need to have two pins from the Arduino to control the relay. That can be done by the software.

I.e. You the Arduino reads the manual switch. If in manual mode it puts that value (0 or 1) out to the relay. If in auto mode it simply ignores the manual switch and puts out the value determined by whatever algorithm you are using for automatic mode.

Bob
 
Bluejets is on the right track, but there is no need to have two pins from the Arduino to control the relay. That can be done by the software.

I.e. You the Arduino reads the manual switch. If in manual mode it puts that value (0 or 1) out to the relay. If in auto mode it simply ignores the manual switch and puts out the value determined by whatever algorithm you are using for automatic mode.

Bob
Lets confirm functions.
When set to 'Manual-Mode', the manual keys will turn the relay on... do you want the Arduino to be able to turn them on as well or will this strictly be manual control ONLY?
When set to 'Auto-Mode', the manual keys will no longer work, and the Arduino will have complete control correct?

The layout for this would be an output pin for driving the relay, and an input pin for reading the manual keys. The arduino would be responsible for passing all manual commands to the relay... this also means that if the arduino were to fail, the manual over-ride would not function as it relies on the arduino. Additional hardware would be required to bypass the Arduino in the event you wanted manual controls to completely over-ride the Arduino.
 

KrisBlueNZ

Sadly passed away in 2015
You can implement the manual override in the Arduino, unless you want the override to override the Arduino if it fails. The Arduino only needs one control output for the relay, and one or two inputs for the manual override switch. Then you can implement whatever logic you want for the manual control, so it can be more flexible than a simple OFF/AUTO/ON override switch.

For example, your Arduino code can keep a manual/automatic flag. Whenever the manual override input changes state, set the flag to manual, and in that state, use the manual override input to control the output. Whenever the Arduino decides that an automatic action needs to be performed, or if an external signal (e.g. from a pushbutton), the firmware could release the manual override.

If you really need to override the Arduino, you can use a three-position centre-OFF toggle switch. Connect the outside contacts to VDD and VSS, and feed the Arduino output through a resistor of around 1 kΩ to the centre terminal of the switch. Take the signal that controls the relay from that terminal. When the switch is in the centre position, the Arduino drives the relay driver, but switching the switch to either side forces the control signal high or low.

Edit: Others have made pretty much the same suggestions...
 

hevans1944

Hop - AC8NS
I implemented a functionally similar circuit about fifteen years ago to control a number of electrically controlled vacuum valves. I used DPDT ON-OFF-ON toggle switches. One pole provided switch position information to an Allen-Bradley programmable logic controller. The other pole was hardwired in one position (MANUAL ON) to directly energize the associated valve. In the second, center, position (MANUAL OFF) the valve is de-energized. In the third position (AUTO CONTROL) the valve is energized from a 115 V AC relay output from the A-B controller.

Because I thought it would be "cool" I programmed a small delay whenever the switch was moved from the MANUAL ON or MANUAL OFF positions to the AUTO CONTROL position. The software remembered the last state of the switch, whether this was MANUAL ON or MANUAL OFF, and provided this state as the command state in the AUTO CONTROL position. Thus if a valve was on, it stayed on as the switch moved from MANUAL ON through MANUAL OFF to AUTO CONTROL. If a valve was off, it stayed off as the switch moved from MANUAL OFF to AUTO CONTROL.

The intent was to eventually have the A-B controller operate all the valves in AUTO CONTROL mode, starting with the system at atmospheric pressure then proceeding to rough pumping down to a "pretty good" vacuum and finally transitioning to "high vacuum" mode. The A-B controller had many inputs to monitor vacuum pressure using thermocouple vacuum gauges, ion gauges, and diaphragm-switches, as well as thermocouples to monitor the temperatures of two high-vacuum oil diffusion pumps. Finally, late last year before retiring, I added Hall-effect rotation sensors to detect rotation failure of two mechanical "roughing" pumps (which also serve as foreline pumps for the two diffusion pumps).

Alas, we ran out of time and funds before I could finishing implementing a fully automatic pump-down valve sequence. But thank goodness the three-position switches allow fully manual control of each valve. It really isn't difficult to learn how to pump down a vacuum system, and electrically operated valves sure beat hand-operated valves.
 
Top