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.

how to connect relay with microcontroller?

Status
Not open for further replies.
hello alexan_e sir,,
wont you think that it would be better if we drive the relays using a driver ic, bcz when I used it once (12V input and 220V(7A) output relay) because of the "no isolation" between the uC and the relay, my controller was getting damaged.. so I used a driver for it like uln2003...
what say sir??
rectify me If i am wrong..

regards..
 

sorry nataraj,,,ia m little late in this thread..,,,as alex say that output from transistor will be 4.3 v which is not capable of driving relay...so u can use a uln 2803 between transistor and relay.give ur microcontroller output to uln2803 which will in turn drive your relay
 

hello alexan_e sir,,
wont you think that it would be better if we drive the relays using a driver ic, bcz when I used it once (12V input and 220V(7A) output relay) because of the "no isolation" between the uC and the relay, my controller was getting damaged.. so I used a driver for it like uln2003...
what say sir??
rectify me If i am wrong..

regards..

I never had such a problem, I don't see a way for the mcu to get damaged (unless the transistor is damaged but the base resistor would still protect it), I have only heard of reset problems when switching high loads.
A diode should be connected across the relay coil to protect the transistor.

**broken link removed**

Alex
 
in my case, controller was getting hang, nothing was working afterwards....so I tried with using a driver ic...
but then also (as the load was high) controller was getting hang...
only after repowering the whole embedded device (even the reset was not working), the circuit worked.....
I am still on with this problem...one of my controller is not getting burned(thats why I said about damaging of controller...)
Kindly provide me with a solution...


regards,,
 

I'm using AVR and I think they are more tolerant somehow of that effect, I heard of hanging problem many times for PIC.
Obviously the power supply design can also contribute to the problem.

Alex
 

alex sir,
I made a project for controlling the electricity of my house(three rooms) through serial communication,
so I pulled off the wire from the "mcb"s and connected to my circuit(the 7A relays),, though maintaining the load i.e. fan and tubelight at a time only so that
150/220V= 0.69A and a tube light 40W, .20 A of current.... but the relay was not bearing this much of current even .. and I dont know wat happens next i.e current spikes or watever,,resulting my controller get hang..
I was using 8051 series of controller (89s52),, only one time switching was possible and that too was from high to low i.e. switching off the room supply
if I tried to make it high again then it gets hang...

so what you say sir,
one cant make such system for this sort of work??
is it very hard to make such system because of the maintaining of the power supply, current spikes, reverse current etc...??
or one should go for plc????

regards...
 

only one time switching was possible and that too was from high to low i.e. switching off the room supply
if I tried to make it high again then it gets hang...

sorry to interrupt but i wanted to know what type of relay were you using? "single pole normally open" or "single pole normally closed" or "single pole changeover relay" ?
and did you check the "voltage between control pin of 89c52 with ref ground" and the relay driver? i mean was it staying at a same state when you tried to switch on and off?
I think the controller might be changing its output pin voltage but problem might be in the relay driver section...
pls check this if you haven't... i think maybe the controller doesn't get hanged...
do everything you said plus after the circuit gets hanged check the controller pin voltage state by meter and see if it changes when you try to perform switching action..
 
@hussainb
1.relay is single pole normally open type..
2.when i checked voltages of the controller pins which are connected to the driver ic, it showed the interdeterminate value (1.8-2.6V--roughly),,, ..
for debugging purposes I had put a led that blinks forever so that I know if the controller is working or not...(controlling of the appliances was through the serial interrupts),
so when the "system" hangs, the led also shows anamolous behaviour, sometimes it remained high or low...i mean, I dont know what it was.. so that means (may be) the controller is also getting hang..??

and I will definitely going to check the voltages of the controller and the relay pins when this problem occurs...
("will"--bcz. my semester exams are going on..lolzz I need to get passs)

and I was also thinking to place a capacitor at the power pin of controller but if the ac spike comes then there is no use of it.(rectify me if I am wrong...I am weak in basic electronics too..)....
 

I never had such a problem, I don't see a way for the mcu to get damaged (unless the transistor is damaged but the base resistor would still protect it), I have only heard of reset problems when switching high loads.
A diode should be connected across the relay coil to protect the transistor.

**broken link removed**

Alex

Hi Alex,

Some question here....in the circuit that you shown ....In which ....will not still have isolation with realy coil voltage and MCU pin voltage level ?....Second is it good to make transistor on with 5v at it meight draw lot of base current in this case ? ....are any thing like potential devider we need to keep before giving MCU control to base transistor?.....are you encounter any problem with current driving capacity of MCU ?
 

The schematic is shown Relays

The transistor base current in controlled with the base resistor, depending on input voltage you set the size of this resistor for the appropriate current, the input can be 3-5-10v , it doesn't matter.
You can use a pull down resistor if you want from the base to the emitter to make sure that the transistor will be off if the input (for any reason) is floating or during power up.
The diode will take care the spikes of the coil and the base resistor should provide any needed isolation.

Alex
 
RELAYDRIVER.gif

heres a schematic for you........
 

Hi Sheldonstv,

What is purpose of diode....is it free wheeling diode application ?....

Yes, it is the same as the previous schematic with the addition of a led across the relay coil and a pull down resistor in the base of the transistor

Alex
 

I have used ordinary SPDT relays working at 12 V driven by ULN 2803 successfully (though I needed only one darlington from the 8 available on ULN 2803. If possible please try this, there are reasons how this may behave differently from a stand alone transistor.
Another important thing is that I took care to mount the relay physically away from the rest of the circuitry and taken care to see that live and neutral wires of the AC mains remain far away from rest. This information may help you to arrive at a workable solution in your case.

A different issue:

Tina 7 software does not have many components like LCD display and their foot prints. Is there any way to import those !

A Raoof Khan
 
Last edited:

It may be better to go for low power relay coils like reed relays or the 100mW-180mW /12V GQ series than using a transistor driver which has a possibility of base-collector shorting .
The contacts of the reed are No types and currents in coils could be 2-4mA max..
The isolation is glass encased ..
 

use ULN2803(IC) between microcontroller and relay.You are able to connect 7 relays by using this IC.;-)
 

Use an Motor Driver (IC-293D or 298) instead...transistors and relay switching issues will be eliminated...
The driver ic's are the best suit for ROBOTS :) because its got high switching speeds and reliable :)
Checkout the datasheets for more info..

Hope this helps you out...


Regards,
Santosh kumar
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top