Author Topic: Control and monitor 24vac line with single pin on microcontroller  (Read 12075 times)

0 Members and 1 Guest are viewing this topic.

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Ill start by saying I'm a huge fan of the blog and been subscribed since the beginning I've also found my self reading on the forum quite a bit lately. I work for a small amusement company and have more experience with repairing electronics (Mostly arcade games) then designing them.  I also have my Hvac certification and have been trying to design a board for my hvac unit for better control over the fan speeds and also monitor energy usage among other things, hence this post

Most hvac equipment use a relay contact to energize a 24vac line to turn on equipment. What I am trying to do is monitor this and also would like to be able to use the micro to control the 24vac signal by only using a single digital pin. I'm using an ATmega328 and should be able to change from input to output in the programing. I can make the circuit up using optos and phototriacs but cannot figure out how to wire it to the single pin on the micro. I'm limited on digital pins as this circuit will be on 5 or 6 pins and most of the others are controlling relays. If its cant be done easily or with out exotic components then I'll probably just scrap the idea of controlling it. I figured if it can be done somebody on here would know how. Thanks in advance.
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #1 on: March 22, 2013, 03:31:42 am »
I can't quite figure out what you're trying to do on the 24V AC side.  Can you post a diagram of what you want to achieve?
 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #2 on: March 22, 2013, 03:55:38 am »

This is a basic hvac wiring diagram there is normally a 24vac transformer in the furnace, when the thermostat calls for heat it will close a contact between R and W and that turns on the furnace. What I want to do is put a circuit in parallel to this between the furnace and thermostat to sense this contact closure/24vac, I would also like to control this with with my circuit by shorting R and W. The issue is I only have a single pin per circuit on the micro to do this. I hope that explains it better.
 

Offline Paul Moir

  • Frequent Contributor
  • **
  • Posts: 926
  • Country: ca
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #3 on: March 22, 2013, 04:26:33 am »
I just had a quick look at an old design I had.  Picture this:

24vac through a single signal diode (ie, 1n4148), into a small electrolytic cap (22uF), then through a resistor to limit current into an led/phototransistor optocoupler.  The resistor is 1.8K which is putting ~ 18mA through the optocoupler, rectified enough so you get an on/off output.  Check your optocoupler's specs; that might be driving it a little hard.

Other side of the optocoupler:  Emitter tied to ground, base is floating, and collector is pulled high (5v) with a 4.7k resistor (ie, a resistor between +5v and the collector).  The collector is tied to an input pin on the MCU.  When 24VAC is present, LED goes on, photo transistor goes on, so signal at the photo transistor's collector goes low.  Turn it off, photo transistor goes off, MCU pin goes high due to the pullup resistor.

An optocoupler is a pretty good idea when you've got field wiring attached to a computer.  You can do it without but why not?

EDIT:  Going the other way, a relay or a small solid state relay is easiest.  If you use a mechanical relay, you probably can't drive it directly with a MCU pin because it can't supply or sink enough current.  Google "TTL relay driver" for a schematic.  (Exception; you may be able to use a reed relay driven directly, but don't omit the freewheel diode.)   A solid state relay can be driven directly since it's input is usually a LED or an LED with a resistor in series.

Any hints on the micro you plan you use?

   
« Last Edit: March 22, 2013, 04:32:29 am by Paul Moir »
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #4 on: March 22, 2013, 05:00:24 am »
Do you need to know when the original thermostat contact is closed, even when you are overriding it?
 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #5 on: March 22, 2013, 05:19:19 am »
Do you need to know when the original thermostat contact is closed, even when you are overriding it?
No I don't need to know if the thermostat closes the contact once I override it, I just need to know the status of it up to that point. I can build a circuit to both control and monitor it however the issue is when I tie them together at the micro I always get current from one into the other, for example the thermostat calls for heat closes the contact it causing the sensing circuit pull the pin low but then that causes the realy/opto to activate then when the the  thermostat ends the call opens the relay the relay in my circuit stays closed because its being activated by the sensing circuit.
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #6 on: March 22, 2013, 05:52:47 am »
I don't see an easy way to do this with only one micro pin and a simple parallel connection to the thermostat wires.   Is there a reason you can't use 2 micro pins?
 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #7 on: March 22, 2013, 06:19:41 am »
I'm driving 5 relays and monitoring 6 lines, Compressor, Changeover Valve, Heat, Fan, Humidistat and "L" which is error reporting from the outdoor unit that is also a 24vac contact closure. I would like to control the first 4 of those. Which would be 15 and I only have 12. I'm using an ATmeaga328 with the Arduino bootloader.  Most of the analog pins are being used for temp, voltage and current monitoring as well. So you can see if I could free up some digital pins and monitor those 4 lines at the same time it would be very helpful, however if I cannot its not a deal breaker.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #8 on: March 22, 2013, 07:10:24 am »
Use a multiplexer to switch the signals into the input. Use 3 pins to drive a 8 way cmos analogue switch to feed the ADC input will allow you to monitor 8 inputs, digital or analogue.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #9 on: March 22, 2013, 02:25:05 pm »
In the circuit below driving the pin with a square wave will turn on the output transistor. While not driving the pin you can read the input signal.

There are probably simpler ways to economise on the other I/O in your design.

 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #10 on: March 22, 2013, 03:54:00 pm »
Yep thats exactly what I was looking for! It didn't even cross my mind to use a square wave and drive it though a cap. I'm not sure of any way to simplify the rest of the circuits I'm just using a transistor for ever relay which are All spdt linked so that nc contact is linked to common on the next. The idea here is so that regardless of any failure hardware or programing only one relay can supply power. The relays are for fan speed taps energising more than one at a time would kill the motor in short order. I'm open to ideas. Thanks again for advice

Sent from my SAMSUNG-SGH-I747 using Tapatalk 2

 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #11 on: March 22, 2013, 04:23:50 pm »
The idea here is so that regardless of any failure hardware or programing only one relay can supply power. The relays are for fan speed taps energising more than one at a time would kill the motor in short order. I'm open to ideas. Thanks again for advice

If you want to drive one (or none) of 5 relays then a 3 to 8 line decoder chip like a 74138 will do it with 3 pins. A 4051 can also do it with added flexibility.

 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #12 on: March 22, 2013, 06:50:52 pm »
I had thought about using a shift register that way I could control the five fan tap relays in addition to a few more I might add. Would there be any advantage of controlling the 24vac line with the shift register and then just monitoring the lines off the micro vs the diagram above besides the fact I could verify control as well?

Sent from my SAMSUNG-SGH-I747 using Tapatalk 2

 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #13 on: March 22, 2013, 07:12:01 pm »
I had thought about using a shift register

There are lots of ways of squeezing more I/O on a processor. The least hassle is probably something like the Microchip MCP23S17 I/O expander which gives 16 pins with an SPI or I2C interface.
 

Offline 4to20Milliamps

  • Regular Contributor
  • *
  • Posts: 248
  • Country: us
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #14 on: March 23, 2013, 03:56:38 pm »
When I did control work for Trane we would use a step sequencer when we would run out of outputs, I don't know if this is what you're after or not but it sounds like you could implement status and control combining the circuit above with one of these:

http://controltrends.org/2010/01/sequencing-a-rib-2/
 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #15 on: March 23, 2013, 05:21:47 pm »

http://controltrends.org/2010/01/sequencing-a-rib-2/

I think that's a bit overkill for what im' doing plus im trying to integrate it into one pcb. I'm going to go ahead and just use a simple shift register to do all of the controling and monitor directly from the micro which will give me just enough to make it all work.
« Last Edit: March 23, 2013, 05:25:42 pm by Bluestreak66 »
 

Offline Bluestreak66Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Control and monitor 24vac line with single pin on microcontroller
« Reply #16 on: March 23, 2013, 05:50:25 pm »
http://www.qwik.com/products/qwikseer/

I saw this about a month ago and really like the Idea but I think it leaves a lot to be desired. It only has 3 speed taps and works only when cooling. What I am doing is designing one that has 5 fan taps with provisions to be able to chose one for a circulate speed when heating and cooling is off. Circulate will be always on or controllable through the thermostat. Also another thing that bothered me about it is that it has a predefined set point for humidity, I would like to control it through the thermostat or external humidistat which would measured humidity 24/7 and not only when the ac is on. Since Im creating my own board to do this I added voltage and current monitoring as well as Ethernet. In the whole scope of the project Im hoping to create another board that sits in the outdoor unit and communicates with this one that has better control over defrost cycles and with be able to measure super heat, sub cooling and overall efficiency then display it in a web interface. My current goal is just to get the inside board done in time for summer so that I can work out the programming throughout the summer. I appreciate all the help and welcome any thoughts on this.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf