PIC16f84a PWM 12V DC MOTOR

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
Hi All

I have built a small 12V DC motor circuit and written some code for PWM for a PIC16F84A (school project). I can make the motor run when I connect it to my power supply. But when I connect my PIC to the motor circuit nothing happens, the PIC is connected to 5V. I have put an input point in between the two transistors in the attached schematic and am using RB0(pin6) from the PIC to connect to the circuit to make the motor run. Can anybody offer any suggestions ?

Thanks
 
Last edited:

elal

Joined Dec 19, 2008
6
Dear Trevor, can you please post your pic code?
I do lots of work with PWM driven motors, and maybe i can help you if i have a look in your code.
Regards.
 

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
Heres the code it simulates fine when I test it on MPLAB with the logic analyzer. I think its operator error not the hardware.
 
Last edited:

kammenos

Joined Aug 3, 2008
127
just a question. do you HAVE to use the 16f84? Why not 16F88? it has a built in PWM. Or another much much cheaper, as for example the 12F615, dead cheap WITH PWM.
 

mik3

Joined Feb 4, 2008
4,843
I don't know about the code but there is a problem with the BJT transistors which are supposed to drive the MOSFETs.

Which MOSFETs are you using?

If the MOS are logic level MOS then you can connect them directly to the output of the PIC with a 50R resistor in series with each ones gate. If you drive them with a MOS IC driver switching losses will be reduced (if the motor does not need much current this is not necessary).

If the MOS are not logic level you will need to drive a PNP transistor with an NPN and use the PNP to drive the MOSFETs.
 

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
I am using BUZ10's, therefore I dont need the transistors ? just add the two 50R instead ? I will give that a try and get bacK to you.

Thanks
 

mik3

Joined Feb 4, 2008
4,843
They are not logic level MOS but have a try. If they get very hot use BJTs or an IC MOS driver to drive them.
 

mik3

Joined Feb 4, 2008
4,843
They are logic level MOS but their ON resistance is quite high (2.5 R). If you can find other logic level MOS but with less ON resistance it will be better.
 

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
I tried the 2N7000 with 50R in series but nothing happened, any thoughts Mik. THe only connection to the motor circuit is from RB0 of the PIC, thats all I need ? The PIC of course is connected to 5V.
 

mik3

Joined Feb 4, 2008
4,843
I tried the 2N7000 with 50R in series but nothing happened, any thoughts Mik. THe only connection to the motor circuit is from RB0 of the PIC, thats all I need ? The PIC of course is connected to 5V.
Is the PIC outputting 5V?

Have you connected the MOS with the correct pins?
 

Markd77

Joined Sep 7, 2009
2,806
I'd swap the motor for an LED and appropriate resistor to check that the circuit and code is doing what you think it is. If that works OK, plug the motor in parallel with the LED and see what happens. Have you got a diode in place? Search for switching inductive loads.
 

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
I figured out the problem, the PWM was too fast for the motor so it it just ran continuously. I put a delay in the PIC code to slow it down. It wasnt the circuit or the MOSFETS, the advice in that regard was so wrong and unhelpful. At least I have figured out who to listen to now.
 
Top