Go Down

Topic: Problems with 4n35 & 12V relay (Read 4 times) previous topic - next topic

rosscopicotrain

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!

dc42

#1
Sep 20, 2011, 07:51 pm Last Edit: Sep 20, 2011, 09:19 pm by dc42 Reason: 1
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.
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.

Jack Christensen

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.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

petsoukos

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)
Take care now, bye bye then!

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

petsoukos


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 ;)

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?
Take care now, bye bye then!

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

petsoukos


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.
Take care now, bye bye then!

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

petsoukos


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.
Take care now, bye bye then!

petsoukos

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
Take care now, bye bye then!

Runaway Pancake

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.]
"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?"

dc42

#12
Jun 18, 2012, 08:05 am Last Edit: Jun 18, 2012, 08:08 am by dc42 Reason: 1
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.
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.

petsoukos

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?
Take care now, bye bye then!

Runaway Pancake


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.
"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?"

Go Up