Mains AC Relay Module

This mains AC Relay module uses a 5V relays that can run straight off the Arduino and switch 230V, following the circuit on the arduino website here: relays.pdf

Component list

1x 5V Relay

1x 2N2222 transistor

1x 1N4004 diode

1x 10k resistor

Circuit Schematic

 

Software

Arduino Sketch 

 

synergie7's picture

Re: Mains AC Relay Module

Hi,

I've built my own (very simple) evergy monitoring and control system (using Arduino 2009), using off the shelf wireless remote control sockets, and power meter LED pulse detection.

I have tested with these http://www.amazon.co.uk/REMOTE-CONTROL-MAINS-WIRELESS-SOCKET/dp/B001SQ8VTM/ and also Watts Clever.

Its not a perfect solution as all sockets suffer from random turn on / turn off , (Watts Clever has several reports of this issue), but it removes the need for wiring mains voltages. ;-)

 

BTW. I also have a 4 channel relay unit (eBay $10), which has optoisolators etc and works really well. I think its cheaper and easier just to buy these modules than to buy individual components and build it ;-(

 

Dave's picture

Re: Mains AC Relay Module

I'm sort of following in your footsteps. I have an Arduino measuring my mains usage for the whole house running a small web server using a Wishield. I blatantly stole your code for the code measurement (thanks for your help with this) and am using Pachube to create basic graphs on the web.

My experience with mains power is pretty high here in the US with our split phase 220 and your relay example may give you a bit of trouble. What I've done for an electric water heater is a 5 volt relay switching a 24 volt supply to a 40 Amp contactor. 24 volt contactors are widely available for use on air conditioning and 24 volt transformers are easy to find for this reason as well as some doorbells. The currents you're going to be working with need BIG contacts and high reliability contactors or you'll be surprised by a failure in the middle of the night.

I recommend a 24 VAC transformer and contactor between the mains and your 5 VDC relay. It's simple enough and will protect your circuitry as well as give you the ability to put the Arduino in a reasonable location.

My plan over the next few months is to implement load shedding based on kW usage of power. So if my usage exceeds some preset number, say 4 kW, I'll start shutting stuff off at the mains distribution panel. Since I live in the desert, the air conditioning is a prime candidate.

dave

TrystanLea's picture

Re: Mains AC Relay Module

 Thanks for the info Dave, so far I only use it to switch a max 100W solar PV pump, so far within its limits :) Good to hear you've used the code with your system, nice blog too! Im certainly interested in knowing what is possible with load shedding,  keep me posted.  

Thanks, Trystan

Dave's picture

Re: Mains AC Relay Module

Yes, I'm still at it. I've postponed load shedding for a couple of months to implement the most complicated air conditioning control system in the world. After a few months of watching power like a hawk (many more thanks for your help), it seems my biggest offenders are my two A/C units. If they turn on at the same time it pushes my demand usage through the roof. Additionally, I need to carefully control them during 'Peak' billing periods. So, money won out and I'm attacking them first.

Meanwhile I combined an LCD display, a 3 color LED, Wishield and Arduino to build a central display device. I used the Alan Meany's visual feedback idea for power display that you link to as a quick read of the relative power level and adjust the parameters based on the billing period. This thing even hits the web for NIST based time so I have a home time standard. Looks like crap, but works really well. I'll have to address some kind of enclosure over the next week or two to pretty it up.

The plan for the A/C is to make somewhat intelligent controllers that are web enabled so they can talk to each other and the power monitor. So, if it's during peak period and the power level is already high, wait. That kind of thing. They can even serve back information telling me if they are on, just running the recirculation fan, heating, cooling, etc.

Don't you just love web enabled microcontrollers?

TrystanLea's picture

Re: Mains AC Relay Module

That sounds like a really nice project, would like to try some smart control stuff myself at some point, going to start with the water heating I think. Like you say it is amazing what you can do with web enabled microcontrollers, enjoying at the moment aggregating data from my energy monitor in my house and my friend energy monitor 5 miles away...

seigel's picture

Re: Mains AC Relay Module

Dave, can you ad a schematic of what you are talking about with the 24V transformer? I don't think I am quite following :D

Dave's picture

Re: Mains AC Relay Module

I certainly would if I knew how to put one here. Basically, an arduino can supply a small amount of current to control things. There are a few relays out there that can be controlled directly with an arduino, but the best way is to use a transistor to control it. This way you have control of a small relay using the arduino. However, to control high current devices hooked to the mains of your home, you need a big relay. Big relays use big power and the arduino just can't handle that. However, the little relay can. So, feed 24 volts AC through the contacts on a little relay controlled by the arduino and then run a contactor (that's the name for a big relay hooked to the mains in the U.S.) with the little relay.

For example, I have a hot water heater that has a 24 VAC contactor (google the word for a picture) to control power to it. This in turn is controlled by a tiny relay (Omron G5V-1) that hooks directly to the arduino digital out pin. These little relays are 30ma at 5VDC, so they will run just fine off the Arduino pins. To supply the 24VAC, I repurposed (as in scavenged from an old air conditioner) a transformer. Here in the U.S. most heaters and air conditioners have these things so it was easy to find one. Some doorbells use them as well and I could have picked one up at a home improvement warehouse.

So, I have a contactor fed by a 110VAC to 24VAC transformer through the contacts of a 5VDC relay controlled by an Arduino. Hope that explanation helps more that hurts.

There are many other ways of doing this kind of thing. There are solid state relays that can do the job and can be run directly from the pins of the arduino, but they cost more than the solution I came up with....and I had the parts laying around from other projects.