How to drive relays? - Page 1
Forum section: electronics / projects

author: s57aw
author_rank: Newbie
timestamp: December 18, 2013, 10:27:06 am
content: Today, 06:34 AMHello guys,I am quite newbie in electronic and more or less self-taught in this area.I would be happy if you take a look into these schematics with Arduino:http://remoteqth.com/hw/band_decoder_sch.pngI have project completed and digital outputs from Arduino send signal through resistor and led diode, optocoupler and NPN transistor.There are 12 open collector outputs and I want to drive 12v relays (about 30ma, 360 ohm coil resistance) on the SV2 outputs.I have applied +12v to the relay, put diode over coil and connected specific output to other side of the coil but relay doesn't switch, I got only appropriate led diode on but it looks no output for the relay.What I am missing - appreciate your suggestions. What about pin 13 on the SV2 output, should it be connected somewhere?Regards,Robert

author: Rerouter
author_rank: Super Contributor
timestamp: December 18, 2013, 10:37:31 am
content: the optocoupler is only there for isolation (odd considering your using relays anyway)you need to connect pin 13 to ground, what those outputs do is pull pins 1-12 to ground, so one side of your relays connects to 12V, the other to the pin of ther output your using,

author: s57aw
author_rank: Newbie
timestamp: December 18, 2013, 10:48:29 am
content: Thanks,Yes, optocuplers are for isolation only.I was not sure as schematics tells notning about it, pin 13 it is floating now and probably that's the reason why I get no current throught. Will try thatRobert

author: zapta
author_rank: Super Contributor
timestamp: December 18, 2013, 04:02:52 pm
content: 1. How do you connect the relays? The diodes seems to be parallel to the driving transistor, not the relay coil.2. Make sure you push enough current into the optcoupler led (measure the voltage on the series resistor and compute the current), typically it is just a resistor and optocoupler diode, you have a second led in series.3. If you use relays, why opto couplers? Is it to isolate the serial port? How about isolating it instead (less wires).

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: December 18, 2013, 04:13:23 pm
content: You might look at a ULN2803. It's an 8 channel relay driver, incorporating the transistor, base resistor and protection diode for each channel. They'll handle 30 volts or more and a few hundred mA per channel. It's a bargain at less than a buck.

author: minime72706
author_rank: Frequent Contributor
timestamp: December 18, 2013, 04:53:42 pm
content: What color are your indicator LEDs? If they're anything other than red or yellow or amber, you may be losing too much voltage to make the optocoupler happy.Also, as other people have basically said, the combination of optocupler, switching transistor, and relay is redundant. Yes you need a transistor to effectively and safely drive the relay, but the relay (plus the diode across the coil) is enough isolation.

author: s57aw
author_rank: Newbie
timestamp: December 18, 2013, 06:59:15 pm
content: Thanks a lot guys,Well, I have purchased and built the kit base on publish schematics:http://remoteqth.com/hw/band_decoder_sch.pngThis is "Band decoder" for radio transmitter (TRX). TRX is connected to Arduino with serial cable (only TX, RX and GND is needed). Arduino reads frequency information from the TRX and based on it puts signal to one of the 12 outputs. I need a relay at the output to drive an antenna switch (switching different antennas for different frequencies).Arduino needs +5v and I would like to use 12v relays at the output. This is not an issue itself, I supply 12v to the board and output relays and using a simple DC voltage regulator from 12 to 5V for Arduino. I don't have two separate PSU, ground is the same and sources are not isolated in current configuration.Anyway, I didn't change anything, all soldered on PCB as per schematics and I have only connected PIN 13 to the same ground for test and relays are working now, but... I would do it again I would use another - simpler approach.I still don't understand kit schematics / author completely - really why the combination of optocoupler, switching transistor, and relay, it looks redundant. I know I need a transistor to effectively and safely drive the relay, but the relay (plus the diode across the coil) would be enough for isolation I think, why optocupler? And why there is a diode across NPN transistor (I am using another diode over relay coil).Robert

author: s57aw
author_rank: Newbie
timestamp: December 18, 2013, 07:02:44 pm
content: Hi,well LEDs are green and it looks there is still enough voltage for optocupler. But 2k5 resistor looks a bit too high, leds are barely visible when turned on.Quote from: minime72706 on December 18, 2013, 04:53:42 pm

author: minime72706
author_rank: Frequent Contributor
timestamp: December 18, 2013, 07:08:24 pm
content: Quote from: s57aw on December 18, 2013, 06:59:15 pmYou're right about things seeming redundant ...Quote from: s57aw on December 18, 2013, 07:02:44 pmCan you measure the current through the LED and optocoupler (also an LED)?

author: Kremmen
author_rank: Super Contributor
timestamp: December 19, 2013, 08:48:03 am
content: Quote from: s57aw on December 18, 2013, 06:59:15 pmMe neither... Just drop the superfluous optos. A small fet like 2n7002 or any small BJT such as the jellybean BC547 or 2n2222 will drive the relays. Or use an ULN chip as someone suggested. It is a pity the relays are not visible, the freewheeling diode should be placed close to the relay coil to avoid a long EMI current loop.BTW you can put the indicator led in parallel with the coil. That way you don't need to load the MCU output and will get as bright leds as you wish.