Using a Picaxe chip to turn mains voltage on and off

djmikeys

New Member
Is there such a component that can safely turn mains voltage on and off using a Pic 08m chip. Is there such a relay reed switch or similar component that can handle these voltages?
 

drummer

New Member
picaxe chips.

Is there such a component that can safely turn mains voltage on and off using a Pic 08m chip. Is there such a relay reed switch or similar component that can handle these voltages?
hello
i know that this might be the wrong site however do you know where picaxe chips can be found in south africa?,as i am battling to get these chips.
i know that i can order them but the exchange rate is a bit steep.
 

BeanieBots

Moderator
There are countless devices which offer isolation between the PICAXE and mains.
The "safely" part is down to you and how you make the connections.
You can use relays, zero-crossing solid state switches and/or opto isolators.
The datasheet for the device will tell you the level of isolation. Typically, it will be several thousand volts which is enough for most events except lightning strikes.
Where it becomes "dangerous" is in how you hook it all up.
For example, I often use those little 1A optically isolated zero-crossing solid state relays that come in a 14pin DIP package.
That means I have the PICAXE and mains on the same PCB.
I usually build my circuits on strip board.
Forget to cut a track, accidentally make a solder bridge and the two are connected together!!!
It's never happened and is never likely to (famous last words) because I have design rules which include double track isolation whith strip board. That makes it impossible for solder bridges and easy to check visually. Always test thouroughly before applying power. Good layout also helps. In the UK, legislation stipulates that mains tracks must be seperated on a PCB by a minimum of 4mm.

For the less experienced, (a novice should not play with mains) I would suggest the use of a socket mounted realy. The socket will have screw terminals. Coil one side, mains contacts the other side. Very easy to keep a large safety margin between high and low voltage sections. Again, legislation determines that the cables shall be fitted with terminal crimps that cannot be removed without complete removal of the securing screw. ie, impossible to "accidentally fall off" and touch something it shouldn't.
 

leftyretro

New Member
Is there such a component that can safely turn mains voltage on and off using a Pic 08m chip. Is there such a relay reed switch or similar component that can handle these voltages?
Yes there are many. First it would be good to know the current or wattage level you wish to control, that effects the type of device to select. Also the mains voltage section should be mounted in it's own secure box and of course fusing is a desirable safety feature.

Lefty
 

djmikeys

New Member
The controlling voltage from the pic is just over 1V running from a 1.5Amp power supply and mains is 250V and 13Amp. I was looking into it quickly and think I might use 3 seperate relays slowly stepping up the voltage that is switched.
Is there a simpler way?
 

BeanieBots

Moderator
There's something you're not telling us!!

Why is your PIC only putting out "just over 1v"?
That will require some sort of amplification because it won't be enough to drive even a simple opt-isolator. You will need at least 2v to drive the LED.

What's with "three relays slowing stepping up the voltage"?
How is that going to work? That would be a VERY complex project. Variable phase angle or burst fire would be easier but that would only ramp the average power. Controlling the AC voltage @ 13A would require a power amp and electronics cabinet about the size of a domestic fridge!

What's wrong with ON and OFF like a light switch?
 

leftyretro

New Member
The controlling voltage from the pic is just over 1V running from a 1.5Amp power supply and mains is 250V and 13Amp. I was looking into it quickly and think I might use 3 seperate relays slowly stepping up the voltage that is switched.
Is there a simpler way?
13amps is a lot of current. I would suggest that a solid state relay rated for 20 amps or better and it would have to be mounted to a heatsink at this power level and of course mounted in a protected box. A solid state relay has no moving contacts so arcing is not a concern.
Controlling this type of relay only requires a 3vdc or higher signal that a pic can drive easily.

Could you just tell us what you are powering with this AC switched voltage and how often it will be turned on or off or how long it will be left on?

PS: Here is a link to a E-bay listing showing typical specifications and a link to a data sheet for the device. Note the heatsink requirements at higher curren levels. http://cgi.ebay.com/Solid-State-Relay-SSR-24-480V-AC-25A_W0QQitemZ230197680985QQihZ013QQcategoryZ78207QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

Lefty
 
Last edited:

kevrus

New Member
To know the actual load bieng switched would be useful for selection of the correct relay/contactor as resistive current ratings for contacts are not equivalent to inductive current ratings, (commonly known as AC1 and AC3 respectively in the UK), i.e. a contact rating of say 16A resistive (heating element) may only be rated at around 10A inductive(motor) ...these figures only an example!
If you are looking to switch something like a table lamp then a triac would suffice with correct opto-isolation although this does bring up the question of safety as previously mentioned.
There's not always a straightforward answer without specific details, and not even then
 

MORA99

Senior Member
A 13A desk fan ?
In some countries usb power save strips are easy to locate, Denmark for one :)

They will allow you to switch up to 1000W@230V without having to build anything with mains yourself.
Yhey are made to be plugged into a usb socket, and when the computer is on it turns on everything connected to it (So speakers, printer, etc. is off when the computer is).
Cut off the usb adater and you have a 5Vdc relay that will switch the 230Vac rated power strip.

google has some images of them
http://www.ubergizmo.com/photos/2006/5/powerbarusb.jpg
http://images.google.com/images?q=usb+power+strip



I have also used a relay board, that was pre assembled, that way you still dont build anything with 230V, but you are still at more risk than the isolated usb solution.
 

BeanieBots

Moderator
Excellent idea MORA99. They are available in the UK as well but not very widespread yet.
Would be much safer and more to the point, LEGAL.
 

Michael 2727

Senior Member
A Desk Fan ! :(
Just use a 3A PCB mount SSR, zero switching.
Jaycar have them here in OZ for $9.00 AUD.

Where did the 13A come from ?
Sure it wasn't 0.13A, 31W ?

Bloody Kids !, there's nothing like getting
the full story in the beginning, Dµh.
 
Last edited:

MORA99

Senior Member
Maybe the 13A is from the connector, which is often rated at 13A, but ofcause that does not say anything about how much the fan uses (Except hopefully below the rated limit).
 

kevrus

New Member
I expect the '13A' came from the 13A plug top that is fitted to the fan.
An induction motor drawing 13A singlephase would probably have around a 2.5 to 3 horsepower rating, the sort of motor you would find on a decent air compressor, my desk fan is only rated at 35W, 0.2A and that moves quite enough air I reckon.
 

moxhamj

New Member
The simple answer is to use a relay as per the interfacing circuits (Help/Manual 3, page 7) and to use a relay rated to this current. It should be possible to do this with one relay but if not, certainly one relay can drive another. I suspect the fan is more like 1A rather than 13A.

But having built lots of these circuits, I would point out that picaxes don't like switching high currents near them. The magnetic field around the wires being switched can get back into a picaxe and reset it. Solutions are to put the picaxe in one box and the relay in another box at least 30cm away and the only two wires between the boxes are the two wires driving the relay coil. This does improve safety as well as there is a "mains" box and a low voltage box. But even then the interference can get back through these wires - sometimes they need to go through a ferrite supression toroid and/or metal shielding on the low voltage box. Another solution is just to accept that the picaxe will reset, and have the picaxe trigger another chip like a 555 which doesn't reset, and then write the code to handle the reset.
 

inglewoodpete

Senior Member
mshorter, If you've lasted through the (well intended) ridicule above, please read on.

Clearly, you are new to PICAXE and new to AC power. While it it would make an interesting project for someone more experienced (and trained in AC power safety), working with the mains supply should not be taken lightly. As a teenager, I took on a mains project and nearly killed myself. Needless to say, it's an experience that really shakes you. I was very lucky but learned that MAINS VOLTAGES ARE LETHAL!

Having got that off my chest, back to your proposed project. A desk fan almost certainly has a shaded pole motor. These do not easily change speeds beyond the switching built into them.

My suggestion is that you start with safer circuits (5v, then possibly 12v switching). Subscribe to an electronics magazine. Attend an evening electronics course at a technical college. Small fans are available in 12v DC versions (Eg car fans), which are a much safer way to learn about PICAXEs and switching.

-Peter
 

Mycroft2152

Senior Member
Well said Pete.

Working with mains voltages can be dangerous. Simple errors can have shocking results (sorry, couldn't resist that one)!

Seeriously, there are a lot of low voltage fans on the market, there are even a few battery powered hand held ones. These would be a safe place to start your PICAXE journey.
 

Ralpht

New Member
I totally and 120% concur with Pete.

I had my brush with 240V mains here in OZ back when I was young and knew everything (except the things I didn't know).

A day and a half later, having spent that time in Hospital with an ECG on me, I left with a few lessons learnt.

1. Mains voltages and not very friendly people.
2. Mains wants to Kill you.
3. Mains voltages herts 50 time a second (sorry for the distorded pun)
4. Mains wants to Kill you.
5. Mains wants to Kill you.

ditto above as often as needed to have it sink in.

Be very , very sure you know what you are doing and even then think about not doing it.

Then get an electrician to do the mains wiring for you. You might then survive the learning curve.
 

Ralpht

New Member
totally and 120% concur with Pete.

I had my brush with 240V mains here in OZ back when I was young and knew everything (except the things I didn't know).

A day and a half later, having spent that time in Hospital with an ECG on me, I left with a few lessons learnt.

1. Mains voltages are not very friendly to people.
2. Mains wants to Kill you.
3. Mains voltages herts 50 time a second (sorry for the distorded pun)
4. Mains wants to Kill you.
5. Mains wants to Kill you.

ditto above as often as needed to have it sink in.

Be very , very sure you know what you are doing and even then think about not doing it.

Then get an electrician to do the mains wiring for you. You might then survive the learning curve.
 
Top