loading

Step 3: Connecting the thumbstick (joystick)

The follwing connection will confuse you a little, just follow the picture.
Again using a bread board will make things easier.

1. The thumbstick has one U/R+ and one L/R+ this two connections will provide power to the joystick. Connect them to the Arduino 5V connection.
2.  Also the joystick has two L/R connections and two U/D connections it is important that you connect both of them to the respective arduino pin.
3.  Do the same to both GND connections on the joystick.

Thumbstick                     Arduino

L/R+  ----------------------     5V
U/D+ ----------------------     5V
GND  GND ---------------    GND
U/D U/D ------------------     Analog 4
L/R L/R -------------------    Analog 3


NOTE: Always double check the connections!!!

Advertisement

<p>Yay</p>
<p>hey guys i want a little help for my project...........<br>i want to control 4 servos with 2 joystick module,( with one joystick i want to control 2 servos from each axis)</p><p>i made the servo to rotate continuous by using some help from you tube </p><p>now i want that if i push the stick up than the servo start rotating and keep rotating until i release the pressure and when i release the pressure from stick the servo should stop immediately and when i push the stick down the servo start rotating in opposite direction (same for other axis with other servo ) , speed doesn't matter for me in this case i just want to use the stick as switches like when i push up it should start rotate clockwise and when i push down it start rotate counter clockwise,</p><p>can somebody please help me with the code and connection to the arduino.</p><p>thanks in advance.. :)</p>
<p>Is there a way for me to use a different joystick because I only have this one</p>
yes you can use this just connect 5v to arduino 5v and gnd to gnd and X to analog 1 and Y to analog 2 and leave sw
<p>I already bought the parallax joystick but thanks for your help</p>
<p>Awesome project! It only took me two tries to get it right. Although I was wondering how would you get the motors to hold position when moved? Any help is much appreciated. </p>
<p>Works great, thanks. I am using it just to pan the camera L/R - is there a way to speed up the process of the servo, to pan with relative speed and smoothness? Thanks</p>
<p>Solved - choose a better power supply for the Arduino - fast and smooth - thanks again - awesome</p>
<p>everything's working great but i can't get it to stop spinning :(</p><p>it should not be moving when im not touching the joystick</p><p>but even at an untouched resting state it's constantly rotating</p><p>please help!</p>
<p>Hey, great tutorials, thank you for posting them. I'm building a DIY camera pan/tilt head. I've applied your mouse control code and this works decently well, as long as I practice landing the ending position perfectly. The joystick solution is viable but my joystick returns to center. Normally a good thing but how could I have the last signal looped when I release the stick? as In, if the signal is moving above center it reads only those signals at it's current state or higher, until I drop the stick below center at which point the servo begins moving downward.</p>
Something wrong here, servos aren't moving. On the serial monitor I can notice the values change from 0-1023 when I move the joystick.<br>I have powered the servos with another power supply, 4xAA battery case. I have also grounded both the sources.<br><br>Just a clarification, this is Tower Pro SG90, Red connected to positive, Brown to Negative and Orange to PWM pin on arduino.<br><br>I have also grounded both power sources, another cable from negative or servo power source to GND (GND above the digital pins)<br><br>Kindly help.
<p>Fixed :)... some issue with the breadboard, needed to push the cable hard.</p>
<p>Just connect servo left to pinconnector 3 instead of 4.....otherwise you have to change the code in line &quot;const int servo1 = 3&quot; to &quot;const int servo1 = 4&quot;</p><p>Then it will work for sure !</p><p>Kind regards</p>
<p>Thanks very much Biomech75! My first project on Arduino!</p><p>Just one question, I'm using a different joystick and there is one pin called &quot;SW&quot;</p><p>I didn't connect it but everything works great. Do you know the function for this pin? </p><p>I will try 4 servos now :)</p><p>Cheers!!!</p>
<p>The SW pin is used for a push button build in in the joystick, if you press on the joystick it wil activate the button.</p><p>Here i have a link to a website that maybay complain some thing about the SW pin and how to use it.</p><p><a href="http://www.learningaboutelectronics.com/Articles/Arduino-2-axis-thumb-joystick.php" rel="nofollow">http://www.learningaboutelectronics.com/Articles/Arduino-2-axis-thumb-joystick.php</a></p>
<p>seems quite different to the above code. any ideas how to combine them? I tried and failed (couldn't verify)</p>
<p>Try to declare your button with INPUT_PULLUP :</p><p>pinMode(buttonPin, INPUT_PULLUP); </p><p>Source : http://arduino.stackexchange.com/questions/20747/turn-on-a-light-when-there-is-an-input/20748#20748</p>
<p>Nice and simple project!</p><p>Find below the code to use joystick in order to rotate the servos one step at a time:</p><p>https://github.com/bpangrati/servo_joy</p>
<p>Thanks! Awesome project, good instructions! </p>
<p>This<br>works great...So how do I change the code to move the servo 360 degrees in both<br>direction Left and Right or actual sweep of 180 degrees/175 degrees.I noticed when 180 is the value the actual<br>travel is 90&hellip;I would like to double that. Please help.</p>
<p>Can someone please make the switch (SW) work with this code? I have tried using http://www.learningaboutelectronics.com/Articles/Arduino-2-axis-thumb-joystick.php and http://www.electroschematics.com/8964/turn-on-led-button-arduino/ and have failed both times</p>
<p>Hi i was just wondering if this would work with a continuos servo </p>
<p>Hi, i love this project!! I wonder how <br>to let the camera reach the initial position (for example x=90 Y=90) when the <br>joystick button is pushed.</p><p>Thank you for your help</p>
<p>Hi, thanks a lot for this wonderful tutorial.</p><p>I am new to arduino and this being my first project, I am basically making a Rotary head for my Camera.</p><p>What I wanted was it to hold the position when I leave the Joystick. </p><p>Any suggestions?</p><p>Thanks </p>
<p>Look up while loop.</p><p>int pos = 0; </p><p>while(joy &gt; 0){ </p><p>pos++;</p><p>if(pos &gt; 180){</p><p>pos = 180;</p><p>}</p><p>servo.write(pos);</p><p>}</p><p>obiously this code wont work on its own but if you manage to fit this code into the one given my the autor it will sum 1 to the servo variable.</p>
<p>Hello,</p><p>Thanks for creating this instructable. I was just wondering, is it possible to power these 2 servos with my arduino, won't the burn overheat, get damaged or any other thing like that, especially when I am using a joystick as well :l Otherwise, great instructable.</p><p>Samuel</p>
<p>The Key on making this and other tutorials from INSTRUCTURABLES is that if it does not work, the start over again....all of us when doing an instructurable like this one wealso make mistakes so we start over and over again,,,just don't give up and HAVE FUN!!! (Bi()ME(H75</p>
<p>Hi there !</p><p>I'm doing my project which involves 1 Arduino DC Motor and 1 2-Axis Joystick REV B 27800 .</p><p>Struggling to put the pieces together so that the joystick is able to control the D Motor to move front and back according to the direction of the joystick i move to. With the use of the arduino board as well.</p><p>Please Help ! :(</p>
<p>Hi there!<br><br>I'm trying this tutoril for my project, </p><p>I'm using two servo: HS311 and HS422, A joystick (Keyes_SJoys), of course an Arduino, and I'm using a battery of 5v for the joystick.</p><p>I think i have the conections all right, but when I upload the program on the arduino, the servos start vribating, and don't respond to the joystick, i kept checking the conections on the joystick and it's all right, </p><p>What could else be?</p><p>Please help! D:</p>
<p>Well after whining like a baby to arduino on facebook and being upset with the lack of results from these instructions i deconstructed and reconstructed and finally got it. THANKS!!!!</p>
<p>Looks great! Can you add a gyroscope to horizontal axis to keep it level? Or even override the horizontal axis with a joystick if you wanted to?</p>
<p>Hello, I'm still very new to Arduino as well. I got everything hooked up and noticed an issue in the code. The left/right worked as planned, but the up/down did not respond. After going over the wiring, I looked at the code. I found that you have pwm pin 4 for the up/down, it is set to pin 3 in the code. Once I made the adjustment with the wiring, it worked great. Thank you for taking the time to make this Instructable. I found it very easy to follow, pictures helped a lot, and was fun. </p>
<p>i used 2 100k pots insted of a joystick and a pro mini 3v insted of a arduino uno but for some reson the servos arent moveing they only make the servo sound, so i thought maby it was becuse there not getting enouf power so i attached all the + wires to RAW and used 9 volts but it still only makes the sound if u have any idea what could fix this i'd realy like the help</p>
<p>hi the joystick that i found is different ,...</p><p>could you tell me,if will it be compatable with your project??</p><p>tanx,...</p>
<p>Yes, I will refer to his diagram.</p><p>Vcc is +5 (Red). Gnd is 0V (Black). Xout is L/R(yellow). Yout is U/D (blue)</p>
How to control the speed of brushless motor(esc) With The thumbstick
<p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/y52lG8M6kBY" width="500"></iframe></p><p>With laser added for effect. Everything was hot glued and shot under poor lighting, but it's still worth watching once. </p><p>The sound playing has one section of adult language!!!</p>
<p>Great Tutorial! What if I wanted to run two servos with two controllers? I am attempting to use modified continuous servos to drive wheels. With a tank steering, all I need is a u/d (or fwd/bwd motion. Any suggestions on how to code this?</p>
<p>i hooked it up to my sumo bot</p>
<p>For the bluetooth use XBEE shield for Arduino</p>
<p>Hi Biomech75 very nice Job. </p><p>I ask me if you got some troubles with delivering power to the servos I used a micro servo SG90 and it seems to not work that good as suppouse. </p><p>I know about a external source but when I attach the servo goes directly to one side and no moves. </p><p>Thanks for answering and create this tutorial.</p>
<p>arduino does not have enough current to power 2 servos and a joystick, especially not 2 of each. need a alternae power supply for either the joystick(s) or servos</p>
<p>That's the point a lot of tutorial teach to attach the servos at the arduino when this is not recomended by a lot xperts. </p>
<p>(sorry for my bad english, I am dutch)</p><p>A very usefull tutorial!! I am using it to control my electric BBgun (still a prototype)</p><p>I have one question: how can i control the (vuur meganisme) firemeganisem with a butten. It's a motor that needs to run on 9-12 Volts. </p><p>The joystick I am using has a small pussbutton build in it.</p>
<p>i almost forgot </p><p>I have also a Ka03 Motorshield. maybay usefull for the motor? i can have a max ammount of 50 external volt's.</p>
<p>Nice notes!!</p><p>And I have two questions</p><p>First, how can I move the joystick a little bit and back, then the servo move and stop right there not back to original place?</p><p>Second, how can I use bluetooth to connect two arduino boards? One is for sending signal and the other one for receiving the signal.</p>
<p>i hooked it up to my mini sumo bot and it still worked</p>
<p>Great tutorial,how could i sent joystick data via Bluetooth any help with a basic code example would be very much appreciated. </p>

About This Instructable

194,645views

329favorites

License:

Bio: Evo 8, Honda K, B Engines Mods
More by biomech75:Arduino thumbstick controller Arduino+Servo+Potentiometer Arduino Robotic Arm 
Add instructable to: