• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

8051 to control a relay

Status
Not open for further replies.

abuza8nuqina

New Member
Hi everyone, im a newbie in this electronic world.

My project uses a 12V POWER WINDOW motor. Im using AT89C51 and i'm planning to use a relay as a switch to turn the motor ON and OFF.

I'm also planning to use a relay as a switch to turn a 12V VALVE ON and OFF.

How can i use my AT89C51 to control this relay? And what relay is suitable for this project?

Any related circuit diagram would help a lot. Thanks!
 

Junker_eu

New Member
The circuit what you need is very commonly.You can get it on net easily by google.Had you google it?You should choose the type of relay by the voltage and the current rate of you project.
 

Wond3rboy

Member
A transistor with a diode on the collector should do the trick(keeping it simple).Just turn the transistor On using a Port pin and then Turn it off.
 

kchriste

New Member
Forum Supporter
This is my plan. Will it work?
No. The way you've drawn it, the 12V will be shorted to ground when the motor is off. p9 of the ULN2003 needs to be connected to 12Vdc; put a dot, at the wire junction, on the diagram to show this. p8 of the ULN2003 needs to go to ground. You may, or may not, need a pullup resistor to Vdd on p0.0 depending of the variant of the 8051 that you have.
 
Last edited:

Hayato

Member
I think it's like using a 12 ga. shotgun to kill an ant.

Why use a ULN2003? If you can drive the relay, boosting, the 51 output with some simple circuitry?

ccurtis, indeed, Youwang Electronics...
 

colin mac

New Member
The 8051 has internal pullup resistors that limit the output current to something like a couple hundred microamps depending on the exact chip, when it's output high drops to 2.4V.
Your chip may not even satisfy the input current and voltage requirements of the ULN2003.
The 8051 can sink few milliamps though so a circuit like this is usually used.
 

Attachments

Last edited:

abuza8nuqina

New Member
No. The way you've drawn it, the 12V will be shorted to ground when the motor is off. p9 of the ULN2003 needs to be connected to 12Vdc; put a dot, at the wire junction, on the diagram to show this. p8 of the ULN2003 needs to go to ground. You may, or may not, need a pullup resistor to Vdd on p0.0 depending of the variant of the 8051 that you have.
What do u think about below?
 

abuza8nuqina

New Member
The 8051 has internal pullup resistors that limit the output current to something like a couple hundred microamps depending on the exact chip, when it's output high drops to 2.4V.
Your chip may not even satisfy the input current and voltage requirements of the ULN2003.
The 8051 can sink few milliamps though so a circuit like this is usually used.
Is this what u meant?

 

ccurtis

Well-Known Member
If you are going to go with the ULN2003, as was mentioned, you need to add a resistor from P0.0 to VCC of the MCU. A 10K value is appropriate. The P0.0 output is open-drain unless the MCU is in external bus mode.

In external bus mode, I don't believe you can hold the output state unless you continually pump the same address/data out over and over again, and without missing a clock cycle.

If you use a port 1-2 output you should still put a 10K pull-up resistor in, because the internal pull-up capability is only marginally strong enough to drive the ULN2003 high.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top