I have a circuit that occasionally causes the Arduino to get reset. I have identified the problem area and I would like to get advice on the cause and how to fix it. The system is described below, and a schematic is attached.
My house is heated by “forced air with natural gas”. The basic control circuit runs on 24 VAC. In a normal heat cycle, when the thermostat (switch) closes the gas valve opens. The gas is ignited by a pilot light, and the bonnet warms. Soon thereafter a relay turns on a 110 VAC motor which drives a squirrel cage fan which distributes the heat throughout the house. The thermostat is a “set back” type which turns the heat down at night and up during the day. If the house is cold, such as when the heat first comes on in the morning, after the gas has been on for some time the bonnet may reach an “over temp” condition. This is a normal condition of systems of this design. When this condition occurs, a temperature switch in the bonnet (which is in series with the thermostat switch) opens. This causes the gas valve to turn off the gas. The bonnet cools as the fan continues to run. When the bonnet cools sufficiently the bonnet switch closes, and the gas value turns the gas on again. This cycle repeats until the thermostat switch opens when the house is up to the temperature set at the thermostat.
I want to measure the number and duration of the “over temp” cycles that occur.
The gas valve operates on 24 VAC and draws up to 500 mA according to the data plate.. I want to make as few wiring changes as possible. Also, I only have ready access to the wiring at the thermostat. The basic design is that the Arduino will detect 2 things: (1) when there is a 24 VAC potential across the thermostat switch (I will call this the Arduino “switch detection” part of the circuit),.and (2) when current is flowing in the thermostat circuit (I will call this the “current detection” part of the circuit). I have the system currently implemented on a breadboard with a couple of toggle switches and a sprinkler solenoid valve for a simulated gas valve.
Switch detection
An LED and current limiting resistor are connected across the thermostat switch. When the thermostat is open, the LED is illuminated. When the thermostat is closed, the LED is shorted out of the circuit. A photo cell (light dependent resistor) is placed next to the LED. The photo cell is connected to a digital input pin on the arduino. This part of the circuit is working well. (In an earlier design I used a voltage divider with a low voltage tap connected to an Arduino analog input. While this seemed to work ok, a respose on this forum advised against it, and also, I didn’t like the interconnection between the 24v system and the Arduino, so I changed the design to use this optical isolation).
Current detection
I made a current transformer with about 8 feet of twisted pair phone wire and a 2” diameter metal washer. I wrapped the wire around the washer in “donut” fashion (loops made by passing the wire through the center hole, then around the outside). There are about 80 loops. One wire of the pair (the primary, see schematic) is connected in series with the thermostat. The other wire of the pair (the secondary) is connected to an analog input pin of the Arduino. A 50 ohm burden resistor is connected across the secondary. When the 24v circuit is ON I measured about 49 mVAC on the secondary coil. I added a 1.5 v battery to raise the AC level above 0 for the Arduino input. I calculated the theoretical values that I expected to read on the AI pin. These values are very close to the actual values that the code reports.
The problem:
The circuit works great about 90% of the time. However, about 10% of the time, when I open the thermostat switch, the Arduino gets reset. The reset never occurs when I close the thermostat switch, and it never occurs when the bonnet switch is opened or closed. It only occurs when the thermostat switch is opened.
The reset is detected by observing output on the Serial port. The Setup routine writes a “startup” message, and this message occurs about 10% of the time when the thermostat switch is opened. The reset continues to occur if I disconnect one side (either side) of the current transformer. The reset does not occur if I remove both sides of the current transformer from the circuit.
I attempted to correct the problem by adding a diode in parallel with the burden resistor (shown in the schematic). This made no difference.
It is my guess that when the thermostat opens, and the magnetic field in the primary coil of the transformer collapses (and perhaps enhanced by the collapse of the field in the solenoid), a spike is occurring in the secondary which is affecting the Arduino. But I don’t have the equipment to measure and prove this theory. I also don’t understand why the problem is not seen when the bonnet switch is opened.
Can someone provide a better explanation of the problem and a suggestion for a fix?
currentDetector.pdf (48.8 KB)