Controlling existing relays
-
@Sparkman I think that would work out quite nicely! But I think I would rather stay away from the 230VAC and use it on the 24VAC instead - feels safer. If I don't misunderstand how the current sensor works it shouldn't matter if I hard wire it on 230VAC or 24VAC, right?
@twosh Because the signals on the 24 VAC side are momentary 35 ms pulses and not a continuous current when the lights are on, it would be more difficult to use as there's a chance you could miss them and then you would get out of sync. It would be most accurate to connect on the 230 VAC side. You would disconnect one side of the 230 VAC from the relay, wire it to one side of the large terminal on the module and then use a new short piece of wire (rated for at least 230 VAC/20A) and connect from the other large terminal on the module to the relay. It basically needs to be inserted in the circuit so that the current would flow through it. If you're uncomfortable with that, then you can use one of the modules that slip over the wire. They tend to cost more and also may need additional components to connect it to an analog in on the Arduino. Here's one that will work without additional components: http://www.ebay.com/itm/171737837875. This one is only rated for 5A which likely is enough depending on how many and what types of light bulbs you have on the circuit.
Cheers
AlPS The added advantage is that you'll also be able to track power usage for those lights.
-
@twosh the above current sensor could be one option or you could build a voltage divider to measure the 24v side. Something like the battery monitor .... this route is cheap and effective. Thought I don't know how you are going to the programming part but will like to see where it goes :)
-
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
Tim -
@twosh the above current sensor could be one option or you could build a voltage divider to measure the 24v side. Something like the battery monitor .... this route is cheap and effective. Thought I don't know how you are going to the programming part but will like to see where it goes :)
@jeylites said:
the above current sensor could be one option or you could build a voltage divider to measure the 24v side. Something like the battery monitor .... this route is cheap and effective. Thought I don't know how you are going to the programming part but will like to see where it goes :)
It's 24 VAC, so would also need to be rectified.
Cheers
Al -
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
Tim@twosh said:
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
TimYou're welcome Tim!
You can go with multiple Arduinos but I'd consider a Mega instead: http://www.ebay.com/itm/360790082588.
Cheers
Al -
@jeylites - thanks for the alternate suggestion! :)
@Sparkman , to clarify, my light switches does glow constantly when turned on, so there is constant current on the output side of the relay going to the light switches. I've measured the voltage and it is 24VAC. So I think that, disregarding the power measurement possibility, I could use that circuit as well.
-
@jeylites - thanks for the alternate suggestion! :)
@Sparkman , to clarify, my light switches does glow constantly when turned on, so there is constant current on the output side of the relay going to the light switches. I've measured the voltage and it is 24VAC. So I think that, disregarding the power measurement possibility, I could use that circuit as well.
@twosh said:
@Sparkman , to clarify, my light switches does glow constantly when turned on, so there is constant current on the output side of the relay going to the light switches. I've measured the voltage and it is 24VAC. So I think that, disregarding the power measurement possibility, I could use that circuit as well.
If there's 24 VAC on the output side of the relays as well, then yes, you could use that and you have some other options to be able to measure it including options to use digital pins instead of analog.
Here's some examples on converting the 24 VAC to 5 VDC: http://rayshobby.net/24vac-to-5vdc-conversion/. Option 4 may be a good choice. In your case, since you would only use it to connect to a digital pin on your Arduino, power draw is very low and some of the issues he talks about don't apply to your case.
Cheers
Al -
My Mega arrived today so I could load it with my customized sketch that I've worked on for controlling relays as well as measuring current. I'm still waiting for the current sensors, but I've already got a problem... I keep getting "check wires" via the serial monitor, and the Mega is not detected by the gateway.
Basically I think that the wiring of the radio to the Mega is wrong, but after scavenging the forum and trying a handfull of different wiring combinations I still can't get this to work.
I have tried using the normal (nano, pro mini) pins, using pins 14-16, 50-52, etc. but nothing seems to work. I have NOT modified any config files yet, but based on the various threads I've read it's unclear to me if you should or shouldn't.
@Sparkman , do you use a mega yourself, and have successfully wired the radio?
@hek, would it be possible to add instructions for the Mega (and perhaps the Uno as well) to the general build guide for connecting the radio?
-
Finally found a combination that worked with the mega as a sensor. Here is the pin mapping if it will save time for anyone:
9 CE
10 CSN/CS
52 SCK
51 MOSI
50 MISO
2 IRQDoesn't require any config changes, but I am currently getting some "0;0;3;0;9;version mismatch" in serial monitor. Have 10 uF cap on the radio.
-
Tried powering the Mega from computers USB 5V, and two different 12V DC adapters - still getting version mismatch. Anybody knows what's going on?
@twosh From what I've read before, the version mismatch error is often caused by power issues. Are you getting the errors with the relays connected or without? If the relays are connected, try disconnecting them. If the error goes away, it's likely a power issues. Maybe try powering the radio from a separate 3.3v source.
Cheers
Al -
@Sparkman
I tried powering the Megas radio from a Nanos 3.3V pin and GND. The Nano is working fine as a sensor by itself, so I guess the radio gets enough power from it. However, this way I only got "check wires" from the Mega... :(Just a thought; if it helps, I'm defining these pins for the Mega in my sketch, but I don't see how that could affect this particular problem...
const int relayPin[] = {22, 23, 24, 25, 26, 27, 28, 29}; const int currentPin[] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9}; -
@Sparkman
I tried powering the Megas radio from a Nanos 3.3V pin and GND. The Nano is working fine as a sensor by itself, so I guess the radio gets enough power from it. However, this way I only got "check wires" from the Mega... :(Just a thought; if it helps, I'm defining these pins for the Mega in my sketch, but I don't see how that could affect this particular problem...
const int relayPin[] = {22, 23, 24, 25, 26, 27, 28, 29}; const int currentPin[] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9};@twosh What happens if you remove those lines or comment them out? I have used a Mega with an NRF24 successfully before with the NRF powered from the 3.3v source on the Mega, but I didn't have any sensors connected. I would try a very simple sketch first to see if that works.
Cheers
Al -
Thanks @sparkman for once again nudging me in the right direction!
I went trough the code in my sketch a couple of times commenting out various sections and suddenly the sensor started functioning correctly. So I checked that function closely and noticed that I was out of bounds in a for-loop. that stupid NUMBER_OF_CURRENT_PINS +1 . That +1 had accidentally stayed there from an early version of the sketch. Correcting that, my sketch seems to load without problems - go figure! :P -
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
Tim@twosh said:
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
TimHave you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.
Phil
-
@twosh said:
Great, thanks for the clarifications @Sparkman !
Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).
The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?
Best,
TimHave you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.
Phil
@phil-pritchard No, not really. As I've mentioned tinkering with hardware is new to me so I don't actually have any knowledge of what exists and whats possible from that side of the table. Would you like to expand on your thoughts? :)
I've ordered a bunch of these hall effect sensors: http://www.ebay.com/itm/221649135732?rmvSB=true