PWM/HPWM Stepper Motor Controller


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,522


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    David,
    You've done a great job so far!
    As you might know the torque of step motor falls off as the speed increases. Increasing the drive voltage counteracts this drop in torque. Doubling the voltage pretty much doubles the speed at which the motor stalls due to "overload". This is within reason of course, too much will only result in heat in the motor and if you do get what you need out of it with whatever voltage there's no real gain in increasing it even further.

    One rule of thumb from a drive manufacturer (Geckodrive) is that supply voltage to the drive could be as high as 32*(sqrt)L where L is the inductance in mH.

    Lets say your motor has an inductance of 2.8mH, then the drive voltage can be around 50V. Obviously the drive has to be rated for the voltage as well.
    I don't know any details on your particular motor but I'd certainly try a 24V supply or even a 48V if you still need more speed.

    Slow speed torque is highly dependent on the current setting of the drive.

    Finally, it's hard for a motor to start "instantly". You'll be able to reach much hiher speeds by ramping the speed up/down.

    If you generate the step pulses in hardware, like with the CCP module (as with HPWM ) then you have all the time in the world to figure out when to fire the solenoid(s).

    Nope, PBP is for 8-bit PICs only, no 16 or 32bit devices.

    /Henrik.

  2. #2
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Henrik, Thank you and thanks for your explanation. I've not done any work with the stepper motors so I'm still learning. I'm actually not trying to get much speed out of the stepper. I will be driving a conveyer and it will be moving small parts under my spray nozzle so it's not going to go fast at all so the parts can get evenly coated.

    I'm going to start to look into generating the pulse with HPWM I've never done that before

    Thanks for letting me know about that ds device good to know.

    David

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Quote Originally Posted by HenrikOlsson View Post

    If you generate the step pulses in hardware, like with the CCP module (as with HPWM ) then you have all the time in the world to figure out when to fire the solenoid(s).

    /Henrik.
    Henrik, I always wanted to try using the CCP module for this purpose, but not sure how to keep track of the number of pulses. Maybe feed the pwm output into a timer to keep count?

    Mark

  4. #4
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Mark maybe we can work this out together with Henrik's assistance. I went to the micro chip site and used their processor selector to find one that had the PWM built in. It looks like the 12F752 has what I need to try to get the HPWM to work. The datasheet says

    • Capture, Compare, PWM (CCP) module:
    - 16-bit Capture, max. resolution = 12.5 ns
    - Compare, max. resolution = 200 ns
    - 10-bit PWM, max. frequency = 20 kHz

    Thats what I am looking for right? I've not read the rest of the datasheet. I picked this one out because I think I have one here already to start to work with.
    Thanks
    David

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,522


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Mark,
    Yeah, for precise positioning feeding the pulses back into the PIC and count them OR integrate generated velocity over time to calculate position. Possible but not exactly easy to get right, I'd say.
    But for the application described here I don't think precise position control is needed, just precise velocity which the CCP module will do without any software overhead - except during acceleration.

    Depending on the needed frequency and acceptable jitter perhaps the NCO available in some devices would be even better for this.

    David,
    At your desired conveyor belt speed, what approximate frequency are you generating? Is it 100Hz, 1000Hz, 5000Hz?
    For the CCP module you could use the HPWM command but if you want to implement acceleration then I would ditch HPWM and set the registers manually.

    /Henrik.

  6. #6
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Quote Originally Posted by HenrikOlsson View Post
    David,
    At your desired conveyor belt speed, what approximate frequency are you generating? Is it 100Hz, 1000Hz, 5000Hz?
    For the CCP module you could use the HPWM command but if you want to implement acceleration then I would ditch HPWM and set the registers manually.

    /Henrik.
    Henrik, Thanks.... well that is going to be trial and error at this point. I actually am going to have to hook up my conveyer belt and use the pulse method I've been using so I can get an idea. i need to see the spray turned on and how fast I can make the part travel under the spray and get it coated good. It's not going to be traveling very fast I'm sure. When I manually spray my parts with my detail sprayer I'm not moving my hand very fast over the parts. At this point I really could not say at how many feet per minute or anything like that. My gearing ratio is going to affect that too. Right now I have about a 1:1 ratio on there. Now that I see what I am working on is do-able I've ordered my aluminum framing material so I can start to bring things together. The speed of the belt will be constant. Start - go a little distance, Stop

    What do you think about the 12F752 just to tinker around with the HPWM... I asked because I never worked with PWM before just wanted to make sure that pic will work. Reading the specs and looking at some sample code I think just to mess around that will work.

    Thanks
    David

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,522


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    I see no reason for it not to work.
    But with an 8-pin device you're quickly running out of pins, step pulses out, solenoid drivers, perhaps a sensor of some sort to detect the items on the belt, a start/stop button, perhaps some means to output debug information or parts count to a LCD? It adds up...

    If you already have it go ahead and play, if you're ordering it and there's no real reason for an 8-pin device then perhaps something like the 16F1825? More pins, more FLASH, more RAM and an UART. It does also cost more but I reccon you're not building thousands of these so it doesn't matter much :-)

  8. #8
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: PWM/HPWM Stepper Motor Controller

    Henrik, agreed about the need for the extra pins. I will be switching to the 16F series for sure I've already thought of the extra pins I will need stop/start, Jog, , manual speed, lcd, direction, sensors, etc... I just quickly looked on microchip part picker and I am pretty sure I had the 12F but I didn't see any on their list that had HPWM in the 16F series that I had and I want to get started and have things worked out. Going to order some 16F's now which will take about a week to get here, I don't want to wait to see it work. I have a good bit of time to test things before I would actually put my conveyer to use I still need to work on the frame and belt mechanism itself. The framing material will be here in about a week I will keep this thread going as I progress through adding different functions to the PIC
    Thanks
    David

Similar Threads

  1. Motor Stepper Example
    By Melanie in forum Code Examples
    Replies: 134
    Last Post: - 3rd January 2015, 17:58
  2. Need guidance with DC motor controller - PWM & H-Bridge
    By rfetech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th November 2010, 03:33
  3. Another Stepper motor controller
    By aratti in forum Code Examples
    Replies: 3
    Last Post: - 19th December 2009, 09:52
  4. Stepper motor controller
    By aratti in forum Schematics
    Replies: 22
    Last Post: - 24th April 2009, 16:43
  5. Stepper Motor Program
    By kiwipiper in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th November 2007, 02:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts