Multiple Servo Motor Control with Joystick and Arduino
HTML-код
- Опубликовано: 14 дек 2016
- In this tutorial, we will learn how to use multi-servo with Joystick. We will control two pcs servo motor with one Joystick. You can implement your robotic arm projects with reference to this tutorial. Of course we will use external battery / power when doing this.
Also see this project: mXY Board - Low-Budget XY Plotter Drawing Robot Board • Make XY plotter drawin...
Required Hardwares:
1x Arduino UNO R3:
bit.ly/2xt9MVk
amzn.to/2LZr6t4
2x Servo Motor:
bit.ly/2JfGtuj
amzn.to/3avwe1N
1x Joystick Module:
bit.ly/2kJkU7a
amzn.to/3u5097N
3 in 1 Jumper Wire:
bit.ly/2J6de9E
amzn.to/3doetmT
1x Breadboard:
bit.ly/2H9YSUa
amzn.to/3qxLxwm
Recommended Items:
Use Your Muscles in Project - amzn.to/3wdL45C
37 Sensor & Module Packages - amzn.to/3m66WeQ
Try this Robot Arm - amzn.to/3fq8DCl
Best Resin 3D Printer - amzn.to/39tY8KB
Arduino Compatible Kits - bit.ly/2J2AFF7
Banggood Spring Sale - bit.ly/3slMbOn
Source Code:
github.com/MertArduino/Multip...
Connections:
The external battery VCC / GND connect to the breadboard.
The Arduino GND connect to the breadboard's GND input
The Servo1 VCC and GND connect to the breadboard's VCC / GND inputs
The Servo1 Signal connect to the Arduino Digital PWM 3
The Servo2 VCC and GND connect to the breadboard's VCC / GND inputs
The Servo2 Signal connect to the Arduino Digital PWM 5
The Joystick GND connect to the Arduino GND
The Joystick VCC connect to the Arduino VCC
The Joystick 'X' (in some modules 'H') connect to the Arduino Analog 0
The Joystick 'Y' (in some modules 'V') connect to the Arduino Analog 1
The Joystick 'SW' (switch or button) not connected. Наука
Source Code: github.com/MertArduino/Multiple-Servo-Motor-Control-with-Joystick-and-Arduino
Recommended Items:
Use Your Muscles in Project - amzn.to/3wdL45C
37 Sensor & Module Packages - amzn.to/3m66WeQ
Try this Robot Arm - amzn.to/3fq8DCl
Best Resin 3D Printer - amzn.to/39tY8KB
Arduino Compatible Kits - bit.ly/2J2AFF7
Banggood Spring Sale - bit.ly/3slMbOn
I spent my entire weekend looking for a tutorial that describes how to set this up in full detail from a beginner standpoint. Thank you.
Same
I’m subbing to you dude, I’ve been needing this help with my project for a year and your the first person to help me in an easy way
Perfect. Came in clutch for my Engineering NEA exam. Thank you so much
Here is code people
//add the servo libary
#include
//define our servos
Servo servo1;
Servo servo2;
//define joystick pins (Analog)
int joyX = 0;
int joyY = 1;
//variable to read the values from the analog pins
int joyVal;
void setup ()
{
//attaches our servos on pins PWM 3-5
servo1.attach(3);
servo2.attach(5);
}
void loop ()
{
//read the value of joystick (betwen 0-1023)
joyVal = analogRead(joyX);
joyVal = map(joyVal, 0, 1023, 0, 180); //servo value betven 0-180
servo1.write(joyVal); //set the servo position acording to the joystick value
joyVal = analogRead(joyY);
joyVal = map (joyVal, 0, 1023, 0, 180);
servo2.write(joyVal);
delay(15);
}
Vidmantas Juska your a life saver!!
Thanks from Budapest!
Aciu!!! :-)
Thank You
thx
Your video helped out a lot in the turret project I was doing, thank you very much!
I appreciate this so much. Helped me a ton!
Awesome video, dude. First time using servos and i feel very accomplished. +1 like
cleanest video made for any Arduino project. Thank you for sharing!
Excellent and Such a simple explanation ….. People like you make this world a better place....
This was very helpful, thank you for the video!
Not All Heroes wearing capes. Thank you for the tutorial
Awesome Videos! Content and editing are great!
This is so under appreciated. Thy is had to be the best tutorial
Great video! Thanks for the info and demonstration.
Just bought an Arduino recently, and I hadn't read any of the documentation yet. Took me an hour to try and fiddle with the wonky 0-512,512-1024 range with some crude equations to have the servo move with the switch. Kept freezing and moving occasionally before I decided to look for a video like this :P.
谢谢,好视频,通俗易懂,看了就想自己尝试一下
a big thank you, this helped me with my little project.....
Excellent tutorial, Thanks!! It would have been extra cool if you had popped up a link to the sketch. Thanks again.
thank you for the video.. at last I got the exact video which I wanted
Great to see some new, good, arduino videos. Thanks
Thank you, it was very useful for me. Greetings from Hungary.
Simple and sweet
Thank you
I will try it in avr codings
Thank you. I have made your project, used different materials for the arms though. Awesome robot arm.
Can u guide me ?
And how can i contact you ?
This is my very first Arduino project and it worked great! I am so happy that I watched this video. Time for my next project, thanks a lot great video!
Didn't you have error in the code?
@@kamenstefanov2811 for me it does't work
@@kkrokingkiller456 it was a long time ago but i remeber that the mistake was very simple if you look closely you'd find it
@@kamenstefanov2811 thanks
Accidentaly ran into your channel. Subbed!
And like for the country music :)
Thank you, great tutorial!!!
It works! It works! The dislike button works! Joke, the circuit works and the like button works. Runs like my girlfriend.
Your welcome. Sorry to hear about your computer, I fix them for a living, xd.
@@zzzzzz...9902 good one XD
wtf bro
So dirty?
I have tuberculosis
Thank you, a really clear and helpful video. Appreciate your time in making it and for sharing.
Agreed! +1 Subscriber!
Holaaaa
A perfect tutorial....
Thank you it helped me a lot...😊😊
this is why i follow you, quality videos
Thank you, a very helpful video for me. I watch all your video to learn arduino...thx too much
Parabéns pelo vídeo e por compartilhar o seu conhecimento! 🙂
Thank you for the video. It really help me. How about use 3 servo motor?
This is amazing. Thank you. This will be my next project for sure. can you teach me how to replace one of those servos with a DC motor? :]
Very nice short clear video.
great dude
hey I wanted to make a simple nano quad using small DC motors(the one used in RC helicopters)
but how can I vary the speed of four motors simultaneously
please reply
Thank you very much! The wiring and code worked flawlessly! (copied code from video)
best tutorial ive seen so far! how would I make the servo stop at its givin location when I let off of the joystick?
probably set the position of the servo if the joystick returns to neutral as the last read value. I'm not sure how to you'd go about doing that but I'm sure there's a 'last' function
hope you will keep making more cool projects u earn my sub
great tutorial , thank you
man ty so much really what im looking for thank god bless u man!!! because i am searching this to make the robot arm actually😂
Me too
i'm a beginner....can i hook it up just as you directed, but have two servos work on the Y and one on the X axis. Thank You i find lots of useful stuff on your tutorials.
Eline sağlık , çok faydalı bir çalışma
sir if i want to connect servos on one aurdino and connect to NRF24L01 module and joystick on other aurdino with another NRF24L01 wireless module................then something change in code will occur or not?? can i put servos code to one ardino and analog joystick code on other ardiuno then it would be correct or not ?? if not then plz help me
can u pls instruct me how to controll aesc with rc tx interfacing with arduino .....reading the signal and then delivering them to the esc.
Thank you!! Subscribed...
thanks. i was looking for this to control servo for toy truck. i want to add servo to my police car shown in my recent video. any suggestions. i want to have moving wiper
Lovely clear tutorials Mert. Thank you. Just one concern, the servo in my kit looks identical (SG90), yet checking its operating voltage online it's 3.0-7.2v (ideally 4.8v). I don't want to blow it on my first attempt.
It’s blew my board! Don’t try it.
@Frectieyou don't need to add a battery if that is the servo spec, just plug it straight into the board
is there anyway to get the servos to hold their position until you want it to go more or another way?
SHOWWWWWWW.. PERFECT. CONGRATULATIONS
so i'd like to know how would i change the code if i dont want the motor to return to its initial position if i let go of the stick
Se pueden conectar 6 servos en paralelos 3 que se muevan en X y 3 que se muevan en Y? con este mismo procedimiento?
Thanks for this video 😄
Could you share the code to enable the joypads momentary switch to scroll through a 3rd servo channel. it 1000us 1500us and then on the third press 2000us
this is what i was looking for lol
finnaly i found it
how about 1 small servo and big servo do i need to add other components thanks?
is it ok if instead of using a custom battery unit, I use a power supply module?
//add the servo library
#include
//define our servos
Servo servo1;
Servo servo2;
//define joystick pins (Analog)
int joyX = 0;
int joyY = 1;
//variable to read the values from the analog pins
int joyVal;
void setup()
{
//attaches our servos on pin PWM 3-5
servo1.attach(3);
servo2.attach(5);
}
void loop()
{
//read the value of joystick (between 0-1023)
joyVal = analogRead(joyX);
joyVal = map (joyVal, 0, 1023, 0, 180); //servo value between 0-180
servo1.write(joyVal); //set the servo position according to the joystick value
joyVal = analogRead(joyY);
joyVal = map (joyVal, 0, 1023, 0, 180);
servo2.write(joyVal);
delay(15);
}
Plz make a wireless version using a bluetooth module but great video you just got a new sub!
Fazmi Sharaff i am agree with u
Thank you, great tutorial ;), what's the name of this song?
Is there any way to control the servos as a unit. I need both servos to go forward when i push the joystick forward but one to back off as i pull the stick sideways. All I’ve been able to find is the configuration shown in this video
THANK YOU FOR VIDEO
Nice project. Thank You. Will you please tell me about the music for this video?
wow soy de Colombia y me gustó el canal video, tiene un curso completo de Arduino?, Thanks
I know I am a late starter. But I would like to use the same setup but control 2 stepper motors instead. I am a complete noob, but could I use the same code?
Güzel video olmuş. Başarılar dilerim hocam.
Where can I get the external battery VCC/GND... I mean that part which connects to the wires
this looks fun
The problem is that when you release the joystick, the motor returns to the centre position. The code also needs some averaging to account for the jittery values from the A/D converter.
Have you found a solution to this?
Nice! I think this is what I was looking for! But is there a way to add ease in and ease out? In other words smoothing when starting and stopping. So it is not abrupt.
Also I noticed that I have 6 wires 3 black red and white on top and 3 on the side. Do they share the red wire?
Very helpful..Thank yu
hey just asking if i wanted a second joystick that controlled to more servos how would i do it?
I like schanel!Good!
it so nice! it works.
Hello Mert,
I want to do the same as this, only I want the stepper to make little steps as I move the joystick. and when I centre the joystick It should stay at the last location until I move the joystick again, hope you understand what I mean. Can you show us how you would change the code for that?
This is really good!!Can we create Simulink file for the same?
Hello i have got a 3dr iris+ and i have just bought a pan/tilt mount with sg90 servo is it possible that you would know how to connect it to i believe it is call a pixhawk v2.4.5
Thank you
don
Hi,how can I do to use switch (bouton ) of joystick?
hi im building a robotic hand , and i wanted to know if thers any way you could tell me how to control 5 servos with analog joysticks or one joystick to control all five
Como le hizo para poner el compilador de color negro
thank you! what music is playing?
Please I want to explain the work of reagent water.
Deciding on Arduino or Phidgets then I found your site. My project is controlling a valve with a 10k pot. I am told the only type I can use is a speed pot. But none available at 10k only 5k. The has 0-10vdc. As you turn to the left it closes the valve and to the right opens it. It needs to be somewhat sensitive. Can this be done with Arduino
Thanks
Charlie
The codes are easy to understand
you are king.thanks king
Sir if we move forward joy forward arm should move forward even joystick come to original position code please
Does the battery need to be connected directly to the breadboard, or can I connect it via the Arduino's power port?
can i connect two joysticks to the 9v and the gnd of the battery?
Can I ask you some question? Why does some of my servo rotate 360 degree? Thx. for tutorial. It's easy to understand :)
thx it works great!
It works.thank you
Thank you for such great code algorythm and so detailed comments //.... may god-machine bless you with his divine wisdom
I would like to know can that be made to handle a LARGE stepper motor,just on one axes(back and forth )
Is it ok to connect to 5V of the arduino board a 9V battery? The VIN pin is more suitable for that... I think .Cool video
GOOD video!.. can you make it with nfr24l01 please??...
hello it can be the same but that the Joystick is for remote remote control
best tuto
Hello, wonderful video. I built one with 4 servos. 2 servos are controlled if the button is not pressed. The other 2 are controlled when the button IS pressed. I can only control the second 2 when the button is pressed and held down. Is there a way to write a code so each time you click the button it switches back and forth between each servo set? Like if I click the button and then release it, it switches to one set. If I click it again and release it, it switches back to the first set. Is there a way to do this?
I know I'm late, but for those looking for the same thing here it is:
First of all, it's really easy. You just need a boolean which is either True (1st mode) or False (2d mode).
At the start of loop(), check if the button has been pressed, if so do this:
bool Mode = True// True will be the 1st mode and False is the 2d mode.
void loop(){
if (the button has been pressed)
Mode = !Mode // Doing this sets mode equal to the opposite of mode. So: if it's True, it will be False and vice versa.
// check if Mode is true, if so, control the first 2 servos
// check if Mode is false, if so control the last 2 servos
}
Awesome!!!!!!!!!!!!!!!!!!!!!!!!!!!!