Arduino Robot Arm controlled by Joystick


Im starting a project for my final year at school - I want to build a robot arm with is controlled by a joystick. I need some guidance and maybe some explanation on how to get my servo to be controlled by the joystick. I will be having 5 servos - one at the base - 2 supporting the frame, one at the elbow and the final one with my robot claw. I dont know which joystick to get which will be able to control all these servos - or even if its possible for the joystick to control all these 5 servo’s functions :frowning: - Also how the codes would work? I’ve played around with one servo and was able to make it work but the prospect of 5 servo seems out of my reach :frowning:
Any help would be really appreciated - Thanks
-This is what im trying to achieve:

I would find a joystick with a few numbered buttons, the more buttons, the better. Keep in mind, you may also need to get a USB shield, otherwise you may need to scrap the motherboard and just directly solder the buttons and pots.

Tilting the joystick forward and back, would raise and lower the arm, and side to side would rotate the base. The buttons would control the other servos by how long they are pressed.

You could get some pots like below to start experimenting with the code (joysticks have pots inside).

Hi, First, keep it simple! Get an example working with a potentiometer or one potentiometer in a joystick.

There are example sketches on the ArduinoInfo.Info WIKI HERE:

See ServoPotPosition HERE:

There is an example of a joystick controlling two servos in pan and tilt at the bottom of the page on the ArduinoInfo.Info WIKI HERE:

Zee12: I want to build a robot arm with is controlled by a joystick. I need some guidance and maybe some explanation on how to get my servo to be controlled by the joystick.

Buy an RC transmitter/receiver pair - or a servo tester, if you prefer it to be less obvious that you're using standard off-the-shelf parts.

Unless there's more to this project then you're letting on - for example, some reverse kinematics - the electronics side should be a lazy afternoon's work.

Instead of the individual pots, you may want to get the below joysticks. If you want to control your arm somewhat like a large excavator, you would use two joysticks. I've ordered sky lanterns from the below vendor located in the US and they arrived within a week.

thanks for your replies- taking it all in :slight_smile:

I’m buying this joystick (

  • Will one of that be enough to control all my 5 servos?

Zee12: Will one of that be enough to control all my 5 servos?

It's a two-axis joystick. You have five servos. If you want to control each servo independently then you can do the math.

can you tell me a joystick that will be able to control all 5 please?

depending on how many buttons the joystick has, he could use these as shift keys, so stick axes l<>r does pan at base, but while button one is pushed it does claw open/close instead for example however this would allow only one motion at a time, although using two joysticks - one for each hand would enable a greater combination of simultaneous movements such as pan at base while raising arm and opening claw.

2 joystick will be enough for 5? though i intend to use 2of the servos as one? using a y-cable i will connect the 2 servos to act as one for my suporting arm (moving up and down) ?

Why not just get a game controller, like a PS2 controller. You have two joysticks, plenty of buttons for button combinations, and you don't need to make any platforms or cases to mount the pieces to. There is a working library in the Arduino playground (a few actually), that I myself have used in the past. It only uses pins 10-13 too.

my teacher wants me to use just a joystick to control the servos :( - i initially wanted to control them with a ps2 controller - but he says it can all be controlled by one joystick ( see this video someone did it - thats exactly what i want to achieve )

Ok, well that is done with case statements. Every time he press the joystick, it switches the case statement. Its easy to do yea, but then that means you need to know what case statement your in, so you will need some kind of display.

i have no idea what you just said lol (sorry new to this stuff but learning) can this still be done by the arduino program?

If you have to use only one joystick then I suggest you make it a two-button joystick

using the buttons as "Shift" keys to modify the arms axes you are manipulating. x axes - pan base y axes lift/lower arm

y axes+button 1 lift/lower at elbow joint

x axes+button 2 rotate hand/claw y axes+button 2 open/close hand/claw

okay, cool - ill try -could you send me a link to where i can buy a twobutton joystick please?

You make the two button joystick. Buy the joystick that your planing on getting, and also buy a tactile button. Wire them up, and your good to go.

okay will do thanks - how would the codes work?

The code will work exactly how krazydarcy described it.

Get reading from joystick and two buttons. If button_One is held down, and joystick moves, do action 1. else if button_two is held down, and joystick moves, do action 2. else do action 3.