Introduction: How to Control Servo With Play Station 2 Controller

I wanted an easy way to control my robots servo so i googled for a suitable solution but couldn't find one. so i decided to use my old ps2 controller for this purpose and it worked perfectly.

So here is a step by step guide for you to do the same..Hope you'll like it.. :)

Step 1: Thing You'll Need

1. Arduino UNO or any other arduino with pwm output x1

2. Breadboard x1

3. Hookup wires

4. Servo motors x1-4 (you can control upto four servo with this code)

5. Power source for Servos(arduino can't supply enough current,i used a variable voltage battery eliminator)

6. Play station 2 controller(I used wireless controller).

7. Soldering iron (For making a connector for ps2 controller,Skip this if you already have connector)

8. PC with Arduino IDE installed

9. Bill Porter's ps2x lib installed (Download it from here).

Step 2: Making the Connector

i'm not gonna explain this one in detail. Well i made my one with a broken ps2 multitap (luckily i found one laying around).So basically what i did here is that,i de-soldered the female connector from multitap and soldered some hookup wires and male headers with it

Step 3: The Circuit

Circuit here is pretty simple.just the connect the servo in the following manner :-

servo 1------------------> Arduino digital pin 9

servo 2------------------> Arduino digital pin 6

servo 3------------------> Arduino digital pin 5

servo 4------------------> Arduino digital pin 3

Now connect ps2 controller to arduino

Data-------------> Arduino digital pin 12

Clock------------> Arduino digital pin 13

Attention--------> Arduino digital pin 10

Command------> Arduino digital pin 11

Note- If you use external power source for the servos then don't forget to join GND of both arduino and power source.

Step 4: Arduino Code !!!

Now just upload this code to your arduino and you're ready to roll

Step 5: Troubleshooting

1. No controller Found -

check your wiring again or check this LINK for possible solutions

2. Servo jittering -

Try to feed servo with external power source.

Still have some issue???Feel free to comment and I'll try my best to solve it.

---------------->VOTE for my instructable in MIND FOR DESIGN contest if you like it<---------------------

Comments

author
Science102 made it!(author)2017-04-15

I tried to make this but I keep getting no controller found. I am using the lynxmotion ps2 controller (possible v2) with its receiver (a little black rectangle). I didn't use the connector that you showed above because I don't really understand what you did there.

The "pairing" light on my controller and receiver goes from blinking to solid after a little while. I assume this means that they are pairing properly. I would appreciate any help you can offer.

author
alexkirlian made it!(author)2017-04-01

Muito bom para aprender a usar o Joystick do PS2 no Arduino.

SÓ ESQUECERAM DOS RESISTORES PULLUP DO +5V PARA OS PINOS data e clock do joystick, pois sem eles não funciona !!

4f54a91e-75d0-4ab2-a6f4-94b525e1c258.jpg
author
TianxiZ1 made it!(author)2016-09-10

Is it possible to control those 2 servos with a RC I salvaged from a totaled RC car? In other words, can this be radio controlled instead of wired with a remote?

author
PeterCo014 made it!(author)2016-03-30

Hello,

Super your tutorial it made me much progress on my project.
I have a question, is it possible to control 6 servo motor.
4 with the joystick as currently and 2 by two buttons on the PS2 controller.

Can we vary the speed of the servo motor rather than the position because I need precision during movement.

I'm not very good at code all help is welcome: D, just give me the tracks if possible.
The project is to control a robotic arm with a clamp and a camera that can rotate left or right.

Thanking you in advance.

IMG_20160330_201731.jpg
author
PeterCo014 made it!(author)2016-03-30

Hello,

Super your tutorial it made me much progress on my project.
I have a question, is it possible to control 6 servo motor.
4 with the joystick as currently and 2 by two buttons on the PS2 controller.

Can we vary the speed of the servo motor rather than the position because I need precision during movement.

I'm not very good at code all help is welcome: D, just give me the tracks if possible.
The project is to control a robotic arm with a clamp and a camera that can rotate left or right.

Thanking you in advance.

IMG_20160330_201731.jpg
author
sushant+panaskar made it!(author)2015-09-17

can you plz send me the entire code......

author
SEVENAMI1 made it!(author)2015-05-26

Hello, what about PS3 controller?. It´s posible create a file code to control 4 servos to a Drone?! Awasome !

author
MayankTiwari04 made it!(author)2015-05-30

well my code works only for ps2 controller, but yeah their are other instructables for ps3 controller as well ,you can give them a try. and with my code you can control up to 4 servo easily.

author
Micha%C5%82M1 made it!(author)2015-05-25

Great idea! :D can I make this with arduino with atmega2560?

author
MayankTiwari04 made it!(author)2015-05-25

yes.. you can make one

author
epitts2 made it!(author)2015-05-16

I'd love to see if this could be expanded to control a houseboat with inboard screws and a gearbox to let them run independently from each other, to have it run like a zero-turning-radius mower or a tread hoe.

author
Kweek made it!(author)2015-05-19

pretty sure it could but that would be one ugly engraving.

author
Everything+impossible made it!(author)2015-05-17

Make it control a riding mower and you never have to actually mow ever agin!¡!!

author
Mig+Welder made it!(author)2015-05-18

haha with a failsafe kill switch... otherwise, run-away lawnmower!!

author
EvolvedAwesome made it!(author)2015-05-18

Awesome Idea!

author
mario59 made it!(author)2015-05-15

Thanks for sharing this *REALLY NICE IDEA* ! ! !

I wonder if it could be used to drive a Laser engraver CNC!

really nice & useful tipo to recicle old devices!!!

author
MayankTiwari04 made it!(author)2015-05-15

thanks mario59

author
umani1 made it!(author)2015-05-14

didnt understand the multitap point. kindly explain it in detail

author
MayankTiwari04 made it!(author)2015-05-14

its very simple buddy, when I took out the female connector from the multitap I found 9 pins on the back side of it as you can see in the pictures then soldered wires on each of that pin along with male headers.That's it !!!

IMG_20150513_211520687.jpg
author
pt_89 made it!(author)2015-05-14

Hey thanks for sharing this project its really a nice project

author
Patxipt made it!(author)2015-05-13

I made a similar project so many years ago, but using an AT90S2313 to control 8 servos. Never got around with the wireless controller protocol not working, so ended up with a wired setup for servo testing.

Thanks for this instructable!

author
MayankTiwari04 made it!(author)2015-05-14

I'm glad you like it :)

author
tomatoskins made it!(author)2015-05-13

Really cool project! Thanks for sharing!

About This Instructable

28,058views

498favorites

Bio: Just an ordinary guy...working towards a B.Tech in computer science engineering.
More by MayankTiwari04:How to control servo with play station 2 controller
Add instructable to: