Using positional input to control a robot arm


Telekinesis on the cheap!

The reason for the violent vibration of the robot arm is the fact that I’m using the Raspberry Pi’s GPIO [general purpose input-output] pins to control the servos. Essentially, my program (written in Python) tells the Linux kernel to set the value of the pin (whether it’s high or low), and the kernel tells the hardware the same thing, however because Linux is a system on which many processes run at the same time, the kernel may prioritize a different process when the time comes to switch the pin’s state. As a result, the exact timing is probabilistic, but the timing requirements of the servo are quite a bit stricter: every 20ms a pulse of 1-2ms is expected, where a length of 1.5ms indicates the middle position. As a result, the signal coming out of the Raspberry Pi is indeed telling the servo to move like that, because there is no way to make it more precise.

There exist solutions for this issue, and most of them are based around a thing called “hardware PWM pins”, but the Raspberry Pi only has one of those that isn’t tied up in other tasks. The Arduino had quite a bit more, and in fact I originally tried to control the servos through the Arduino, but that didn’t work because there was some issues with the serial buffer overflowing or something, causing my entire program to lock up. I’m not exactly sure what the issue was, but unfortunately I didn’t have the time to figure it out.



Please enter your comment!
Please enter your name here

4 × 4 =