# I need to sense a switch setting - 24 VAC

#### AverageGuy

Joined Dec 27, 2009
11
Here's my proposed schematic:

What I have is a fan in an HVAC system that is controlled by a thermostat. The thermostat may turn the fan on or the HVAC system might turn it on. In either case the voltage across the switch will drop to zero when the fan is on. I want to be able to sense the state of the switch. Obviously I can't steal too much current from the circuit or it will turn the fan on. It will take some tweaking to get the right R1 value. I have no idea what the current draw across the line is, since I don't have an A/C ampmeter. I suspect the current is minimal and just enough to engage a relay.
My question is what value of C1 is reasonable. The output doesn't have to be super clean, but enough to cause the diode to enable the transistor to conduct. I plan on using a PC817 optocoupler, since I have some. I figure R2 needs to be large enough to limit the current to the optoisolator. It is rated for 50 ma. The output may be as high as 35 volts across the cap ( I think) so to limit it to 20 ma requires a resistance of a little less than 2K. I'll probably start there unless someone has a better idea.

#### MisterBill2

Joined Jan 23, 2018
6,736
A possibly simpler method would be to put a neon bulb with a resistor across the switch, and have your photo transistor triggered by that. The benefit is that the neon bulb draws far less current than the opto device. In addition, you can see when it is on and so know that the circuit should be on.The series resistor can be in the range of 82K to 100K ohms. And an NE2 bulb should work.

#### ebeowulf17

Joined Aug 12, 2014
3,274
A possibly simpler method would be to put a neon bulb with a resistor across the switch, and have your photo transistor triggered by that. The benefit is that the neon bulb draws far less current than the opto device. In addition, you can see when it is on and so know that the circuit should be on.The series resistor can be in the range of 82K to 100K ohms. And an NE2 bulb should work.
I was under the impression that neon bulbs needed higher voltage. Will they light reliably on 24VAC?

#### MisterBill2

Joined Jan 23, 2018
6,736
I was under the impression that neon bulbs needed higher voltage. Will they light reliably on 24VAC?
OOPS!!, you are right. I was thinking of the 120 volts case. You will indeed need to use an LED opto-isolator of some kind. Your original circuit should work adequately, a small capacitor , possibly 4.7mFD should be adequate, and the resistor value selected to provide about 5mA to the opto-isolator. And you can have all of the resistance in the R1 position to make it simpler. Also, I recommend consulting the spec sheet for the particular device you select in case the recommended current is different from the 5mA that I suggested.
A second option could be to use a small FET SSR that is rated for a 24 volt input. That would be the very simplest choice.

#### ebeowulf17

Joined Aug 12, 2014
3,274
Here's my proposed schematic:

What I have is a fan in an HVAC system that is controlled by a thermostat. The thermostat may turn the fan on or the HVAC system might turn it on. In either case the voltage across the switch will drop to zero when the fan is on. I want to be able to sense the state of the switch. Obviously I can't steal too much current from the circuit or it will turn the fan on. It will take some tweaking to get the right R1 value. I have no idea what the current draw across the line is, since I don't have an A/C ampmeter. I suspect the current is minimal and just enough to engage a relay.
My question is what value of C1 is reasonable. The output doesn't have to be super clean, but enough to cause the diode to enable the transistor to conduct. I plan on using a PC817 optocoupler, since I have some. I figure R2 needs to be large enough to limit the current to the optoisolator. It is rated for 50 ma. The output may be as high as 35 volts across the cap ( I think) so to limit it to 20 ma requires a resistance of a little less than 2K. I'll probably start there unless someone has a better idea.
If you're worried about loading effects on the HVAC/input side of things, you could just do the smoothing on the output side. The opto won't mind pulsing at 60Hz, and you can just build a suitable RC circuit on the output side for your [microcontroller?] to read.

#### ebeowulf17

Joined Aug 12, 2014
3,274
I'm actually in the midst of a vaguely similar project. At this point I've gone a little over the top on this design, adding RC smoothing, LED indicator, and a short circuit protected, current limiting output stage, but it's still a similar concept at heart:

#### MisterBill2

Joined Jan 23, 2018
6,736
Did you intend 4.7uF?
Yes, but my font is a bit limited and so I used the text version. I could have spelled it out, 4.7 microfarads, but it seems that you figured it out. I was possibly a bit lazy there. Sorry about that.
From now on I will try to always spell it out so that none become confused. I had not considered that such might be a problem.

Last edited:

Joined Jul 18, 2013
21,244
There is always insert symbol! μf provided here .
Max.

#### Attachments

• 3.8 KB Views: 6

#### Danko

Joined Nov 22, 2017
969
"...Short forms for micro farad include
MFD, mfd, uF, MF and UF. Mica capacitors are usually expressed in terms of MMFD (micromicrofarads) (picofarads).
Short forms for micromicrofarads include MMFD, mmfd, pF, MMF, uuF and PF. A MMFD is one-millionth of a MF. In
between a MF and MMFD is nF which is one-one thousands of a MFD..."

#### MisterBill2

Joined Jan 23, 2018
6,736
The one thing that matters most has not been mentioned yet, which is "what is the transistor output to be used for?? Lighting an indicator? or operating a relay? Output to a microprocessor board for some purpose unknown? Amazingly enough, it really does matter.

Joined Jan 15, 2015
5,612
If you just want to know if the fan is on or off would something like this work? CR2550 Low Cost Remote Current Indicator. I have used them with assorted AC motors like fans, heating elements and other AC loads. They turn on the LED at about 0.750 amps but the primary conductor can be looped through the coil to half the turn on level. I have seen them for between $10 and$15 USD.

Ron

#### AverageGuy

Joined Dec 27, 2009
11
Thanks for all the input. I appreciate it. The output of the opto transistor will be connected to an Arduino pin with a pullup (internal) resistor. I like the idea of cleaning up the signal on the output. I'd be afraid of loading the circuit if I used a relay. Actually now that I think of it, I don't need to clean the signal up at all. I can just integrate the input over time and if I have any signal at all, I'll assume the fan is off, but if it's essentially zero I know the fan is on.

Thanks,
Jim.

#### ebp

Joined Feb 8, 2018
2,332
I would use a diode and a series resistor of about 15k on the input side. That will give a peak current of about 2 mA through the emitter of the coupler. Use a pullup of about 10k on the phototransistor side. There is no need for any sort of filtering or cleanup on the output side. All you really care about is that the signal will be switching when the main mechanical/relay switch is open. Simply check the state of the signal over a couple of AC line cycles for activity. If your firmware is too busy to hang around in the test loop for that long, a filter would be useful.

[EDIT] - D'oh! - just noticed Guy had already come to the conclusion that filtering isn't necessary

Last edited: