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.

How to drive turn on this DC motor using PIC16F877A??

Status
Not open for further replies.

thibraani

Newbie level 5
Joined
Oct 8, 2007
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,403
2n2222 motor

Hallo all..
I'm doing an assignment which requires me to turn on and off a DC motor (showed in the photo attached) using PIC16F877A as the microcontroller. This motor is connected to PORTB (PB0) and it is controlled by a DIP switch, connected to PORTD as input.

Toggle switch 1 (SW1) will result the motor to turn ON while switch 2 (SW2) will make the motor turn OFF.

This motor operates using 5V. I suppose the output of the PIC (its logic HIGH) is +5V. By right, if I assign logic HIGH to PB0, the motor is supplied with +5V, which is supposed to turn ON the motor. Hence, I connect the motor DIRECTLY to PORTB (without any resistor or driver), but NOTHING happen when I toggle SW1.

I hope anybody can give comment on my design and suggest any improvements to be done to enable the motor to turn ON and OFF.

Thank you.
 

turn on pic16f877a

thibraani said:
Hallo all..
I'm doing an assignment which requires me to turn on and off a DC motor (showed in the photo attached) using PIC16F877A as the microcontroller. This motor is connected to PORTB (PB0) and it is controlled by a DIP switch, connected to PORTD as input.

Toggle switch 1 (SW1) will result the motor to turn ON while switch 2 (SW2) will make the motor turn OFF.

This motor operates using 5V. I suppose the output of the PIC (its logic HIGH) is +5V. By right, if I assign logic HIGH to PB0, the motor is supplied with +5V, which is supposed to turn ON the motor. Hence, I connect the motor DIRECTLY to PORTB (without any resistor or driver), but NOTHING happen when I toggle SW1.

I hope anybody can give comment on my design and suggest any improvements to be done to enable the motor to turn ON and OFF.

Thank you.

you need a driver which drives the motor.
 

connect dc motor by transistor

A simple 2N2222 transistor, diode and a 1K resistor will do the trick. I have code and schematic for such a project on my site.
**broken link removed**
 

l293 connection pic16f877a

Hi

Pic can source only 25ma per pin. that port may be burnt off when u tried to run the motor. try using a driver such as ULN 2003 or equivalent driver circuit.
 

it is likely that the motor is requesting too high current, and your microcontroller can not source it.

therefore, you must put some circuitry between your PIC chip and the motor, so that this circuitry receives the control signal from the PIC chip at very low current, and translates this into a high current.

mosfet can do this, transistors can do this, IGBTs can do this.. there are all sorts of single chip solutions.

the easiest thing to do is have your PIC chip goto a MOSFET gate pin. insert a 10 ohm resistor in series with this connection.

connect the source pin of MOSFET to ground (the same ground as your microcontroller).

connect the drain pin of MOSFET to a 5watt variable resistor, say 1000 Ohm plus an additional 5W 100 ohm resistor (just incase you turn your pot to zero, you don't want a direct short).

now connect your motor IN SERIES with the resistor s.. so just one wire will attach to the resistor.. and the other wire to 12V dc battery supply.

connect now connect the other end of the resistor to your supply voltage, perhaps 12V dc (depends on motor rating).

now you can vary the speed of your motor by changing the POT resistor value, twisting it.

motor spin in one direction only

you may need to play with resistor value to get it working, but probably this is OK for lower voltage/power motor.

Mr.Cool
 

you'll also need a free-wheeling diode in parallel with your motor or you'll blow up your switching device.

oops! forgot to mention this ... ;P
 

Use a transistor as a buffer to drive your DC motor.
DC motor draw high current.
The current provided by the PortB from your microcontroller
will not be able to support your motor.

Depending on the current rating of your DC motor,
you will have to choose a suitable transistor to drive it.
If the DC motor is being run with 1A,
you should choose a transistor which can handle more than 1A.
A a guide, I always x2, which means a 2A transistor.
The motor in the picture is quite small so
as mention from blueroomelectronics,
a 2N2222 transistor should do the work.

For more information to your motor driving problem,
you may like to understand about switching,
**broken link removed**

It also includes a simple list of transistor with its
current rating stated for your design reference.
 

when you connect to motor directly to the one of the pin of your PIC even though you use a resistor, your PIC will blows out because 0.025mA capability of the each pin.In additon, since this motor seems to have stall current lower than 1A stall current you can use L293. . I do not recommend you to build your own h bridge because, it may produce problem. If the motor requires more than 1A, L298N is another solution, howver it supports to 2A dc application. use L6203 if 5A is necessary.
 

Am I missing something, or should not just a TIP127 connected to a GPIO pin do the trick ?

Can the OP get back on this ?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top