Posts: 2
Joined: Tue Mar 27, 2018 8:01 am

PIGPIO PWM Position Control

Tue Mar 27, 2018 8:30 am

Hello all,

I am currently experimenting with the RPi and would like to control a stepper/ac servo motor using the pigpio library since it generates hardware pwm from the RPi's pins.

The hardwarePWM function allows me to control the frequency and duty cycles of a pwm signal but not the number of pulses? How can I control the position of a stepper motor?

Stepper motor has 2000 steps per revolution
I need to make the stepper move 1 revolution (2000 pulses) at 50000KHz

Normally I would just set a pin high and low with a delay in between to generate the pulse manually, but I cannot achieve the speeds required and has a lot of jitter.

Any idea on how to approach this?

User avatar
Posts: 13408
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: PIGPIO PWM Position Control

Tue Mar 27, 2018 10:00 am

I'm not convinced you will get a 50MHz signal (50000KHz) signal out of the Pi GPIO.

The best you can do with pigpio, if you want to count the pulses, is 500KHz. For that you have to use what I call wave chains.

I suggest you experiment with pigs and an oscilloscope (or piscope) to get a feel for what they do.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 15 guests