How to remove the PI4J pwm jitter?

78 views
Skip to first unread message

Yellow Eagle

unread,
May 26, 2016, 10:19:07 AM5/26/16
to Pi4J
Hey :D, how can i remove the pwm jitter?

Thanks in advance :D

Yellow Eagle

unread,
May 26, 2016, 10:23:32 AM5/26/16
to Pi4J


Am Donnerstag, 26. Mai 2016 16:19:07 UTC+2 schrieb Yellow Eagle:
Hey :D, how can i remove the pwm jitter?
   The Code that i m using for my Motor ESC controller: 
    
@Override
public void run() {
Gpio.wiringPiSetup();
try {
SoftPwm.softPwmCreate(24, 0, 60);
SoftPwm.softPwmWrite(24, 12);
Thread.sleep(100);
while((true)){
SoftPwm.softPwmWrite(24, 12);
Thread.sleep(100);
SoftPwm.softPwmWrite(24, 20);
Thread.sleep(100);
    if(stop){
        SoftPwm.softPwmWrite(24, 0);
    Thread.currentThread().destroy();
    }
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}


 
 
 
Thanks in advance :D

Robert Savage

unread,
May 26, 2016, 10:34:04 AM5/26/16
to pi...@googlegroups.com
Use the hardware PWM pin instead of SoftPWM.  Its far more efficient and does not rely on software driver.

Depending on the model, you have at least 1 hardware PWM pin, maybe more:

 // All Raspberry Pi models support a hardware PWM pin on GPIO_01.
 // Raspberry Pi models A+, B+, 2B, 3B also support hardware PWM pins: GPIO_23, GPIO_24, GPIO_26

Thanks, Robert

Yellow Eagle

unread,
May 26, 2016, 10:55:04 AM5/26/16
to Pi4J
Thank you very mutch :D 

Yellow Eagle

unread,
May 26, 2016, 4:12:15 PM5/26/16
to Pi4J


Am Donnerstag, 26. Mai 2016 16:34:04 UTC+2 schrieb Robert Savage:
Use the hardware PWM pin instead of SoftPWM.  Its far more efficient and does not rely on software driver.

Depending on the model, you have at least 1 hardware PWM pin, maybe more:

 // All Raspberry Pi models support a hardware PWM pin on GPIO_01.
 // Raspberry Pi models A+, B+, 2B, 3B also support hardware PWM pins: GPIO_23, GPIO_24, GPIO_26

Thanks, Robert


When i would use the Code i couldn t import some methods...

Robert Savage

unread,
May 26, 2016, 4:54:53 PM5/26/16
to Pi4J
That PWM example is based on the latest 1.1-SNAPSHOT builds.  You can download the latest JARs directly from the Pi4J.com website.

Yellow Eagle

unread,
May 27, 2016, 3:42:11 AM5/27/16
to Pi4J
Oh, ok :D
Reply all
Reply to author
Forward
0 new messages