Continue to Site

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.

  • 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!
 
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.
 
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.
 
Not quite. Try these corrections.
 

Attachments

  • relaymod.png
    relaymod.png
    27.4 KB · Views: 535
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:
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...
 
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

  • 12vMotorInterface.GIF
    12vMotorInterface.GIF
    2.4 KB · Views: 282
Last edited:
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?
**broken link removed**
 
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?

**broken link removed**
 
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top