Problems with 4n35 & 12V relay

Hi all,
I am building an Arduino based PID controller. I had a LED simulating the output of the PID controller, which was working great, so I was moving onto the next part, which was getting the arduino to turn a relay on & off with the PID pulses.
I had a 12V DC relay and 12V DC power supply laying about, so I decided to use a 4n25 optoisolator between the relay and the Arduino.

So I connected the Arduino digital output pin to pin 1 of the 4n35, pin 2 of 4n35 went to GND via a 200 ohm resistor. I then connected one side of the relay input to +12V DC while the other side of the relay input went to pin 5 of the 4n35 (Collector). Pin 4 of 4n35 (emitter) is connected to the GND of the 12VDC supply.

It was not working :~

So I removed the relay & 12V DC power supply, and connected arduinos 5v dc supply to the collector (pin 5) of 4n35. I then connected a led between the emitter (pin 4) of 4n35 and GND.
The led works, but very faintly.

For some reason it is not working & I cannot figure out why.....

Please I need help!

Opto isolators are not designed to sink the amount of current required by a relay. The usual approach is to power the relay from the same power source as the mcu (e.g. the +5v supply, or whatever supply is being used to power the Vin pin), and use an NPN transistor to switch the relay.

No reason a 12V relay can't be used, @dc42 is correct though, the output transistor in the opto-isolator likely won't handle the current needed by the relay coil. In fact, I might check the opto, very possible its output transistor is fried. You didn't state what the current requirements of the relay coil are, but I might look at having the opto drive a power transistor or MOSFET, and have that in turn drive the relay.

I know this topic is kinda old, but I don't want to start a new just to ask a simple question.

So my question is:
I have this 4N35 and want to know how many Amps can I get from the output side with a 12V DC supply? Does the current on the input side matter? I have a 470 Ohm resistor in the input side and I get (5 - 1.2 / 470) = 0.008A (ideally)

P.S.
I'm trying to operate a 12V DC Water pump (500mA, P = 11.5W), I've connected the output from the 4N35 to the base of a TIP121. The pump works and pushes the rated amount of water but the TIP121 gets really hot (you can touch for a couple of seconds). I operate it for 1minute max every 6minutes. Is it normal for the TIP121 to get that hot? I have no heat sink on it.
I'm an electronics noob... 8)

I dont have access to the dataheet right now but from memory a 4N35 will deliver about as much output current as you put in. 12v @ 500mA is 6W not 11.5W. Darlingtons such as tip121 have high saturation voltage so they run hot when passing significant amounts of current. You can try reducing the 470 to 220 ohms but I doubt it will help much. Either use a heatsink or use a mosfet with gate pulldown resistor instead of the tip121.

dc42:
I dont have access to the dataheet right now but from memory a 4N35 will deliver about as much output current as you put in. 12v @ 500mA is 6W not 11.5W. Darlingtons such as tip121 have high saturation voltage so they run hot when passing significant amounts of current. You can try reducing the 470 to 220 ohms but I doubt it will help much. Either use a heatsink or use a mosfet with gate pulldown resistor instead of the tip121.

Thanks for replying!

I've linked the datasheet on my previous post.. here it is again: link :wink:

Then the DC water pump should be about 960mA? Well the seller had 500mA on the website and the motor has p = 11.5W printed on it. I didn't bother to check the math.

What resistor value should I use on the 4n35 output that goes to the TIP121 base? Currently there's a 220ohm. I'm really a noob with electronics. :sweat_smile: Do I want saturation? If so, how to achieve it?

I assume you are driving the 4n35 output and that resistor from the 12v supply. 220 ohms is ok but could dissipate as much as 0.5W if the 4n35 were to turn on fully. I suggest 1k. See my previous response for further advice.

dc42:
I assume you are driving the 4n35 output and that resistor from the 12v supply. 220 ohms is ok but could dissipate as much as 0.5W if the 4n35 were to turn on fully. I suggest 1k. See my previous response for further advice.

Yes, the same supply goes through the 4n35 output and through the TIP-121 Collector-Emitter.

Ps im assuming the resistor is in series with the 4n35 output eg between the 4n35 and the base of the transistor. That's where it should be.

dc42:
Ps im assuming the resistor is in series with the 4n35 output eg between the 4n35 and the base of the transistor. That's where it should be.

Yes, between pin 4 (emitter) and the base of the transistor.

Don't know if this diagram helps. Don't mind the part labels, this program didn't have the parts I used.

4N25 is actually 4N35
The D-NPN is the TIP-121
The motor is the load
On the left is the Arduino input (5V)
Top the 12V supply.


circuit by Petsoukos, on Flickr

For one thing, you're using that transistor, a Darlington, as a "pass transistor" - that's emitter follower a/k/a common collector.
IMO, not what you want.
The motor should be placed between +V and collector, that way it gets a path to Ground through the collector, common emitter configuration.

[You should also place a flyback diode across the motor.]

I agree with RP's advice. Follow it and the transistor will get less hot. The flyback diode is essential in the common emitter configuration, without it you will damage the transistor.

Hey thanks for all the answers, how do you go about connecting a flyback diode? Anode of the diode to the negative terminal and cathode to positive terminal of the motor ? And what kind of diode should I use?

petsoukos:
How do you go about connecting a flyback diode? Anode of the diode to the negative terminal and cathode to positive terminal of the motor?

Yes, you have that right.

petsoukos:
And what kind of diode should I use?

A "standard rectifier", any 1N4000-series diode, will work.
Better would be a Schottky diode (with a reverse voltage, PIV, > motor voltage), but that's more for performance considerations, not essential [IMO] for your application.

The flyback diode should have a peak current rating at least as high as the stall current of the motor and a voltage rating at least as high as the maximum supply voltage. If you are not using pwm then there is no point choosing anything more expensive than a cheap rectifier diode that meets these specs.