3

I'm trying to build a toy model of self-driving car for my FYP. I have a RPi3 B+ Model with a custom 3D printed chassis which uses a futaba s3003 servo for steering front wheels.

Servo is currently externally powered with a 3.7v LiPo battery and is attached to GPIO 14, but sometimes it jitters a lot. I'm wondering if I can use any 4 of those hardware pwm pins to control this servo more steadily with standard RPIO library ?

Or is it necessary to use libraries like pigpio, pi-blaster etc... I'm not familiar with them and do not know how it control a servo with it.

2
  • 1
    I think it would be easier to answer this question if you would include an illustration of your setup.
    – Bex
    Commented Aug 25, 2017 at 8:43
  • there is not much to show a standard size servo connected to Rpi 3 via external power source, i just need to know whether RPi alone can provide hardware generated precise pulses for a servo or do i need to use an 16 channel servo driver module?, as i'm driving only a single servo. my chassis looks somewhat like this ae01.alicdn.com/kf/HTB1XB9wRXXXXXXkXVXXq6xXFXXXi/… Commented Aug 25, 2017 at 9:08

1 Answer 1

1

The RPIO.GPIO Python module can provide stable servo pulses. It uses exactly the same techniques as servoblaster and (my) pigpio and uses hardware timed pulses.

You are possibly using the similarly named RPi.GPIO Python module which uses software timed PWM and will suffer jitter as you mention.

If you want jitter free operation you will need to use pigpio, servoblaster, RPIO.GPIO, pi-blaster or similar, or use external hardware.

4
  • thanks that explains a lot, so RPIO can provide stable pulses on any pin ? Commented Aug 25, 2017 at 10:17
  • @MohammadUsmanQureshi Yes, RPIO can. The module is available from github.com/metachris/RPIO. You need to find and download version 2 for the Pi3.
    – joan
    Commented Aug 25, 2017 at 10:52
  • i have installed v2 for Pi3, after running example code i get this seems like everything is working fine but then my pi freeze. i have to unplug n plug it back to reboot. ibb.co/ho7XxQ Anyways i have installed (your) pigpio i was wondering where can i find some documentation and example code for it. Commented Aug 26, 2017 at 12:40
  • Servos are pretty trivial, you just send pulses at a particular pulse length. See abyz.co.uk/rpi/pigpio/examples.html#Python_servo_demo_py for a Python example. From the command line pigs s 4 1500 will send 1500µs pulses to a servo connected to GPIO 4.
    – joan
    Commented Aug 26, 2017 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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