PWM using PIC to drive web motor

Discussion in 'Embedded Systems and Microcontrollers' started by sanaamjed, Dec 1, 2008.

  1. sanaamjed

    Thread Starter New Member

    Nov 30, 2008
    8
    0
    Hi
    I have been working on personal project, using PWM using PIC to drive web motor(big motor with 100mm diameter).By far I have discovered that there are about three ways to drive the web motor.
    1-using PIC(still not sure about which one to use because I wanted built-in PWM function,not many PIC have that these days-ANY HELP with it will be appreciated)
    2-using different PWM IC's out in market.
    3-using a triangular wave o/p giving IC like 8038 to be fed into the comparator like 555 timer or 741 opm amp can give be PWM to give the o/p throgh a MOSFET.

    The issues have been so far:-
    • Type of PIC is not confirmed-help,suggestions together with the suggested code will be appreciated.
    • I am also looking forward to a suggests of possible problems I may face going on with project,to be ready before they come.
    I will be updating on where I am with the project …….again this is my 1st experience with the forum.I may not have explained alot, please reply back to find out more so that suggestions can be provided.I have given myself about 10weeks to do the project and I am already past 1/3rd of the time before the deadline,so please reply soon.Thanks
     
  2. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,676
    899
    Go to Microchip.com and click on product selection. Microchip has a program called MAPS to help selection. PWM is included in the CCP module that many, if not most, of the chips have today.

    Depending on what you want to do, the 12F and 16F series are good starting points; although, many people start with the 16 and 32 bit devices. I have limited experience and found the 12F and 16F were inexpensive, and there was lots of beginner information for them as well as existing code.

    John
     
  3. ali.mir10v

    New Member

    Dec 3, 2008
    2
    0
    Mam ASAK,
    As per ur requirement, i would like to suggest u to plz go thriugh the datasheet of pic16f886 it will solve ur problem and more it is largest wonder in micro package.it allows four pwm out at a time and more a single output is available at four different pin if u want. In future if u need any help regarding this chip iplz feel free to ask that will indirectly helps me to improve my task.but not on this site since i prefer this weekly.
    soo

    contact me : ali.mir10v@gmail.com with ur query
     
  4. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,676
    899
    This site is for the mutual sharing of information and help.

    Your request that the OP not use this site seems contrary to that purpose. Do you charge for your so-called help?

    John
     
  5. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
    I don't know much about web motors (first time I hear about them), but since you are talking about PWM, am I to assume that it gets the same input as a servo motor ?

    Anyways, PWM is really easy to output through any digital pin from any microcontroller.

    I use PIC16F877, it has 2 PWM pins, but I am not using them, I use regular pins.
    You might ask why ? well, if I use PWM, then I only have 16 positions on my servo motor.
    To do the math:
    The programming function for duty cicle for PWM (I'm using MikroC) gets a value from 0 to 255. A servo gets an impulse every 20 ms, and the impulse is from 0.9 ms for 0 degree to 2.1 ms for 180 degree, that means:
    255 / 20 ms * 0.9 ms = 11.475 (to integer = 11)
    255 / 20 ms * 2.1 ms = 26.775 (to integer = 27)
    27 - 11 = 16 positions
    So this means that (255 - 16) = 239 values that you can pass to the PWM duty cycle function, but you cannot even use them !
    If you divide the total rotation (180 degree) by 16 positions = 11.25 degree per increment/position ! that is lot !

    So... instead of the pins for PWM, I used a regular pins, and the nice thing about it, is that you are not limited to 2, you have ALL the pins at your disposition... and a PIC16F877 has 33 I/O ports !!! The only problem with this, is that you are limited on what other things you can do with the same microcontroller... (you need 100% of processing power for precise control) so if I were you, I would use any small PIC that you designate only for PWM control, and another PIC that communicates with the smaller one to give it instructions.

    Here is code I found using PIC16F887 with MikroC controlling 12 servo motors with PWM:
    http://www.jvmbots.com/viewtopic.php?t=1248
    This example is still 16 positions (but 12 servos).

    I don't understand the coding in that example (even though it looks simple), so I wrote my own code.
    At home, with the same PIC16F887, I managed to get up to 94 positions per servo motor.
     
    Last edited: Dec 3, 2008
  6. dalexdisuja

    New Member

    Jan 5, 2014
    3
    0
Loading...