Help with relay circuit

Hi.

I'm trying to build a circuit to switch a 5v relay that will operate an appliance plugged into the wall, but am having trouble understanding the schematic shown in the playground:

I am using Relay http://us.100y.com.tw/pdf_file/LU-SERIES.pdf (LU-5), transistor BC 548B http://www.philohome.com/sensors/gp2d12/gp2d12-datasheets/bc548.pdf, and have tried a 1k and 2k2 resistor, on the diode it says '1N4004 938'. I'm brand new to electronics so am sure it's something simple that I've missed, but have been trying to make it work for a couple of days now unsuccessfully. It's doing my box in!

I am trying to run the circuit from the blink example (to check i've got the circuit right before worrying about the code), but nothing happens. I've tried various wiring configurations. The relay works fine when all other components are removed, and attached to pin13/gnd or 5v/gnd.

I tried to attach a photo, but just got 'img', so here is my circuit at the moment:

5V-RESISTOR-TRANSISTOR BASE

FROM TRANSISTOR: EMITTER TO GROUND, COLLECTOR-DIODE-RELAY-GROUND

Both transistor and relay are grounded to the GND pin next to 5V on the Arduino.

Help appreciated,

Ben.

5V-RESISTOR-TRANSISTOR BASE

What is controlling the base then? That is permanently on.

COLLECTOR-DIODE-RELAY-GROUND

Wrong,

COLLECTOR-RELAY-VOLTS

with DIODE in parallel with the relay coil.

Is it a 5V relay?


Rob

Hi Rob,

Thanks for the reply. I think I've cracked it (almost). Sometimes it helps to write things down. After I posted, I followed the diagram and code at http://tronixstuff.wordpress.com/2010/04/20/getting-started-with-arduino-chapter-three/ and the program seems to run fine.

Excuse my ignorance, but am not sure what is meant by 'in parallel'.

I had changed the circuit to:

5V-Relay-Diode-Collector(Emitter to GND)-Base-Resistor-Digital Out and it seemed to be working fine.

Should it instead go:

5V-Relay AND Diode-Collector(Emitter to GND)-Base-Resistor-Digital Out? This works fine too. Is this better? In Parallel? Less likely to blow something up?

If so, am I ok to go ahead and attach the Live wire from a three core extension cable to the relay, ignoring the ground and neutral?

Cheers,

Ben.

See also...

And consider....

5V-Relay AND Diode-Collector(Emitter to GND)-Base-Resistor-Digital Out?

That's about right.

Diode anode to + (and 5v) on coil, cathode to - (and collector)

check tkbyd's first link, it shows how to put the diode. There's got to be a 100 threads about this, try search for "snubbing" or "fly back" diode.

am I ok to go ahead and attach the Live wire from a three core extension cable to the relay, ignoring the ground and neutral?

No way I'll advise about mains voltage stuff :slight_smile: but I'm sure there's people here that are qualified to do so.


Rob

My opinion is if you need to ask how to connect mains stuff, you shouldn't be doing it. It doesn't give too many second chances....

That's brilliant, guys. Thank you both. This circuit has been driving me crazy. I'm in England, so will have to have a look to see if I can find one of those power switches to fit a 3 pin 240v socket. Looks just what I need.

Cheers,

Ben.

Ben ------
It is real real really easy if you use a PowerSwitchTail (by Adafruit for $20). Don't hesitate to call me at 951-461-0757.
------ nickynichols

to use the arduino to switch an extension lead connected to 240vac)

The contacts are only rated for 1A at this voltage so an extension lead no, it is possible to plug 13A into it and that would weld the contacts shut or cause a fire. Look for contacts rated at least 20A if you want to switch 13A. It will be a much bigger relay than this.

You shouldn't be messing about with mains if you have to ask these questions.

Don't worry. I'm not a moron. I'm not going to connect the mains until I know what I'm doing. I want to get the components together before I go back to uni and can get a hand from the workshop technician.

How about 16a:

Don't worry. I'm not a moron.

Good! But one never knows who's going to read these posts... after all... half the world is of below average intelligence. And only half the world... 1 in 10... understands binary.

ANYWAY... besides getting the right components, it is also important to get the physical assemblage of them right. Fires start from the most IMPROBABLE things. Probable or not... they happen. Not you you, if you get the right advice!

(This posted not just for bngllghr, but for the many, we hope, people who will visit the thread in the future)