Pages: [1]   Go Down
Author Topic: Switching UK mains power 240V AC with Arduino  (Read 8367 times)
0 Members and 1 Guest are viewing this topic.
Brixton, London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all! Please could I get your advice on this ... ?

I would like to control ten anglepoise lamps that I've acquired with my Arduino - specifically, to turn them all on and off independantly, according to a sequence I want to write in my Arduino code. I'm not turning them on and off very fast (perhaps the smallest time period being 1 second?) and all the lamps have energy-saving lightbulbs in, so I'm gussing this amount of switching won't kill the bulbs as much as if they were filament bulbs. Now I think about it, I'd have to warm the bulbs up first, to get them to max brightness! But anyway...

Ideally, I'd like to have my circuit element sitting in between the mains plug and the lamp itself,. So I need to control 240V AC with the arduino's 5V digital output. I've tried to research relays, opto-isolators, SCRs and triacs, but am getting v.confused with all the options out there.

The world of relays seem v.confusing, and I'm not sure the transistor-based output of opto-couplers would work with an alternating voltage (i.e. when the voltage swings negative, won't the transistor block the current?)

What would be the best device to use, then?

Many thanks smiley
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well the simplest device to use is a solid state relay. They can be driven directly by an Arduino output pin and control the switching of AC voltage on it's output.

You need to shop around to find the best price as they are priced according to their AC current capacity and you won't require more then 1 amp if your just switching light bulbs on and off.

Here is an example of a nice deal making them about $5 each including shipping within the US, not that it helps you in the UK  smiley-wink

http://cgi.ebay.com/4-Crydom-Solid-State-Relays_W0QQitemZ200285958603QQihZ010QQcategoryZ36332QQssPageNameZWD1VQQrdZ1QQcmdZViewItemQQ_trksidZp1638Q2em118Q2el1247

Good luck
Lefty
« Last Edit: December 20, 2008, 05:44:45 pm by retrolefty » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could get something like this remote control mains switch from maplin http://www.maplin.co.uk/Module.aspx?ModuleNo=98630&&source=14&doy=20m12

If you open up the transmitter you can probably get the Arudino to close the contacts using an opto-coupler.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need a 12 DC power supply. This can be from the same mains source.

I did this recently like you for the first time (a couple of weeks ago) with a 240v to 12v Transformer, a Bridge rectifier and a 12v Voltage regulator.

I then have a TIP120 power transistor triggered by the arduino which releases the ground pin of the relay coil to ground.

You need to be sure that your transformer is powerful enough for your relay and your relay's consumption largely depends on how much power (Amps) it's going to switch.

I wouldn't use energy saving bulbs under any circumstances for the job you are thinking of. They are not designed to be switched rapidly. They take time to warm up and each time you switch them they draw quite a lot of power initially. Better to stick with incandescent and warm them up first too.

HTH

Jim H
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"If you open up the transmitter you can probably get the Arudino to close the contacts using an opto-coupler. "

Do you think each transmitter is on a unique frequency? He wants to control ten lamps in a timed sequence.
« Last Edit: December 20, 2008, 05:53:24 pm by retrolefty » Logged

Brixton, London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick reply guys smiley

Wow ok I didn't realise its THAT simple with these relays. Great! Except that my usual retailer, rapid electronics, sells these at £9.15 per relay ... ouch!

http://www.rapidonline.com/Electronic-Components/Relays-Solenoids/PCB-Relays/DC-Solid-state-SPST-2A-relay/71046/kw/solid%20state%20relay

Oooh have had a snout around eBayUK, found these:

http://cgi.ebay.co.uk/solid-state-relays-SMT-2000-4-PCB-mount_W0QQitemZ270314141356QQcmdZViewItemQQptZUK_BOI_Electrical_Components_Supplies_ET?hash=item270314141356&_trksid=p3286.c0.m14&_trkparms=72%3A1298|66%3A2|65%3A12|39%3A1|240%3A1318

"Pack of 10 solid state relays SMT 2000 / 4  3 -32vdc operation and will switch up 240vac at 4A" ~£18

Sounds like a bargain! Do I take the specs to mean I need to switch on the relay by applying between 3 and 32 volts DC across the input terminals ... to make some solid-state magic happen* and therby short the two output pins, completing the lamp circuit ...?

Also, the arduino-side of the circuit and the lamp-side of the circuit being isolated, I take it that I definately should not connect arduino ground the my mains supply ground ... ? just checking!

Thanks for your help! smiley

*(http://en.wikipedia.org/wiki/Solid_state_relay I love wikipedia! smiley )
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, those 10 pack are a very good deal. And you connect the input + to the Aurduino output pin the - input to the Aurduino ground (common) and the relay's two output pins go in series with the load's hot wire. And of course you DO NOT hook the AC neutral or ground in anyway to the Aurduino. The solid state relay uses an internal opto-isolator to insure there is no direct connection between control and load.

So don't fool around much longer and pull the trigger on that bargain  smiley-wink

Logged

Brixton, London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

D'oh missed everyone elses replies when posting my own.

Ideally I'd like to keep this simple as possible, to prevent too many things going wrong! Jim H, that seems a lot more complicated than the solid state relay method - what are the pros of using a 12V DC power supply to achieve this?


Hmm whether to use energy-saving bulbs or filament bulbs ... the context for this project is that I'm shooting a music video for a friend, and the 'stage' is going to be a ring of 10 angle poise lamps surrounding the artist, flashing in time with the music (done with a lookup table, nothing fancy with beat-detection just yet!). I'm using anglepoise lamps because each room in my college dorm comes with one as standard - I can easily get hold of about 12 for my use, and they all come with energy-saving bulbs fitted as standard, so it'd be nice to use them, as its free. I'd hate to buy new filament bulbs on top of all this extra hardware. ... perhaps I'll do some tests on the lamp in my own dorm room, switch it about a bit, see how much abuse it can take before I blow up all my friend's lamps! If it *really* doesn't work with these energy saving bulbs I'll bite the bullet and go incandescent.

Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
"If you open up the transmitter you can probably get the Arudino to close the contacts using an opto-coupler. "

Do you think each transmitter is on a unique frequency? He wants to control ten lamps in a timed sequence.

Those AC remote control device send a signal that includes a device address, the one linked is designed to address 12 separate devices.  And the chip it uses actually has 12 bit addressing, so thousands can theoretically be controlled.

But I agree that the Solid State Relay deal seems a good way to go for this project. Just be careful about the 240 volt wiring

Have fun!
Logged

Pages: [1]   Go Up
Jump to: