PIC16f84a PWM 12V DC MOTOR

Discussion in 'Embedded Systems and Microcontrollers' started by PIC GUY TREVOR, Sep 1, 2009.

  1. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    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: Sep 6, 2009
  2. elal

    New Member

    Dec 19, 2008
    6
    0
    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.
     
  3. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    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: Sep 6, 2009
  4. kammenos

    Active Member

    Aug 3, 2008
    127
    0
    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.
     
  5. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  6. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    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
     
  7. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  8. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    Will 2N7000 be ok, low current/low voltage, I will try them I wont worry about the driver for now.
     
  9. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  10. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    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.
     
  11. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Is the PIC outputting 5V?

    Have you connected the MOS with the correct pins?
     
  12. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    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.
     
  13. PIC GUY TREVOR

    Thread Starter Member

    Mar 8, 2009
    28
    0
    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.
     
Loading...