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.

Source or sinking current of a microcontroller

Status
Not open for further replies.

Ogu Reginald

Full Member level 6
Joined
Oct 7, 2011
Messages
369
Helped
47
Reputation
94
Reaction score
46
Trophy points
1,308
Location
Nigeria
Activity points
3,391
I have been using the AT89S52 microcontroller for more than four years in all my microcontroller projects and it has been working very well.

Of late, I designed a device in which the microcontroller should turn ON and OFF a transistor which is used to switch a relay ON and OFF, after producing my hex file, I virtually simulated the circuit and it is working as designed but upon construction I discovered that it is not working.
When I removed the relay and connected the output of the microcontroller to an LED, I dicovered that the LED is coming ON and OFF as designed but its brightness is very low.

Then I connected a multimeter in series with the LED to measure the current that the microcontroller is producing, I discovered that it is 1.2mA.

I have changed more than seven microcontrollers and the problem still continues, can someone help me figure out the problem. My Circuit.gif
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
The pin used for relay should be configured as digital output pin. Post your code. The 12V battery GND and MCU GND must be made common. The 4 switches need 10k pullup resistors and in code debounce delay.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
49,380
Helped
14,434
Reputation
29,132
Reaction score
13,222
Trophy points
1,393
Location
Bochum, Germany
Activity points
284,226
The pin used for relay should be configured as digital output pin.
The feature doesn't exist for standard 8051 output ports. Port1 to 3 are open drain with weak pull-up. To get more output current in high-state, you have to place pull-up resistors.

The outputs are driving high during µC reset, which may be problem in some cases. The perfect solution would be an inverter or PNP transistor driving the relay switch transistor and active low state for P1.4.

The 4 switches need 10k pullup resistors
No. I presume you never worked with 8051 processors?
 

nagkiller

Full Member level 4
Joined
Jul 9, 2009
Messages
231
Helped
37
Reputation
74
Reaction score
37
Trophy points
1,308
Location
Brazil
Activity points
2,561
Check the power supply!!!
Try without mcu too, switch pin of base of transistor, if works...
 
Last edited:

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
@FvM

Yesy, I have not done many 8051 projects. I mainly use PIC MCUs.
 

Ogu Reginald

Full Member level 6
Joined
Oct 7, 2011
Messages
369
Helped
47
Reputation
94
Reaction score
46
Trophy points
1,308
Location
Nigeria
Activity points
3,391
Thank you very much for all your advice and suggestions. I just added a 1k resistor between my VCC and P1.4 and it is working. Pls what will happen if I replace the 1k with:
a) 100k
b) 100R
 

Easyrider83

Advanced Member level 5
Joined
Oct 11, 2011
Messages
1,608
Helped
374
Reputation
748
Reaction score
362
Trophy points
1,363
Location
Tallinn, Estonia
Activity points
8,577
Did you heared about Ohm's law? With 100R current will be about 45mA, which it too much for individual pin. With 100k current will be 45nA, with is not enought to open the transistor.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top