Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] optocoupler + 12v relay

Status
Not open for further replies.

su1c1d4l

Newbie level 6
Newbie level 6
Joined
Feb 18, 2010
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Philippines
Activity points
1,372
im planning to connect the optocoupler + relay to PIC based on this schematic but i will replace the optocoupler with 4n25. will the 330 ohm resistor through pin 1 of the 4n25 be okay? is this schematic correct:
from https://www.mikroe.com/en/books/picbook/7_chapter/14.gif
14.gif
[/img][/url]
 

For connecting a relay you need a driver. A simple npn transistor can be used.

Nandhu
 
in my case, my current circuit is made up of a 330 ohm on the base of c9013 transistor + relay with 1n4001 as protective diode. i have an LCD too. the problem lies when my relay deactivates, it affects the LCD display, resulting in alien like messages to be displayed on the LCD.
 

The cause of lcd malfunction is due to improper / insufficient filtering.

Check out the powersupply section. May need more filtering

Nandhu
 
im using a 7812 for the relay and 7805 for the PIC and LCD. i have a electrolytic coupling caps 2200uF, (is it ok?) on near the vdd of the PIC and LCD. but i get the same result.

EDIT: i have the same power supply for both the relay and the MCU and LCD. is this okay?
 

Do you have a 100n capacitor near the power pins of micro? It is mandatory.

Nandhu
 
  • Like
Reactions: Sindu

    su1c1d4l

    Points: 2
    Helpful Answer Positive Rating

    Sindu

    Points: 2
    Helpful Answer Positive Rating
oops...i dont have... i only have 2200uf caps on the vdd of the pic and lcd. that's what the other guy told me. im going to try putting it.
 

nandhu015 said:
For connecting a relay you need a driver. A simple npn transistor can be used.
4N25 can sink up to 50mA, which may be enough coil current for some of the relays. Check the relay datasheet.

su1c1d4l said:
1n4001 as protective diode
Schottky diodes work better for protection. The diode should be in parallel with the coil, reverse biased (cathode to +12V).
 
if i put the 100nF near the VDD of the PIC, do i need to remove the 2200uF caps i have placed?

Added after 6 minutes:

Schottky diodes work better for protection.

can you give me a specific diodes ideal for this set up ? im not familiar with schottky diodes
 

Your realy does not have a supression diode conected between the collector and the supply of the switching opto isolator. It dumps the energy of the coil back into the power supply as the coil de-energises.
 

su1c1d4l said:
if i put the 100nF near the VDD of the PIC, do i need to remove the 2200uF caps i have placed?
Keep the big capacitor, read the 7805 regulator datasheet the output capacitance requirements are specified there.

su1c1d4l said:
Schottky diodes work better for protection.
can you give me a specific diodes ideal for this set up ? im not familiar with schottky diodes
Try 1N5818, MBR1100. Look into current ratings (constant and peak) for each of these diodes. For a 1st try, probably any Schottky diode with current rating of 1A (or more) would do.
 

HI,
In your case(because the relay has separation between parts of electronics) is a opto coppler not needed, more simple & reliable is to drive the relay with enough massive transistor...
I would change the big capacitors (in 12&5V supplies too) for i.e. 100uF or even 47uf & thightest on PIC-pin14 the sayed 100nF, but on the relay/transistor too!
I believe, that a general silicon diode as 1N4148/4851 is OK (I agree a Schottky is better, speeder, but usual not needed) for relay/transient protections, but the 1N4000 family is too slow!

Check pls for undefined inputs by PIC..

Maybe your GND-current guiding is to change too, PIC & LCD-GNDs is independent from relay/driver to pwr supply to connect.
Good progress!
K.
 
karesz said:
In your case(because the relay has separation between parts of electronics) is a opto coppler not needed...
Good point, K.
It's a question to the O.P.: are you sure that you that the optocoupler is necessary? the relay by itself has galvanic isolation between the coil and the reeds. :|
 

But he dont have time to answer us here because is too busy on hes "parallel topic": opto isolators triac output, even at "microcontrollers"...!:-(
K.
 

How did you go with this?

I have had very similar problems - with symptoms ranging from MCU resets and garbled LCD displays.

The biggest help was when I put a 10uF cap across the regulator output that supplied the 5V to the MCU.

I still have an issue where, if the relay is active, and I remove the plug, the MCU resets.

The spike must be occuring on the ground, or 12V supply (which means that even the optoisolators don't help) - and even a 470uF cap across the 12V and ground hasn't helped. So I really need to - from a single 12V supply, create two very seperate 12V supplies (one to feed the relays, and one to feed the regulator); isolating it completely so spikes don't cause grief.

I saw that maybe placing a diode across the 12V in, and the 5V out on the regulator may help isolate the 12V?
 

all time i use relay more than 5volts,i use ULN2803,you can drive 12,24v,etc and you have a free wheelling diode pin (10),you can parralell output to draw more current(bigger relay),cost only .75 cents.
 

boy, i am surprised.it seems a lot of you guys helped me out. btw, my project turned out ok.thanks for all your help. i havent got the time to reply at that time since the deadline for submission is coming near. Heheh...thanx. found out that the main reason for garbled LCD display is due mostly to improper grounding of my project. silly me. :oops:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top