Controlling existing relays



  • Hi,

    First of, I'm really new to both home automation and arduino, but really excited about the possibilities. So please be gentle! :) So far I've ordered a bunch of arduino boards, sensors and misc stuff based on a few of the helpful examples listed here to get me started. I really think MySensors.org is a great way to get into home automation if you like to build stuff like I do!

    My technical knowledge however is more on the programming side so I'll start of with a hardware question and see how far my (unfortunately somewhat rusty) programming skills take me after that. :)

    In my house built in the early 90's I've got these kind of momentary/pulse (I think) buttons in every room controlling most of the lighting in the house:
    https://www.dropbox.com/s/lfbg7c3pqilnhek/WP_20150420_19_40_43_Pro.jpg?dl=0

    When I press one of the buttons in any room a corresponding relay in my main electrical cabinet switches on or off, thus turning the light in the room on or off. The relays look like this:
    https://www.dropbox.com/s/sux7bujrr4ae1qd/WP_20150420_08_03_25_Pro.jpg?dl=0

    My question is; what hardware would I need in addition to an Arduino Nano to control each of these relays, and how should I wire it to the existing relays? Or would I need to replace the relays completely?

    To add another layer of complexity, would it be possible to add a dimmer to some of the relays in order to be able to dim the lights in certain rooms?

    Thanks in advance the help!


  • Hero Member

    @twosh, your relays are 24V driven, so Arduino can't control them directly. You need a separated 5V/3.3V power to feed the Arduino/radio, and a circuit between Arduino output and relay.

    Maybe you can start from here http://www.electroschematics.com/8975/arduino-control-relay/

    Make sure you connect the GND from Arduino power supply also to the GND of your existing relay panel.

    To re-wire the relay panel (mains AC) with Arduino boards in, if you are not 100% sure about what do do, don't to it. The risk of electrical shock / spark / fire is real.

    And also make sure to check the http://www.mysensors.org/build/relay .

    Good luck!


  • Hero Member

    @twosh To add to the previous post, your current relays are 24V AC driven, so the typical examples that you see on the net about hooking up a relay to the Arduino won't work in your case. It might be easiest to add a relay, which switches the 24 VAC, between the Arduino and your existing relay. You also indicated that the existing switches are momentary, so there is likely a control panel that takes the momentary signal and then latches the relay on and off. Are you planning to remove the control panel and reuse the switches and relays with Arduino's as your control panel? The other thing to consider are the lights on your existing switches. I'm guessing that they are also 24 VAC, so you would need to find a way to control them as well, or potentially replace them with LEDs and power them with DC.

    Re. your question on dimmers, it is possible to add a dimming circuit which would connect between the existing relay and the actual light, or to replace the relay with a dimming circuit. If you make the Arduino's your control panel, then you could program the existing buttons to dim and brighten the lights, if you hold them down. Google "ac dimmer circuit arduino" and you'll find lots of examples.

    Cheers
    Al



  • Thanks for your input @rvendrame & @Sparkman !

    So basically I should connect my Arduino with e.g. this one http://www.ebay.com/itm/5V-12V-24V-10A-1-Channel-Relay-Module-Optocoupler-H-L-Level-Triger-for-Arduino-/181479686454 so that the Arduino triggers this relay, which in turn triggers my current relay, right?

    Well, the buttons being momentary is just my guess pretty much just based on that they "spring" back and lights up, as well as if we have a power shortage, pressing a button doesn't change anything - the light is still on if it was on before the outage. But then again, as I said, hardware isn't my forte so I could be completely wrong.

    In any case, you're probably right about the control panel, @Sparkman, since I guess that it is the thin wire going into the relay that sends the on/off impulse and since it's only one wire I guess there need to be some master box somewhere where all the rooms' wires are connected.

    Reg. dimmer had had thought about adding a z-wave dimming circuit after the relay, but just thought about not getting any power to stay connected if the relay was off. When the light would turn on, it would probably require some time before it would connect to my VeraEdge again and thus enable dimming. But using and Arduino to power the circuit it would always be connected to my controller, thus enabling "dimming" even though the light would be off. I'll think some more about this.

    Thanks again for the advice!


  • Hero Member

    @twosh said:

    So basically I should connect my Arduino with e.g. this one http://www.ebay.com/itm/5V-12V-24V-10A-1-Channel-Relay-Module-Optocoupler-H-L-Level-Triger-for-Arduino-/181479686454 so that the Arduino triggers this relay, which in turn triggers my current relay, right?

    Yes, but if you're planning on controlling multiple, then I would look at something like this: http://www.ebay.com/itm/310574415181. If you leave your existing control panel in place, the issue you'll have is that the existing switch must be on before you can control with the Arduino. As well, if you switch it off from the Arduino, the control panel won't know about it and the indicator on your existing switch will likely stay on. Do you have any info on brand/model of the existing system?

    The main issue with having a z-wave switch that is not powered is that it can no longer route packets for other devices. If each device can talk to your controller direct, then that's not an issue, but if other devices need to route through that switch to reach the controller, then those devices may no longer work properly using z-wave.

    Cheers
    Al


  • Hero Member

    I suppose the relays are impulse relays, which need a impulse to change the state (on/off). I'm using the Relay-Modules you mentioned above to control my impulse relays. My impulse relays are controlled with 230V. The relays are connected in parallel to the existing switches and use a 100ms impulse to change the state.
    Works like a charme.


  • Hero Member

    @TimO If they are indeed latching relays, then controlling them from an Arduino and leaving the functionality of the existing systems will be much easier, especially if the lights on the switches are also controlled by the relay.

    Cheers
    Al



  • Latching relays - I can see a small latch physically move when I switch on / off the lights. I think they might be powering my button lights as well since there are a thin wire connected to each relay in addition to the 230V wire. At least that thin wire must be for the impulse making the relay switch. Does this simplify things @Sparkman ?

    @TimO , could you visualize how you have connected the different parts, or better yet use my uploaded pic to show me how I should connect everything?

    Greatly appreciated!


  • Hardware Contributor

    It would be nice if your relays could hold with DC voltage. Do you have a chance to remove one of them, just to try it? Use a 24 DC voltage and try to make a relay click to close. See if it holds. If it does than you can use Mosfets to control them. Be careful, 220AC is lethal.


  • Hero Member

    @twosh said:

    Latching relays - I can see a small latch physically move when I switch on / off the lights. I think they might be powering my button lights as well since there are a thin wire connected to each relay in addition to the 230V wire. At least that thin wire must be for the impulse making the relay switch. Does this simplify things @Sparkman ?

    Yes it does, you would need to wire the new Arduino controlled relay in parallel with the existing wires (the ones to contact A1 and A2). One side of the 24 VAC power supply should be connected to either A1 or A2 and then the other side of the AC supply is connected through the switch to the other terminal. Just hook up the new relay the same way using the same 24VAC power supply if possible.

    Also, if you want to know the status of the light, you could add voltage/current sensors on the output side that would connect to an input pin on the Arduino. If you're not comfortable working on the high-voltage side, you could measure the pulses on the 24VAC side as well.

    Cheers
    Al


  • Hardware Contributor

    If they don't hold, then you can use a semiconductor called triac. Here is how you use one:
    triaccontroller.png
    It is not 240V AC that you are going to regulate, it is going to be your relays 24V AC control signal. And load is your relay.



  • Thanks guys! I will try to get a friend over who knows his stuff when it comes to electricity to help me out with the wiring.

    Breaking it down, I'll need one arduino for controlling the relay board, and if I want a dimmer I would need to rig another Arduino with a dimmer circuit after each 230v relay I want to dim the lamps for.

    @ceech - nice! I'll keep that diagram as an option as well - it would basically eliminate the need for the Arduino relay board I guess.

    Thanks again!



  • @ceech Just wondering, did you get a chance to test this circuit? I've been wanting to do this for a while., guess will be my next project. Will be great if I could get a kit on Ebay. :)




  • Hardware Contributor

    @jeylites No, I didn't try. It will work, though. You can try on a breadboard. You don't even need all the elements. Remove the 100ohm resistor and 0,1uF cap for testing. And the resistors can be replaced with similar. Be careful with the mains voltage, please. I'm tempted to make some boards just to try.



  • @ceech Perhaps I should test one on a bread board. ..



  • @ceech said:

    If they don't hold, then you can use a semiconductor called triac. Here is how you use one:
    triaccontroller.png
    It is not 240V AC that you are going to regulate, it is going to be your relays 24V AC control signal. And load is your relay.

    Based on @jeylites comments I'm starting to think that this triac circuit completely replaces the current relay (not just the Arduino relay board), as well as adding dimmer functionality - is this correct? Confused

    But would I loose the current physical buttons' functionality or could those also be wired into the triac?



  • @twosh

    Yes indeed, this is a dimmer not a Relay. If you need a relay functionality you could employ a solid state relay or mechanical one. Why I say this is the waveform gets altered when going through Traic and its not good for certain electronic items.Excluding a light bulb. See picture below for better understating. I wish i could explain more but in the process of doing something...LOL

    I didn't quite understand what you meant by "current physical buttons" ....

    dimmertheory_1236784371.jpg


  • Hardware Contributor

    @twosh Yes, it is adding the dimmer functionality, but you would need an additional optocoupler and bridge rectifier for it to work. The MOC3061 IC knows about zero crossing of the AC signal and cuts some signal as @jeylites explained. That shouldn't bother you for now. As long as you apply 5V or 0V on the input side, the circuit behaves as a switch.
    Let's not completely replace everything at the moment. Let us say that we are just going to add this circuit to your 24V AC relay coil. You can still use the physical switch. But remember - the voltage fed into the BTA41 triac should be 24V AC in this case.



  • Want to share my progress since my 8 relay arrived today! :)

    I've successfully modified the relay example sketch to use two analogue pins for the 7:th and 8:th relays, so everything software wise is fine for now.

    I connected one of the arduino relay outputs to one of my house relays for testing and succeeded to get the house relay to switch on by having the arduino relay low. But I can't get the house relay to turn off again, no matter if I turn the arduino relay high, nor low again. I had to use the physical light switch to turn the relay off again.

    What am I missing..?


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.