Have you ever inspired by any walking servo or pixel rocket before? Did you have the urge to build a similar or even better prototype for yourself?
Since the servo is the easiest to be controlled, you should try to manipulate it into your joystick control. Yeah, your task for today is to create a simple joystick control with a servo over a USB connection.
Let’s start with the hardware part first, and what you need to do is:
- You need to make sure that the JR Sport ST47 standard servo is wired directly to Arduino’s 5V power and ground.
- Also, connect the servo’s control wire to Digital pin #2.
- The Arduino and the standard USB joystick need to be connected to a PC with a USB cable as well.
The software part includes a Python script (Interpreting inputs from the joystick) and the Arduino sketch. A common joystick normally has six different axes. The Python’s responsibility is to sense inputs from each axis, and then print the values of stick positions.
The joystick axis will reports a range of decimal values in between -1.0 and 1.0, with the zero means for center position. After it, the script converts the values into numbers between zero and 180 degree. This is the real value for the servo position.