About relays?

Hi, i want to make arduino control a 12v motor, but i want it to rotate left and right, i wanna make it with 2 5v relays. Here is the diagram, i draw it, and "relé" is relay in portuguese. Those arrows are diodes. direct link: http://s4.postimage.org/945iwwpox/001.png So, my question is, will it work and be safe? The relays are 5v so the High signal from arduino should turn it on right? But there's that reverse current on the relay, will those diodes protect the arduino from this? If don't, how should i make the circuit? Thanks, sorry if my english is bad :s The portuguese forum is too inactive

Cesar_BRX: The portuguese forum is too inactive

I did reply to this very question there...

bubulindo: I did reply to this very question there...

I Know but just want to see what people here answer :)

I have a bit more time now...

Here's a schematic and a complete thread about it.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196698219/15

How much current do the relays need to activate?

@Cesar_BRX

I check your schematic, so you are using 1 SPDT 5 V relay, to control a 12 V motor. The motor is it going CW or CCW ? ( clock wise or counter clock wise ) If it just CC & CCW, and no stoping, well a DPDT relay will work better. OR you want CC & CCW and Stop/Go, you need 1 SPDT relay ( stop/go ) and 1 DPDT relay ( CC & CCW ) and check the link to how to connect the relay properly.

Unless they are very small relays, you'll need a driver circuit. Those diodes will not rally protect the Arduino. This is the way it's usually done:

http://www.flickr.com/photos/anachrocomputer/3242387876/

If you've got lots of relays (up to 8), it may be easier to use a driver chip like the ULN2803.

Also note that, with the two single-pole relays that you've shown, it's very easy for the power supply to be shorted. A software bug or startup glitch could do it. better to use a double-pole double-throw (DPDT) relay cross-connected to reverse the polarity, and a single-pole relay to switch on or off. That way, it can't short.

Cesar_BRX: Hi, i want to make arduino control a 12v motor, but i want it to rotate left and right, i wanna make it with 2 5v relays. Here is the diagram, i draw it, and "relé" is relay in portuguese. Those arrows are diodes. direct link: http://s4.postimage.org/945iwwpox/001.png So, my question is, will it work and be safe? The relays are 5v so the High signal from arduino should turn it on right? But there's that reverse current on the relay, will those diodes protect the arduino from this? If don't, how should i make the circuit? Thanks, sorry if my english is bad :s The portuguese forum is too inactive

No it won't work, it will destroy the diodes and the Arduino.

The diodes must be back-to-back with the relay windings (in parallel and connected cathode to positive end). They are needed because if you don't provide a path for the current when switching the relay off it will generate a very high voltage and fry all the semiconductors connected to it. This is because inductors (coils) don't like the current changing fast and will dump all their magnetic energy into the circuit to prevent this.

Look at the guides for connecting a relay to the Arduino and make sure the diode is in the right place.

Also what is the current rating for the relay coils? If more than 30mA then again it won't work and you risk destroying the Arduino as Arduino pins can only source and sink 30mA or so without overloading.

You need to make sure the relay contacts can handle the current the motors take at start up (many times the idle current) or they may weld together.

You ask about safety, learn about Solid State Relays.

MarkT, Thanks now i really understand how it works with your explanation, it's better to know you can't do something when you know WHY you can't do it. So, thanks. Anachrocomputer, this relay tou talked is like this? http://www.techitoutuk.com/knowledge/electronics/symbols/relaydpdt.gif I made some experiments on proteus isis, and it looks really nice, much more simple. And just 1 relay with this one ? The on/off i made with a transistor like this: http://s4.postimage.org/9quiecnwx/001.jpg Unfortunately I already bought the relays, but just to know. Is there a problem with the on/off part? , because the high or low sing from arduino is 3,3v-5v and on the collector-emitter is 12v. Is there a problem with that? Also i don't know exactaly the coil thing, that's what is written on the relay: Model: fangke JQC-3F(T73) Cont:10A 120vac Coil:5vdc i'm pretty sure it can handle.

Pretty bad translations in the datasheet. “Small-scaly power hit the electromagnetic relay”.

The datasheet says that the coil resistance is 70 ohms, so you need 5V / 70ohms = 71 milliamps to switch it. The Arduino is only capable of sourcing 40ma per pin so that is why you need the transistor.

The DPDT relay you have posted would be the correct relay to use in the future. Your motor power would be connected to the 2nd and 3rd pins on the top, the motor connected to the 2nd and 4th pin on the bottom, and the 3rd pin connected to the 4th and 5th pin connected to the 2nd (the “cross” Anachro mentioned). This probably won’t make sense unless you draw a diagram and think it out.

Sorry, the link you gave to a .gif image failed, with a routing error.

The JPEG image is OK, but it shows that you've got the 12V transistor's emitter and collector reversed. Also, you'll need resistors in the base connections of both transistors (otherwise, you may damage the transistors).

Remember to connect the ground from the 12V power supply to the ground of the Arduino!

The Arduino is only capable of sourcing 40ma per pin so that is why you need the transistor.

Just to be clear, the arduino's output pins can deliver more current than this but in doing so it will damage the chip. So you must take measures to keep the current below 40mA. Some people mistakenly believe that the arduino can supply 40mA and has a circuit that limits the current to that.

Sorry i forgot to drew the resistors, i already know that. How do you mean that the 12v transistor is reversed? In Proteus isis, it works with the collector and emmiter, reversed or not, but always NPN, with the arrow pointing to outside. Doesn't matter if the arrow is pointing outside down, or outside up, it works. Is this in real life? or just in Proteus? And the transistor thing, i alredy aksked, but again, in the on/off transistor, doens't matter the base is 5v, and the collector and emmiter are 12v ?

@ Cesar_BRX

Please check this site about properly use transistors. http://www.electronics-tutorials.ws/transistor/tran_4.html

You have a 5 V relay. So connect a +5 at one of the relay coil and the other coil connect to the collector. Don't forget a reverse connect diode ( cathode at 5 V - anode at collector ) and a base resistor about 1 K to 4.7 K.

The 12 V is the motor circuit.

Hope you understand.

doens't matter the base is 5v, and the collector and emmiter are 12v ?

The transistor will stand this. In fact the emitter is at 0V not 12V.

Cesar_BRX: How do you mean that the 12v transistor is reversed?

Your drawing shows the collector connected to ground and the emitter connected to the relay contacts. This is reversed. The emitter must be connected to ground and the collector to the relay contacts. Emitter is the terminal with the arrow. Conventional current must flow from the positive supply, through the load (motor), through the emitter in the direction of the arrow, to ground.

I think you need to see:- http://www.thebox.myzen.co.uk/Workshop/Motors_1.html and http://www.thebox.myzen.co.uk/Workshop/Motors_2.html