Joystick with 2 servos

Hi! I’m new to this site and on the Arduino’s world.
I just want to move 2 servos (360 servos) with a joistick.
X axis for servo 1 and Y axis for servo 2.
When I move X axis on the right the servo 1 must run continuously in one direction, while when I move X axis to the left, the servo 1 must run continuously in the other direction.
The same for the Y axis.

1. I know how to connect it with “POT” and “SERVO” but exist a “JOISTICK” LIBRARY?
2. HOW CAN I MANAGE THE VELOCITY OF THE SERVO? (I need for follow focus, so very low velocity always).
Thank you

A joystick patch would just be 2 POTs, you can easily make your own joystick patch if you do not want to use the 2 POTs separately.

Velocity of a continuous rotation servo is controlled by the pulse; the farther it is from center, the faster the servo will move. If you never want it to move quickly, you can use the map node to keep the pulse closer to 0.5. i.e. map POT from 0 - 1 to 0.25 - 0.75 and use the output to control the servo.

Note that with variations between servos & POTs, you might need to add or subtract a calibration value from the POT output to make the servo stop when POT is in the center position.

2 Likes

Thank you for your kind answer, tomorrow will arrive the joistick so I’ll try… if I’ll not able to do it could you maybe help us with the develop of the project?

I tried to upload the project but I’m new user so I’m not allowed to do it.
Anyway I’ve used the “map-range” between Pot and Servo…it is right?
I’ve connected the VAL of POT to X of map-range and then the Xm to VAL of Servo.
if it is ok which value I have to put into the map-range component?

1 Like

Sounds like it is connected correctly.

The Smin/Smax are the minimum/maximum number for the source; in your case the POT output. Since POT outputs values between 0 & 1, those are your Smin/Smax values.

The Tmin/Tmax are the target values you want to output. This will depend on how fast you want the servo to be able to spin. Using 0.25 & 0.75 will cap the server at about 1/2 its maximum speed. If you want the servo to go faster, use numbers closer to 0 & 1. If the servo can go faster than you want it to, use values closer to 0.5.

1 Like

ok thank you. so the first value to 0.25 and the maximum to 0.75?
but if I want that in the middle position must stay in stop position…I have to set to Tmin=0 and Tmax=0.75?

The stop position of continuous rotation servos is 0.5. So if you use 0.25/0.75 as @gweimer suggested, the servo will stop when the joystick is idle. For `Tmin` and `Tmax` you may use any values with an equal difference to 0.5:

• 0.1 / 0.9
• 0.2 / 0.8
• 0.45 / 0.55
• etc

Oh, nice. They all give in 1 when added.

1 Like

Ok it works well but only with one Joystick, I think that the other is not so well built because in the middle position, the servo moves at very low velocity and if I move a little bit the Joystick up I can find the 0.5 position.
Now to solve this there is a possibility to have the movement only if the joystick is all the way up or down?
not smooth, like an on/off. Thank you

Instead of feeding POT output to map, you will need to feed it to two compare statements to check for <0.1 and >0.9 (or whatever thresh-hold values you want to use), then use if-else to determine what value should be fed to the servo. Here is an example; all numbers can be tweaked to change how far the joystick has to be pushed to turn the servo on and how fast the servo moves.

3 Likes

Perfect! you saved me! now it works very well…thank you very much, this forum is so helpful!

1 Like