1

I have rotation bug in ServoBlaster..

I'm using these values:

  • 1500us : Idle
  • 1530us : Pulse left
  • 1480us : Pulse right

For example : echo 1=1500us > /dev/servoblaster.

BUT, my problem is the (continuous) servo which rotates itself sometimes.. I mean, I make it to rotate to the right, I stop (idle), rotate to the left, stop (wait some seconds), and sometimes it will begin to rotate again itself and don't stop until I give it pulse left or pulse right value (it will not stop anymore with idle pulse)..

Do you have an idea ?

EDIT: I'm using an external battery for the motor (5V 2.1A). The battery GND pin is not connected to the RPi GND pin (otherwise, the motor is crazy sometimes).

  • I'm not sure what you expect to happen. If you don't want a continuous servo to rotate you'll need to command it to the neutral zone. – joan May 24 '14 at 12:02
  • I know that.. But when I'm doing echo 1=1500us that should put it in the neutral zone.. Am I right ? – Val May 24 '14 at 12:09
  • Yes, that will go to the neutral zone. What do you mean by stop? I assumed it meant that pulses were no longer being sent. In that case the servo will start to respond to interference. – joan May 24 '14 at 16:08
  • In my message, "stop" equals to the 1500us pulse. And so, do you know how can I solve the interferences problem ? – Val May 24 '14 at 16:11
  • If the 1500us pulse is being continually sent then there shouldn't be an interference problem. I thought by stop you meant you were sending echo 1=0. – joan May 24 '14 at 17:22
1

The Pi is not a real time OS and sending PWM signals can just cause unexpected results. You cant fade LED's or mix then and controlling servos is an issue.

You should really use a dedicated hardware with an external clock and real time OS so that the PWM generated signals in a timely fashion. The most popular option is an Arduino, or a MCU from the AVR or PIC family that you can connect a crystal to and supports PWM.

You can program an aTiny 45/85, which has a good enough built in crystal, and is good enough to run stand alone and talk it via SPI from the Pi. The obvioues drawback is you need a Arduino programmer or a full Arduino and write some code for the 45/85 to do what you want it to.

enter image description here

But, one guy by the screen name of sarfata created Pi blaster based on servo blaster. He tweaked the code to better offload to the PWM pin using servoblaster DMA methods. It is not idea but its a great software only solution.

1

servoblaster added a switch off after several minutes option. I wonder if that is kicking in.

Try my pigpio

0

I tried both PiBlaster and PiGPIO, but the problem was the servo was not calibrated.. I didn't know they should be calibrated, we told me in the RPi official forum. Thanks anyway for your answers and +1 to all answers !

  • Can you explain how you calibrated it please :) – Piotr Kula Jul 25 '14 at 12:05
  • Yes, please see the post here :). – Val Jul 25 '14 at 14:40
0

Try pythonSB... https://github.com/jabelone/pythonSB seems to work pretty well in python

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.