I am interested in detecting the state of a toggle (on/off) switch in an AC circuit. I have an idea for this design (described below), and I would like to know if this is workable, and the pros and cons of this approach. I have several projects for which I need to make a similar detection, so I would like to use this in other cases also.
My house is heated by “forced air with natural gas”. The basic control circuit runs on 24 VAC. A schematic of the basic thermostat circuit is attached. 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 heating systems such as this one. 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. This means that I need to know when the bonnet switch opens and closes.
The gas valve operates on 24 VAC and draws up to 500 mA according to the data plate.. For convenience in making the measurements I want to make as few wiring changes as possible. I want to install the wiring that is shown by dashed lines in the attached schematic. I would like to place this wiring change at the bonnet switch, but it is much easier to put it at the thermostat, and I think that either placement will provide the information I want. The basic idea 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.
The detection for current flowing in the circuit is made with a DIY current detector that I made. It is able to detect current flow in the milliamp range, but not micro amps. This part of the design is working and I have no questions about it.
The switch detection circuit implements a voltage divider across the thermostat switch. The resistances are chosen so as to allow no more than 0.1 mA to flow in the thermostat circuit, and feed the Arduino analog input pin with peak voltage between 0 and about 4 volts. The 100 uA is intended to be way less than what is required to operate the gas valve, and also less than what the current detector is able to detect. The circuit includes a diode in order to block negative voltage to the AI pin. The arduino code samples the A0 analog input pin for current detection, and the A1 analog input pin for the switch detection. The switch detection is done by a loop that reads the AI pin for 500 ms and averages sum-of-squares the readings.
When the thermostat switch is closed the average will be 0, and it will be non-zero when the switch is open. Similarly, the current detection will be 0 when the gas valve is off, and non-zero when it is on. When the house is “at temperature”, the thermostat switch will be open, and the bonnet switch will be in its normally closed position. In this state there is 24 VAC across the thermostat switch, and micro amps, but not milli amps of current flowing. When the gas is on, the thermostat switch will be closed, and the bonnet switch will be closed. In this state there will be 0 VAC across the thermostat switch, and milliamps of current flowing. When the bonnet switch opens (the over temp condition), the thermostat switch will be closed (there will be 0 VAC across the thermostat switch), and there will be no milli amps of current flowing. With these measurements the Arduino can detect and report the number and duration of the over temp cycles. The circuit conditions are summarized as follows:
thermostat current
switch detection conclusion
non-0 volts 0 mA house is at temp
0 volts non-0 mA gas is on
0 volts 0 mA bonnet switch is open (over temp)
non-0 volts non-0 mA not possible
Will this switch detection design work?
switchDetector.pdf (23.6 KB)