June 23, 2013

24V AC Solid State Relay Board

My post on the hardware connections between my Raspberry Pi and HVAC wires has become one of my higher traffic posts so far. Apparently people are searching for ways to connect Raspberry Pi's to thermostats (or Arduino or any other microcontroller for that matter). So I decided to design a circuit board to fill that space.











It's nothing fancy, and it can all be breadboarded very easily. But sometimes it's just nice to have it all in one neat little package, so here it is. It's capable of switching three 24V AC lines (think furnace, air conditioner, and blower fan). Simply screw the hot wire into the terminal labeled HOT, the three lines you want to control into 1, 2 and 3 on the DRIVEN side, and the low voltage control signals into 1, 2 and 3 on the DRIVER side. You'll also need a ground wire going from the micro to the GND terminal. I included an extra empty terminal next to HOT in case your wiring includes the common wire of the 24V supply (mine doesn't). It does absolutely nothing, just there to keep the wire from feeling left out and causing potential mischief. There's space for 3 optional LED's for some nice visual feedback of what's switched and what's not. And that's it! Pretty simple, really.

And the design files:

For the software side of this, you could try using my simple script from here, but I'll admit it's not very user friendly (or code efficient). For much better software complete with browser interface, check out Wyatt Winters Rubustat made using this board.

For sale in the Makeatronics Store.

37 comments:

  1. Have you tried switching larger voltages such as 120Vac? Might be interesting to use this to control low power mains circuits.

    ReplyDelete
    Replies
    1. It would work just fine for switching 120Vac, but then it becomes a question of heat dissipation. The triac I've used here is capable of switching 4A at up to 600Vac assuming you have a proper heat sink on the device. But please be careful when working with mains voltages, they can be lethal if improperly handled. A good safety precaution is to wear rubber shoes and use only one hand when working near anything that might be live, keeping the other hand in your pocket. That way you only get your hand zapped and the current doesn't travel through your heart on the way to the other hand.

      The BTA20 triac (http://www.digikey.com/product-detail/en/BTA20-600CWRG/497-3390-5-ND/669147) can switch up to 20A, again assuming a proper heat sink. It is pin compatible with the triac on this board except that the tab is insulated from the pins (the triac on this board has the heat pad connected to the middle pin). This project (http://makeatronics.blogspot.com/2013/05/sous-vide-part-3-advanced-development.html) uses the BTA20 with a large heat sink. I've been using it successfully with a 12A heating element for quite some time now.

      Delete
  2. Hi,

    i try to use Triacs for switching 24VAC motors. But im not sure about the resistors. Why is R1 100Ohms and what is its function?

    Thanks, Elias

    ReplyDelete
    Replies
    1. R1 serves to protect the opto-triac from high current. Unlike a MOSFET, the gate of the triac can actually sink quite a bit of current. So if R1 was omitted there could be a lot of current going through the opto which would burn it out.

      Delete
  3. Great board design! Is there any chance you would do a board that included a 24VAC to 5V DC converter to power the Pi, and a 2pin header to connect some DS18B20 sensors to, and a header to plug this directly into the Pi? I'm getting ready to do my own DIY thermostat, and want to eliminate as much clutter from the design as possible, but I've never done a circuit board.

    ReplyDelete
    Replies
    1. I have my RPi in the basement controlling a number of functions in my house, so having a self contained unit for the thermostat never even made it to the drawing board. I like the idea, a lot, and it shouldn't be too hard to pull off. But honestly I don't know if I'll be able to make time for it any time soon. I've been working on a wireless temperature sensor to compliment this board, and I've been trying to devote more of my free time to designing my 3D printer as of late....

      If there's interest out there for a board like this maybe I can move it up in my queue a bit.

      Delete
    2. No problem, I know how all those extra projects pile up. :-)
      I'm going to get the "Pi Plate" for my build, but it adds $20 to what should be a relatively cheap project. The upside is it allows me to add the sensors, and voltage regulators in a nice plug-in "shield" type board.

      Delete
  4. Sorry for the basic question, I'm still very new to microcontroller hardware. What modifications to the design would be required to use a 3.3V microcontroller rather than 5V? Would it just require different resistors on the driver side or would different opto-triacs be needed as well to work with the lower voltage?

    Thanks!

    ReplyDelete
    Replies
    1. The MOC3063 optocoupler datasheet says that it will work with a current anywhere between 5 - 50mA. There's a maximum of 1.4 volt drop across the opto's internal LED, so when driving it with 3.3 volt logic you need (3.3V - 1.4V) / (0.005A) = 380 ohm maximum resistor.

      That being said, the Raspberry Pi uses 3.3V logic and I use my setup with a 560 ohm resistor and it works just fine. That was an oversight on my part that I never caught until you inquired. The reason it still works is (at least) two fold:
      1) The MAXIMUM voltage drop across the LED is 1.4V, but the typical voltage drop is 1.2V (and some might be less). (3.3V - 1.2V) / (0.005A) = 420 ohm. Getting closer.
      2) The 5mA figure in the datasheet is the minimum current required to guarantee that the opto will activate. Since that's the worst case opto to leave the factory, it's possible (and probable) that a current less than 5mA will work.

      So, thanks for you question. I intended for this board to work across both 3.3V and 5V systems. With the resistor values given its not guaranteed that it will work at 3.3V, even if it is probable that it will. The next batch of boards I order will be updated to have a 330 ohm resistor value printed on them to give a minimum of 5.5mA @ 3.3V (using worst case of 5% resistor tolerance) and a maximum of 11.5mA @ 5V (again, worst case of 5% resistor tolerance). If you have a 5V micro and it has a hard time with 10+mA output then you'll want to up size the resistor a bit.

      Delete
  5. Just wondering. Could I use the moc3063 without the bt134 to switch 24vac in order to drive my Eltako impulse relays?

    ReplyDelete
    Replies
    1. Not likely. Even though those relays only need a momentary signal to switch, the moc3063 will not handle the current draw of the relay. My bet is you will fry the moc3063.

      Delete
  6. I bought one of these a few weeks ago and I have my pi hooked up to my hvac system now. My system is a heat pump system which requires that all 3 triacs be energized for the AC to run. Occasionally when testing my setup and running the AC, I noticed some unhealthy sounds. The two most recent times I was able to grab my multimeter and test the output pins. Both times pin 1 has been down to 16V. Could this be because of the 3.3V vs 5V logic resistor selection (I used the 560 ohm because I didn't see the comment on this page).

    I'm a mechanical engineer and software developer, but I am merely a tinkerer with electronics. Where would you suggest starting? I was thinking about swapping out the resistors and/or the pin 1 triac. Do you know of anything else that could be causing this? I think the pi is outputting good signals (I have a 2amp power supply) but I haven't actually attempted to measure them during the malfunction.

    ReplyDelete
    Replies
    1. To clarify, the "unhealthy sounds" are coming from my hvac unit, not any of the electronics themselves.

      Delete
    2. Interesting symptoms. I'll tell you what I know:

      The 3.3V vs 5V logic won't make a lick of difference. I've tested the 560ohm resistor on both voltages and it works fine. Since it's an optocoupler isolating the triacs from the logic the triacs only see a on/off signal.

      The 16V under load isn't surprising. That voltage is a function of how big your 24V transformer is and how much current is pulled by your HVAC system. I bet if you tested the voltage with your regular thermostat you would see the same result.

      I would start by listening carefully for the "unhealthy sounds" with the regular thermostat and check the voltage on the 24V line just to be sure. If that eliminates the sound my next guess would be that there might be a turn-on sequence and timing for the three triacs. You might have to get tricky with your multimeter to measure when each turn on regularly, or you might be able to hook a low wattage 24V light bulb in parallel to the HVAC on each of the three wires.

      Let me know what you find.

      Delete
    3. Sorry for the horrendously late reply, but I got it all sorted out. The noise was from the reversing valve (on my heatpump system) switching on and off rapidly. I dropped the resistors from 560 to 300ohm and it fixed my problem.

      I also thought you would like to know that I linked your blog on a post I made about my system http://www.nooganeer.com/his/?p=112

      Delete
    4. Well, I stand corrected. Sorry if I led you down the wrong path with my resistor comment. The next batch of boards I order will be updated with 330 ohm resistors on the opto triacs.

      Thanks for the link! In my experience it's almost impossible to make wires look good, hiding the project behind an access panel is a smart move.

      Delete
  7. Nice tutorial and nice board! I'd like to order one but have a couple of questions:
    1. My home has 5 wires, R/G/W/Y and the C wire. Does the board work in this case?
    2. Can you please show the wiring diagram connecting the furnace low-voltage terminal board and the PCB and the Pi?

    Thank you very much!

    ReplyDelete
    Replies
    1. 1. You can look at the back of your existing thermostat to see if there are any labels there. If not check here: http://toad.net/~jsmeenen/wiring.html. Looks like your red wire is hot, green is fan, white is heat and yellow is AC. You will want to verify these by touching the hot to each of the other three in turn (leave C out of it) and noting if the correct appliance comes on.

      2. I'll try to get a wiring diagram up sometime, but it's pretty simple:
      Connect the HVAC hot wire to the terminal labeled HOT.
      Connect the HVAC common wire to the terminal labeled COM OR bend and tape it out of the way OR cut it off short.
      Connect the remaining three HVAC wires to the DRIVEN terminals 1, 2 and 3.
      Connect the low voltage ground to the GND terminal.
      Connect the three low voltage control wires to the DRIVER terminals 1, 2 and 3.
      A low voltage on DRIVER x will disconnect DRIVEN x, a high voltage (3.3 - 5v) will activate DRIVEN x. Simple as that.

      Delete
  8. Any plans to make a similar board with more outputs. I have a 2 stage heatpump systems so you need a minimum of 4 contacts(without emergency heat). I was hoping to find a board with 6 contacts for my pellet stove/heat pump thermostat project. 1-reversing valve, 1-fan, 1-1st stage, 1-second stage, 1-pellet stove(I would need to isolate this from the the HVAC control circuit), and 1-emergency heat

    ReplyDelete
    Replies
    1. At this time no, I don't plan on making a larger board. The board area (cost) would be more than 1 board but less than 2, so theoretically it would be cheaper. But I have a lot of other projects in line that I need to dedicate time to.

      However, with some simple stand offs from your local hardware store you can stack multiples of these boards together to get however many outputs you want. If you are ordering several you might even consider taking the design files (linked in post) to OSH Park to have them make them directly.

      As for isolating your pellet stove (I'm not familiar with the details of why you would need to), keep in mind that the low voltage side is fully isolated already, but the three outputs share one "hot" line.

      Delete
    2. Thanks for the response. The isolation is because the pellet stove has a seperate 24VAC control circuit so it cant share the common "hot" with the HVAC system. Right now I have a Honeywell wifi thermostat operating some 24VAC relays to work both systems but like any engineer I want something more elegant with more granularity to the controls.

      Delete
  9. I just received my board and components ordered from your site. Thank you. I thought soldering to the board would be straight forward with through-hole mounts, but the BT134 mounting base confused me. How does one attach this?

    ReplyDelete
    Replies
    1. First off, soldering the back side down is optional. The center pin and the back are internally connected, so as long as one or the other is soldered it should work.

      That said, tacking it down makes for a cleaner layout and will have some thermal benefits (but heat isn't really an issue in the intended implementation). What I do is put the three pins through until they bottom out and bent the BT134 over to the pad, turn the board over and press down while soldering through the hole. I like to "bounce" the pcb while heating (applying more and less pressure alternately) so that when everything gets up to temperature I can see the solder wicking in and pushing out as it bounces. This assures me that I don't get a cold joint.

      Hope this helps, let me know if it's not clear.

      Delete
  10. Is there a way to sense which relay is active or not from the PI?

    ReplyDelete
  11. Thanks for sharing the article. Your post means a lot to me.

    Heating and Air Conditioning Burlington

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Thank you for the tutorial and making the board.
    I am looking to make a connected doorbell, where if conditions are met, the doorbell does not ring and I get a notification on my phone. The doorbell operates at 16v. Would your board work with 16v? Thanks

    ReplyDelete
  14. That was such an appreciable act. Thanks for sharing your work.

    Heating and Air Conditioning Thornhill

    ReplyDelete
  15. Thanks for sharing the circuit for thermostat. I will make this as a reference.

    Heating and Cooling York

    ReplyDelete
  16. Hey I ordered one of these a couple weeks ago. Just wondering when you will be able to ship it.

    ReplyDelete
    Replies
    1. Putting together orders this weekend, sorry for the delay.

      Delete
  17. تنظيف مكيفات بالرياض

    ظلت دائما اجهزه تكييف الهواء هي من اهم العوامل التي تقدم المساعده والعون االي الانسان حيث انها تدعمه علي تحمل تقلبات الجو سواء الحراره العاليه او الحراره المنخفضة ، وان رفاهيه الانسان تعتمد بشكل كبير علي مكيفات الهواء وكل ذلك يعتمد علي حالة مكيف الهواء لديكم حيث انه من الواجب دائما عمل صيانة وتنظيف بشكل مستمر لمكيفات الهوات الهواء فان ادائها يعتمد بشكل كبير علي ذلك حيث انها من الممكن مع عدم صيانتها وتنظيفها بشكل منتظم ان تؤدي الي عطلها ان وانهياراها تماما ، فيما يلي بعض النصائح الهامة حول كيفية الرعاية بمكيف الهواء الخاص بك …
    تنظيف مكيفات
    - اذا كنت تعيش بمنطقة قريبة بشكل كبير من المناطق الصناعية ، فيجب عليك الاهتمام بشكل كبير بتنظيف المكيفات بشكل مستمر وعلي فترات متقاربة اكثر من اي منطقة سكنيه اخري فيجب عليك دائما الاستعانة بـ شركة تنظيف مكيفات بالرياض
    للقيام عملية الصيانة والتنظيف الدورية بالنيابة عنك ، او اذا كانت لديك الخبره الكافية بذلك فمن الممكن عمل الصيانة بنفسك غير ذلك قد تكون حالة المكيف لديك علي المحك لذلم فانت دائما تحتاج الي تنظيف المكيفات بالرياض .
    شركة تنظيف مكيفات
    - اذا كنت من هواه مقتني الحيوانات الاليفة مثل القطط او الكلاب او غيرها من الحيوانات الاليفة فذلك من اهم الاسباب التي تحتم عليك العناية جيدا بنظافة المكيفات بالرياض بشكل دائم ومستمر فان الفراء الناتج من هذه الحيوانات دائما ما يتحد مع ذرات الغبار والتي تعمل علي انسداد وتضييق فتحات الفلاتر والغاز الخاص بالفريون داخل المكيف مما قد يؤدي مع الوقت الي تلف المكيف فلذلك فان تنظيف مكيفات بالرياض هوا من اهم العوامل الاساسية التي تحافظ دائما علي عمر مكيف الهواء لديكم .

    ReplyDelete
  18. Hey I ordered one of these a couple weeks ago. Just wondering when you will be able to ship it.

    ReplyDelete
    Replies
    1. I apologise for the delay. I am planning on working on these this week. You should receive a shipping notification within the next few days.

      I have been doing this in my free time for several years now, and it's beginning to get unsustainable with the amount of time I spend on it. I am looking for possibilities of partnering with others who have the ability to produce the boards more efficiently, but in the meantime​ I am left assembling them myself.

      My point in telling you this is not to excuse the delayed response, but rather to inform you that I am aware of the problem and looking for a long term solution.

      Delete
  19. Hello, I'm very glad I found your website, exactly what I was looking for. I've ordered a board from you on March 28th, but didn't get any reply and no follow up invoice to cover international shipping costs.. Could you please give an estimate on when you be able to ship it? I also liked the idea, from one of the comments, to have an onboard voltage regulator, to power up raspberry pi. Thanks

    ReplyDelete
  20. Once installed, the life of the bulb is usually considered to be one to two years. At a minimum the bulb should be cleaned on a regular basis in order to maintain effectiveness. The lamp should not be illuminated when servicing or cleaning. cooling and heating

    ReplyDelete