I am having a problem detecting when a 24 VAC sprinkler circuit is on. This should be pretty easy, but it is not working.
I am getting false ON reporting through the Arduino DI port. I never get false OFF reporting. The false ON reporting sometimes waffles on/off for several hours at very short interervals – like ½ sec on, ½ sec off. At other times it incorrectly reports solid ON (without waffles) for hours at a time. It always correctly reports ON when it is actually on. Although I have not been able to prove it, I believe that the problem is caused by parasitic induction.
A schematic of the configuration is attached.
The sprinkler controller is a Richdel mechanical sprinkler controller, mounted in the garage. It is powered by a 24VAC transformer in the basement, and is connected by zipcord wire. There is a 3-position “manual” switch on the controller which I have physically moved into the basement for convenience. The switch is connected to the controller by an unsheathed “cable” of three conductor twisted leads. The switch positions are Off (sprinklers never run), Daily (sprinklers run every day), and Auto (sprinklers run according to the day wheel / switch in the controller. My wheel / switch is set for Monday, Wednesday and Friday.
The circuit is designed for the Arduino to detect the “enabled” state of the sprinkler controller. In the enabled state, reading the DI port should get a value of 1. In this state the controller will operate the sprinkler valves next time the motor driven rotary switch engages. As the diagram shows, the enabled state will occur when the manual switch is in the Daily position, or when the manual switch is in the Auto position and the day is Monday, Wednesday or Friday. At all other times (when the manual switch is OFF, or the switch is set to Auto, but the day is not Monday, Wednesday or Friday) the controller is in the disabled state and reading the DI port should get a value of 0.
I constructed and tested an opto detector using 2 parallel but opposite LEDs and a 32k ohm current limiting resistor. I have made and used many of these and they work quite well. One of the LEDs is encased in shrink tubing with an LDR. The other is mounted on a prototype board. In addition to its “backflow” function in the AC circuit, the 2nd LED provides a visual indication of the circuit for my occasional curiosity. I debounce the Arduino input by reading the DI port for 250 ms and then averaging the result. I used this very opto detector in a different 24VAC circuit last year.
The Arduino, the manual switch, and the transformer are all in the basement, which is about 35 feet away from the controller in the garage.
At times when the Arduino should be reporting an OFF condition there is a 2.3 VAC drop across the opto detector. This should be 0 VAC. I believe that the 2.3 VAC is caused by induced current in the opto detector circuit. I think the 2.3 VAC is high enough to pass current through the LED (approximately 0.7V required for turn-on). I do not have the equipment to measure the AC current through the induced voltage circuit. It seems to be enough to turn on the LED with a rather dim light.
There is also a very odd behavior of this circuit that I believe is important to consider. During times when the sprinklers DO NOT run (because the manusal switch is OFF, or the switch is in Auto and this is not a run day), then the DI port reports a solid ON state before and after the rotary switch engages, and an OFF state when the rotary switch is engaged with each of the solenoid circuits (the sprinkler valve would be ON if it was a run day).
My speculation is that this odd behavior may be explained as follows. When the rotary switch rotates into the ON position for a solenoid, it provides a new direct return path for the induced current. I think the voltage source (induced) is too weak, and the current is too low to affect the solenoid. But I think it, or the incandescent run light, essentially provides a shunt around the opto detector. This significantly reduces the induced voltage across the opto detector. The reduced voltage is below 0.7V, so the previously dimly lit LED turns off, and the DI reports a value of 0.
The zip cord and the 3-conductor wire for the switch are routed along a parallel path from the basement to the controller in the garage, a distance of about 35 feet. I thought this was the cause of the induced current. To prove this I ran a long extension cord from the Arduino in the basement, up the steps, around the corner, through the door and down the length of the garage to the sprinkler controller. I removed the 24VAC zipcord connections from the transformer and the sprinkler controller and powered the sprinkler controller through the extension cord. This made no difference. I then re-powered the controller with the zip cord, and ran the signal wire for the opto detector through the extension cord. This also made no difference.
Next, based on my speculation about the shunt that occurs when the rotary switch engages, and in spite of my inability to prove the source or cause of the inductance, I attempted to “fix” the erroneous reporting by installing a resistor, with a somewhat arbitrarily chosen value of 20k ohm, in parallel with the opto detector. When the sprinkler circuit is OFF, this provides an alternate path around the opto detector for the induced current and results in a DI value of 0. When the sprinkler circuit is ON, there is a full 24 VAC drop across the opto detector (as well as the parallel “shunt” resistor), and the DI reports a value of 1. This seems to work.
My questions are:
#1 Am I correct in believing that the problem is parasitic induction? If not, then what else might it be?
#2 Is a “shunt” resistor the best way to deal with this problem? Or is there a better method of reducing or eliminating the parasitic induction?
Most of the articles I have read about eliminating parasitic induction deal with high frequency circuits, in the megacycle or gigacycle range. My circuit is 60 cycle.
sprinklerWiring.pdf (191.8 KB)