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.

problem in switching relay with at89c52

Status
Not open for further replies.

pds333

Newbie level 5
Joined
Mar 24, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,335
Hi,

I am new to 8051 and want to use relay for switching light and 24VDC motor. When I switch on the circuit relay started automatically some times. Here is my circuit.

https://obrazki.elektroda.pl/75_1269424086.jpg

Resistors - 10K, Transistor - bc547, diode - 1n4007
 

almost in 1 or 2 second the top most relay is getting on and after some seconds it will go off.
 

source code is in C. I am giving input from switch on port 0. When I am not giving 230V and 24V DC supply in contact of relay, then circuit is working fine. But with load in contact of relay, It is behaving randomly.
 

no complete isolation will result micro controller hang.

Added after 2 minutes:

you have to change your circuit you should use optocoupler instead transistor.
 

yes we can change the circuit, as I have another problem with this circuit.
 

This is due to all the pins going high for the duration of the power up reset period, this will also happen with a soft reset. This a is a very common problem. There are a couple of solutions, one is to use an RC delay on the base of the driver transistor. A better way is to use inverted or active low logic, you will need a couple of transistors and a few resistors, or you can use part of a ULN2003A darlington driver as follows.

Pin 8 to ground
Pin 9 to 24v
Connect 10K resistor from pin 1 to 5V
Connect 10K resistor from pin 16 to 24V
Connect pin 2 to pin 16
Input from MCU is to pin 1
Output to relay is pin 15, other side of relay to 24v

A logic 0 will then switch on the relay, a logic 1 will switch it off.

There are enough drivers in the chip to operate another two relays using this method, or you could use a ULN2803A to drive 4 relays etc from 4 inputs. You may not need the 10k to 5v unless you are using open drain outputs, probably good practice to include it though. All you are doing with this method is using the first darlington as an invertor to drive the next darlington. Hope this helps in some way.
 

i think EMI(electrmagnetic induction) cause by relay will hang micro controller ,use active low as in diagram your problem will finish ,you don't need 24 volt relay in this circuit,choice is yours frend .
 

This circuit is ok for ac, but not for dc. You can of course use an opto (darlington better) if the output transistor can take the current of the relay, you would need resistor for input and a diode across the coil. An opto isolated dc solid state relay would be a good option, but a little more expensive. You can of course use this in either active low or high configuation.
 

Now I have used PNP instead of NPN transistor to make my circuit active low. But it is not workig. Can anyone help me how to control relay of 12V using active low configuration?
 

Use 2 transistors .. see attached picture ..

Rgds,
IanP
:D
 

Thanks, it's working. Is there any IC to replace these two transistor?
 

ULN2003/2803 as descibed in my earlier post. Or opto. Or Opto DC Relay. Many choices.
 

Hello everyone,

Now I face another problem in my circuit. I have replaced 24V relay with 12V. I am using these relay for giving voltage to 24VDC actuator. power rating of this actuator is max 4.6 amp 50W. If I don't connect actuator to relay then my circuit is working very fine. But when I connect actuator to my circuit then after giving input 2-3 times circuit stopped working with unknown behavior.
 

I can't use opto coupler in my circuit. I want to know the reason of this behavior.
 

This is electrical switching noise picked up by your circuit. Common causes are poor layout, ground loops etc. You must make sure that all you grounds are back to a common point and not looped. Also fit supressors across coils/relays VDRs or diodes etc will do. Not always an easy task trying to drive high power loads from logic, good luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top