1

Explanation

I am using a Rpi 2 model B, and PIGPIO to generate PWMs. Goal is to run a three phase permanent magnet synchronous motor using the Rpi 2 with IRAMS10UP60A. Need 6 repeatable waveforms to create what is know as a trapezoidal drive control for the motor. IRAMS10UP60A driver needs 5V pull down. I was able to pull down using the Rpi 2/PIGPIO with a 1k resistor between the IRAMS10UP60A driver and Rpi pins.

Below is a pic of the waveforms to generate on 6 different GPIO pin set in pull down mode. At any instant only two switches are on, this is critical as overlap in the waves will fry the IRAMS10UP60A chip.

There are two frequencies: PWM frequency known here as the carrier frequency (shown in the picture pulses), and the modulation frequency which is the time for one electrical cycle (the whole picture repeating itself). The modulation frequency would be the total waveform time, after which the cycle repeats itself.

Example desired numbers for PWM frequency: 10 to 20khz. For the modulation frequency 50-200 hz. Trapezoidal drive of 3 phase brushless DC motor

Questions

  1. Possible solution: using PIGPIO ideally creating 6 different waveforms at the PWM 1 frequency for G4,G6,G2 and PWM 2 frequency for G1,G3,G5. Then repeating the waveforms at the modulation frequency. For this scenario how well would the waveforms sync? Will there be any overlap?
  2. My python and PIGPIO experience is new, although I have an idea of what to do, I need help in the implementation. Can someone give me some code examples on how to implement two waves out of phase and at different PWM frequency, and both waves repeating and a different modulation frequency?
  • Would you share your code ? I am up to build a model for a synchrone linear motor ... and the IRAMS10UP60A sounds good to me for that also ! What os do you use with the pi and wath programming language for the code ? – Werner Riegler Aug 10 '17 at 7:50
  • I am out of town, and the code is on the Pi, I will share by next week. The Pi OS is Raspbian. Code is in Python. I remembered that I used the functions in wave PWM example on pigpio (see links below by Joan). IRAMS 10UP60A is easy to work with and you can scale up motors up to 1hp. – Ali Tarraf Aug 15 '17 at 18:58
2

Don't expect much from this answer, you are veering into a more esoteric region of pigpio.

I suggest you look through the wave examples at pigpio examples. In particular Wave PWM 2 may be helpful.

I think you can probably achieve what you want but it will need some experimentation on your part.

If you haven't got a 'scope also consider slowing the waveforms down and checking the logic with piscope.

  • Thanks joan, I do have a scope and using start and length cycle delay I got 6 pulses 60 deg phase delayed. All of them are at the same frequency, this should drive my motor for a demo purpose, but I should watch current and voltage carefully. Although it would be interesting to have pwm at different frequencies and with a phase delay, I am still working on that. – Ali Tarraf Apr 22 '17 at 18:59
2

Using pigpio, I was able to generate 6 PWM pulses with a 60 degrees phase delay using Joan Wave PWM 2 functions. This was enough to get the motor started. Pulsing the high level transistor at a higher frequency will be needed in the future with a closed loop control while having a feedback current measurement. Below is a pictures of the pulses generated measured by an oscilloscope (frequency is 5 hz just to get the motor started, but I have measured frequencies up to 20 Mhz), and also a gif video showing the motor spinning. PWM switching of transistors enter image description here

Here is the code to run the motor:

import wavePWM
import pigpio
import time

pi=pigpio.pi()
pwm=wavePWM.PWM(pi)

pwm.set_frequency(6)


pwm.set_pulse_start_and_length_in_fraction(22,0,1.0/3)      #Q1 upper switch
pwm.set_pulse_start_and_length_in_fraction(19,1.0/6,1.0/3)  #Q5 lower switch
pwm.set_pulse_start_and_length_in_fraction(6,1.0/3,1.0/3)   #Q3
pwm.set_pulse_start_and_length_in_fraction(13,1.0/2,1.0/3)  #Q4
pwm.set_pulse_start_and_length_in_fraction(5,2.0/3,1.0/3)   #Q2
pwm.set_pulse_start_and_length_in_fraction(26,5.0/6,1.0/3)  #Q6

pwm.update()

Here is the code to stop the motor:

import pigpio

pi=pigpio.pi()

pi.write(22,0)
pi.write(19,0)
pi.write(6,0)
pi.write(13,0)
pi.write(5,0)
pi.write(26,0)

print "Done"
  • Hi Ali, Could you please tell me how to install wavePWM module. I am struggling with that, Thanks in Advance. – Spandan Singh Apr 13 '18 at 16:52
  • Hi Spandan, you just have to include the wavePWM.py in the folder where you are running your script. – Ali Tarraf Apr 16 '18 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.