Pages: [1] 2   Go Down
Author Topic: Problems with 4n35 & 12V relay  (Read 4647 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-confuse

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!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 20, 2011, 02:19:44 pm by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4086
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...  smiley-cool
Logged

Take care now, bye bye then!

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-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.  smiley-sweat Do I want saturation? If so, how to achieve it?
Logged

Take care now, bye bye then!

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Take care now, bye bye then!

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Take care now, bye bye then!

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Take care now, bye bye then!

Offline Offline
Faraday Member
**
Karma: 65
Posts: 2529
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.]
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 18, 2012, 01:08:27 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Greece
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Take care now, bye bye then!

Offline Offline
Faraday Member
**
Karma: 65
Posts: 2529
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Pages: [1] 2   Go Up
Jump to: