Continue to Site

Welcome to

Welcome to our site! 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.


Not open for further replies.


Newbie level 5
Aug 10, 2009
Reaction score
Trophy points
Activity points
at89s52 microcontroller

Gentlemen and everybody,

It is a really really very urgent!!!!!!!!! I know most of the people say this but I really need a solution very urgently. Its a very kind request.I am new to embedded systems so kindly explain in little details as u explain.

This is a very simple project. I have to control 2 dc motors via serial interface from PC. Schematic and code attached. Points for consideration :-
1. Serial interface is made using max232 and is tested in another boad and is working 100% fine.
2. The rest of the circuit (except microcontroller) is working when i connect a 3v duracell battery in place of output port pins where i require 1's. The circuit works fine with 3v battery. I am using a SMPS with 24V, 2.5A rating in place of24V battery shown in the schematic, Relays work on 12V.
3. The microcontroller is working fine as i have tested microcontroller in another board and LED's are glowing as desired.
4. Now when i put microcontroller in my circuit. the circuit does not work. ??????
5. Since the circuit is working with 3V battery then in should work with 3.5V at output pins of micrcontroller.But it is not working.
6. Some of my friends suggested that there is a difference in the current level, I also think the same. but can u please suggest a way to switch ON BC547 from output pin of at89s52.

I would be really really thankful..
MOV TMOD,#00100000b
MOV TH1,#253d
MOV SCON,#01000000B
        MOV A,SBUF
        MOV P2,A
        MOV SBUF,A
                JNB TI,WAITX
                CLR TI
This programme is written using keil uvision.

dc motor interfacing using 8051 and transistor

Hello rksiwal!
Check if the gnd of the whole circuit is same or not
Last year i had to interface parallel port to 8051 and you know what i had done i just didnt connect the gnd of my 8051 to gnd of my db25 connector and when i connected the 2 the circuit went smoothly
Good Luck

power transistor for driving motors by 8051

thankx a lot sk_008 for the quick reply. but i have connected all the gnd.

how to drive motor with transistor and at89s52

Here are some problems in your circuit.
There is no crystal.
There is no reset circuit for microcontroller
EA pin is floating. Connect it to +5V
No power connected to microcontroller
Pin 2 of DB9 should go to Tx and pin 3 should go to Rx through MAX232.
Base resistors of transistors are too small. Use atleast 1k.
There are no free-wheeling diodes across relay coils.
Second pair of relay has no power !!
Its good to use 4.7k pull-up on P2.


    Points: 2
    Helpful Answer Positive Rating
microcontroller at89s52

thankyou CMOS .sorry bothering you but could u plz explain the following.
1. concept of freewheeling diodes. i know they are used to cater for back EMF but i m not clear about their orientation and rating(specifications).
2. how to place free wheeling diodes when used across dc motor driven through H bridge. I am using 24V 2.5A supply to be relayed to motors.
3. how do u decide that base resistance should be 1k and not anything else.
4. kindly clarify "4.7k pull up on P2".

thankyou very much

at89s52microcontroller based projects

Read this article on freewheeling diode

And read this article on using transistor as a switch
**broken link removed**

Since sourcing current of ports of 89S52 is very low, you need to use external pull-ups to increase the sourcing current. Connect individual 4.7k resistor from +5V to each used port pin.

8051 emc reset problem

thank you CMOS your advice helped and so i m mentioning it by giving u pts.

two motors on a single microcontroller

You can use L293 or L298 device called H bridge.
So you can control speed also for your motor.No need of relay.

pc interfacing of microcontroller at89s52

rksiwal said:
thank you CMOS your advice helped and so i m mentioning it by giving u pts.
No problem. And thanks for the points :)

I forgot to mention free-wheeling diode's ratings. You can use 1N4007 across the relay with cathode connected to +12V and Anode to collector of transistor.
You should also consider using a snubber circuit across the motor since it is powered from the same power-supply as the microcontroller, any noise generated by the motor will affect microcontroller's operation.
**broken link removed**

at89s52 micro-controller

another strange problem has come.

there are two circuits - 1st made by me, 2nd- development board purchased from vendor.
Case 1 : when I put micrcontroller in 2nd board, give it +5V and GND from my circuit(1st board) and connect its(2nd boards) output pins to my board(1st), everythng works fine.
Case 2 : Now I take out that same micrcontroller from 2nd board and put it in my board(1st). Now 1st board is not connected to 2nd board in anyway. Now the cicruit does not work.
I have made the reset circuit and put the crystal also. I have attached the power up schematic kindly suggest corrections.
In case 2 , when circuit is powered, I have measured voltage across
pin20 - pin40 -5V
pin 20- pin 31 -5V
pin 20 -pin9 -0V
Voltage are measured from pin side of micrcontroller and not solder side, so probability of loose solder is also ruled out. This is a very strange behaviour ..i could not understand .plz help out.

One thing not drawn in diagram is pin40 is +5V
pin 20 is GND connected.

areas where microcontroller is used in motors

Ok there your problem is. Your reset pin is floating when reset switch is not pressed !
You need to have logic 0 at the pin all the time for proper operation. Use R-C reset circuit as shown in the attached schematic.

pin ea at89c52 de trong

thanx a lot CMOS...
u really g88.....
i have become ur pankhaaaa..... :)

So is your circuit working now?

What is pankhaaaa?? What language is that?

Dear all
kindly see attached schematics and give suggestions.. see files in sequence
The project is working but i believe i would have made mistakes some protection circuit or something like that..
and yes I have tried to put some LEDs in file 2 which i have still not put on circuit ..but plan to put it...kindly make corrections for LED's

kindly give opinions regarding the schematic.. 3rd file is the file one.

Thanks to all for their kind effort.

Here are some issues with 3rd design.
There are no current-limit resistors for LEDs.
You can't drive a relay with LEDs in series. Connect LED with series resistor across the relay coil pins. Same applies for reset pin. You can't connect LED that way.
No snubber circuit across motors.
MAX232 circuit is not right. There should be a capacitor between pin 2 and Vcc.
I am not sure what your motor's current rating is but keep in mind that 7812 is capable of delivering only 1A that too after using a large heat-sink.
It is a good practice to use 0.1uF de-coupling capacitors near power pins of each IC.
No need of 10k resistors before ULN2803. Instead use 4.7k pull-ups on those 4 pins. I've had problems earlier driving ULN2803 with 89S52 without pull-up.

we are using at89s52 micro controller for fingerprint based lock using stepper motor. initially we want an assembly program for led blinking for which we are using Kiel software ,later we will insert a buzzer in the place of led.

Not open for further replies.

Part and Inventory Search

Welcome to