Arduino tutorial 7- How to control Servo motor with Arduino (code explained) | using servo library

  Рет қаралды 274,855

Tech at Home

Tech at Home

Күн бұрын

Пікірлер: 206
@dtharve
@dtharve Жыл бұрын
Perfect, this is what i need. I'm totally new to servos and arduino, but this seems pretty easy.
@techathome
@techathome Жыл бұрын
Thank you
@lalitpal6797
@lalitpal6797 3 жыл бұрын
That was simple and interesting. Awesome But the motor was not showing the 180 complete rotation.
@napkin62
@napkin62 2 жыл бұрын
Nice...for showing two different code to run servo motor....
@techathome
@techathome 9 ай бұрын
Thank you
@mustafayasir-x9f
@mustafayasir-x9f Жыл бұрын
No hate, But dont know the servo wont keep on repeating,it would only rotate once and then nothing would happen
@techathome
@techathome Жыл бұрын
The logic is inside the loop() so it should repeat. Did you change anything in the code?
@Kuch_bhi_krta_rehta_hu
@Kuch_bhi_krta_rehta_hu 7 ай бұрын
It's not repeating, I have tried same code
@1985onya
@1985onya 9 ай бұрын
Thanks Bro! How to modify the code so the motor rotates once in a hour?
@techathome
@techathome 9 ай бұрын
If you use delay it will not execute the remaining lines of program. You can search for millis in Arduino and its usage.
@1985onya
@1985onya 9 ай бұрын
@@techathome ok, Thanks
@stevemarshall2358
@stevemarshall2358 Жыл бұрын
Brother. I use this same code no error but when I uplode this servo blad is not move but a sound create. When I upload pre written code that written by module than work. what is the reason.
@fransbeno802
@fransbeno802 Жыл бұрын
Man thank you so much your video is lifesaver, this video help me on some of my projects
@techathome
@techathome Жыл бұрын
Welcome
@lenchata
@lenchata 2 жыл бұрын
Thank you so much, keep making videos mate!
@techathome
@techathome 2 жыл бұрын
Welcome
@shlokvarma8840
@shlokvarma8840 Жыл бұрын
Sir I uploaded the code but my motor is not working and I have putthe pins in the correct sockets so what's the problem?
@fullmetaltheorist
@fullmetaltheorist Жыл бұрын
Very useful tutorial. It helped me understand how servos work in a easy way.
@techathome
@techathome Жыл бұрын
Thank you ❤️
@thefunpig7221
@thefunpig7221 Жыл бұрын
Thank you you really help me. I just started today.
@techathome
@techathome Жыл бұрын
Welcome
@annikaguha191
@annikaguha191 10 ай бұрын
i did everything according to the video . code connection devise everything is proper the servo is just not rotating . what shold i do
@vsfgh
@vsfgh Жыл бұрын
So a bread board and resistors are not necessary, is that right? I'm new 😅
@techathome
@techathome Жыл бұрын
Yes , for controlling one servo breadboard not required
@samalesa5959
@samalesa5959 Жыл бұрын
seriously! this video is super
@techathome
@techathome Жыл бұрын
Thank you
@andyfog7444
@andyfog7444 Жыл бұрын
If I’m using four of these servos on an arduino uno, should I be using resistors and transistors? I’m learning the basics but am curious about what I can get away with without them :) thanks!
@wpb.andres5335
@wpb.andres5335 Жыл бұрын
get a servo driver module. you can connect up to 16 servos without resistors and transistors
@abhishekprajapati7830
@abhishekprajapati7830 5 ай бұрын
Sir is there any tutorial on servo motors functioning through IR sensor or ultrasonic sensors
@techathome
@techathome 5 ай бұрын
Not the specific one. But referring to few of my tutorials you can make. I have one video of controlling servo using potentiometer. Almost logic remains same. You have to replace potentiometer data with ultrasonic data.
@atulkhatavkar6986
@atulkhatavkar6986 Жыл бұрын
How to move each servo at different angle with for loop. Can u share Code plz
@keizaallera626
@keizaallera626 2 күн бұрын
Do you have a video abot robotic tank cleaner?
@techathome
@techathome Күн бұрын
No
@galagatron5319
@galagatron5319 Жыл бұрын
HI. I want to program 4 to 6 servos to do stuff individually. I have a servo driver pca9685. Im trying to make something with these motors and a couple of lights and sound. I do not want batteries. I want to be able to plug this thing in the wall with only one cord not 2. Looks like though I need 2 seperate power supplies. I cant find anything online. Something I buy? A hack? Thanks.
@yogeshgarg837
@yogeshgarg837 2 жыл бұрын
awesome video! greatly explained but the servo motor was not showing 180 degrees, it was only up to 17... degrees, in each servo motor I used even on tinkercad.
@techathome
@techathome 2 жыл бұрын
Thank you Standard value they give as 180 degree
@marbasfpv4639
@marbasfpv4639 10 ай бұрын
@@techathomeCan you compensate for this by passing a value > 180 ?
@BBoycire85
@BBoycire85 Жыл бұрын
Is there a way to tell what kind of servo one has? I have a GM90S, but apparently I have a continuous servo, and the coding behaviour is a little different. The one you have is a basic/positional servo. There are many mini servo shaped like this for sale, but it's hard to tell what kind they are
@MikeOnTheCamino
@MikeOnTheCamino Ай бұрын
It's easy. When unpowered a continuous will turn by hand continuously while a 180 degree servo will turn only 180 degrees as the name suggests. Mine are mostly 180 so I put a sticker with 360 on the few 360 (continuous) motors I have.
@Panchothefatcat
@Panchothefatcat 2 жыл бұрын
What is the wire you plugged in to 9?
@techathome
@techathome 2 жыл бұрын
Signal pin of servo (orange color)
@parshvtathed1643
@parshvtathed1643 Жыл бұрын
Excellent project Can we write If condition for servo motor Means If servo motor is 90 degree then led will on
@techathome
@techathome Жыл бұрын
Yes , you can do that
@parshvtathed1643
@parshvtathed1643 Жыл бұрын
Can you please give me code of it I mean how we can write IF condition in servo motor Thank you
@xdmh0n4y
@xdmh0n4y Жыл бұрын
hello, do you know how to code the servo when the right side sensor detect something it drops down and returns to it original position after delay then the left side when detected something is same as the right side?
@techathome
@techathome Жыл бұрын
yes we can do that, can you please send request on our mail
@TheLinkminer
@TheLinkminer 9 ай бұрын
Thank you for the servo lesson. Now I just need to figure out how to delay at 0 for 1sec then go to 90 and delay for 1 sec then to 180 and delay 1sec. Then repeat over again. I think i just have to put delays after each int and include a 90. Any thoughts?
@techathome
@techathome 9 ай бұрын
Welcome! Use this way inside the void loop function: write 0 degree delay(1000) write 90 degree delay(1000) write 180 degree delay(1000)
@12packadayhabit
@12packadayhabit 7 ай бұрын
on the second line when I try to declare the servo , I type "Servo" but it doesn't turn orange like yours does
@techathome
@techathome 7 ай бұрын
I guess you don't have servo library. Refer this video and try installing: kzbin.info/www/bejne/hnennp6wiL1rbdE
@BibhasMandal73
@BibhasMandal73 2 жыл бұрын
very easy and well explained
@techathome
@techathome 2 жыл бұрын
Thank you
@Chatwithfriend336
@Chatwithfriend336 7 ай бұрын
Motor driver(L298 )is important for that servo motor..???
@techathome
@techathome 7 ай бұрын
Not required
@dkpatel4199
@dkpatel4199 Жыл бұрын
Up to how much volts it provides? Can I connect a larger power consumption motor? And how to connect a motor in Arduino with its driver circuit
@techathome
@techathome Жыл бұрын
Arduino gives only 5v, if you are using bigger servo motor, then give external power supply. But which motor are you referring to, is it DC motor?
@dkpatel4199
@dkpatel4199 Жыл бұрын
@@techathome I want to use one DC motor, one Big servo motor, one metal detector sensor total 3 elements
@techathome
@techathome Жыл бұрын
DC motor driver : kzbin.info/www/bejne/j2mrnpWIZshql8k
@soccerfurever1073
@soccerfurever1073 Жыл бұрын
which wires on the servo motor go to which pins on the arduino?
@techathome
@techathome Жыл бұрын
Red: Vcc/5v Brown: GND Orange: 9 I have provided link in description for circuit and code.
@soccerfurever1073
@soccerfurever1073 Жыл бұрын
@@techathome thank you
@iitiangirl7807
@iitiangirl7807 Жыл бұрын
Which software did you use to coding? Can I do this in phone? Then which app? Give link?
@techathome
@techathome Жыл бұрын
It's Arduino software You can also do in phone,.use ArduinoDroid app
@DatNguyen-ff9fc
@DatNguyen-ff9fc Жыл бұрын
when i use the first code i.e. use (write) the servo rotates but when i use the second code i.e. function (for) the servo doesn't work you know what's wrong with my servo? thanks please help me
@techathome
@techathome Жыл бұрын
Can u send the complete code which is not working.
@pratikbaikar18
@pratikbaikar18 5 ай бұрын
Ye same code arduino nano me chlega?
@techathome
@techathome 5 ай бұрын
Yes
@jomfawad9255
@jomfawad9255 Жыл бұрын
Do the servo motors need to be connected to arduino while uploading the code?
@techathome
@techathome Жыл бұрын
No impact even if you keep connected or not. You can follow any way.
@Gaming101-e9d
@Gaming101-e9d Жыл бұрын
sir it is working when i connect it to the laptop but when i upload the code and disconnect from laptop and connect 9v battery in the battery source, it is not working
@techathome
@techathome Жыл бұрын
The 9v battery current might be not sufficient. Keep it as it is. But for servo motor connect external 5v supply. Refer this: drive.google.com/file/d/1rDYI3Pn6kmbSgGxOVU9p7irqRBT43GF9/view?usp=sharing
@ravindrapratapsingh7887
@ravindrapratapsingh7887 7 ай бұрын
Can we connect servo motor into 3.3v connector in arduino uno
@techathome
@techathome 7 ай бұрын
No
@pratikbaikar18
@pratikbaikar18 4 ай бұрын
How to remove com port error ...plz make vdo
@techathome
@techathome 4 ай бұрын
What is the error message??
@brightness8496
@brightness8496 Ай бұрын
Sir my servo stops working after few seconds.but why ?
@techathome
@techathome Ай бұрын
Try to give external 5v supply for servo motor. It might be taking more current and arduino is resetting.
@Moinuddinsir
@Moinuddinsir Жыл бұрын
bhai my servo is not working with this code also please help.i checked with servo tester it is working nice.
@techathome
@techathome Жыл бұрын
Have you connected the servo signal pin to the same one declared in the code
@shamasfoodzone
@shamasfoodzone Жыл бұрын
I can i make my servi motor roatate at 360 degrees continuously please tell a code
@shamasfoodzone
@shamasfoodzone Жыл бұрын
Servo motor
@techathome
@techathome Жыл бұрын
The servo motor I have shown cannot rotate 360. If you want 360 degree try to buy continuous rotation servo motor, but these doesn't have position control. Just keep rotating. If u want 360 degree and postion control, then go with stepper motors.
@pallvisharma2282
@pallvisharma2282 Жыл бұрын
My servo motor is fixed now after one time movement with the first code with 180 °. It is not moving at all now.Can you help me out???
@techathome
@techathome Жыл бұрын
Can you try to upload code with for loop
@pallvisharma2282
@pallvisharma2282 Жыл бұрын
@@techathome no no now its done after some time
@bishnukumar8363
@bishnukumar8363 Ай бұрын
What kind of servo motor is that ? 360 or 180 ?
@techathome
@techathome Ай бұрын
180
@madupuripavan1020
@madupuripavan1020 2 ай бұрын
Bro if we use delay(1000),then 1000 refers to milliseconds or what
@techathome
@techathome 2 ай бұрын
Yes 1000 milliseconds = 1 second
@kingofmonsters7452
@kingofmonsters7452 9 ай бұрын
Sg 90 have 360 degree roation?
@techathome
@techathome 9 ай бұрын
No, 180
@venkatasaivinayneelapala4735
@venkatasaivinayneelapala4735 Жыл бұрын
Where can i get those 3 jumpers
@techathome
@techathome Жыл бұрын
you can get in amazon also.
@leopugh
@leopugh Жыл бұрын
absolute fucking life saver mate
@youareafool5160
@youareafool5160 Жыл бұрын
Do u know arduino program for setting timer instead of delay eg: I want to run servo for 1min then stop for 30sec and repeat the process. we can give dealy for 1 min and 30 sec But what I need is to set time around 10min and above, providing delay for 10min or more isn't working on mega 2560 ,so is there any timer option to set a code for setting delays for larger time Eg: I want to run servo for 10min then stop for 5min and repeat the process.
@kieronfoo
@kieronfoo Жыл бұрын
Use (millis)
@RichardJones-lt7vm
@RichardJones-lt7vm Жыл бұрын
Great videos,,really helping me but when i set the delay to 15 my servo just 'judders' and will not complete the rotation
@frozenturtl827
@frozenturtl827 Жыл бұрын
Delay is in milliseconds, you need more time to let the servo actually move
@frozenturtl827
@frozenturtl827 Жыл бұрын
His code seems to give fifteen milliseconds for each singular degree as its turning, so 180 times 15 is the total time
@techathome
@techathome Жыл бұрын
Try to give more delay
@5_a_vihanks329
@5_a_vihanks329 Жыл бұрын
thank you very much
@techathome
@techathome Жыл бұрын
Welcome
@lalitrana9320
@lalitrana9320 Жыл бұрын
Hey what is within the delay why did u wrote it 10000 what will happen if I put 15in it
@techathome
@techathome Жыл бұрын
The syntax is delay(milliseconds); I have given 1000 ms = 1 second. If 15 ms = 0.015 seconds 1. Servo will go to 0 degree, 2. Wait there for 1 sec. 3. Come to 180. 4. Wait there for 1 sec.
@siddiquishoaib7929
@siddiquishoaib7929 2 жыл бұрын
I want to go deep in this,how can i?
@techathome
@techathome 2 жыл бұрын
You can watch all these basic tutorials: kzbin.info/aero/PL4B0LEKY-jrT_fjOGkX_NZ52ZHZf8s9S- Once you have basics, start doing projects, u can learn new things in every different project
@siddiquishoaib7929
@siddiquishoaib7929 2 жыл бұрын
@@techathome thank you for suggestions.
@mukeshkannaksrct
@mukeshkannaksrct 2 жыл бұрын
can we use 2 motors
@techathome
@techathome 2 жыл бұрын
Yes
@mukeshkannaksrct
@mukeshkannaksrct 2 жыл бұрын
@@techathome can i get u r mail id...
@techathome
@techathome 2 жыл бұрын
deepakhd20@gmail.com
@dylanspacedust7680
@dylanspacedust7680 Жыл бұрын
great video!
@techathome
@techathome Жыл бұрын
Thank you
@fatmahammad7699
@fatmahammad7699 2 жыл бұрын
The code in the description can't be opened, please write me the code
@techathome
@techathome 2 жыл бұрын
You have to extract that file using any of the softwares like WinRar, 7Zip etc.
@devidasgaude484
@devidasgaude484 5 ай бұрын
Which ardino model plz?
@techathome
@techathome 5 ай бұрын
Arduino Uno
@GinoongJam
@GinoongJam 7 ай бұрын
Do you have a circuit diagram? For school purposes only
@techathome
@techathome 7 ай бұрын
I have given link in description
@Dude_Slayer_69
@Dude_Slayer_69 3 ай бұрын
i know its four year later but still . i got an error . Failed uploading: uploading error: exit status 1
@techathome
@techathome 3 ай бұрын
Have you selected COM port?
@mvmanohar
@mvmanohar 2 жыл бұрын
thank you this video was great
@techathome
@techathome 2 жыл бұрын
Welcome
@onkarsugur1623
@onkarsugur1623 Жыл бұрын
Can you give a link of servomotor library?
@techathome
@techathome Жыл бұрын
www.arduino.cc/reference/en/libraries/servo/
@RC08197
@RC08197 Жыл бұрын
You r a good teache
@techathome
@techathome Жыл бұрын
Thank you
@snehalmisale7357
@snehalmisale7357 8 ай бұрын
Is this 180° or 360° servo motor?
@techathome
@techathome 8 ай бұрын
180
@Vasikaran-u9k
@Vasikaran-u9k 10 ай бұрын
How did go to prgrame pls pls tell
@Vasikaran-u9k
@Vasikaran-u9k 10 ай бұрын
😢😢😢😢
@techathome
@techathome 10 ай бұрын
Sorry, I didn't get your question.
@Venomfilledcats
@Venomfilledcats 9 ай бұрын
@@techathomeI think their asking how you opened the program to code
@manvithrai21
@manvithrai21 8 ай бұрын
Sir which app to run the code
@techathome
@techathome 8 ай бұрын
For computer you can download arduino IDE. For smartphone you can watch this video: kzbin.info/www/bejne/fqbIhIuqhraBgq8si=UnTleKtYCzfpJwp-
@divyomsrivastava6187
@divyomsrivastava6187 Жыл бұрын
How to stop the servo at 90°
@Anuj-100-d8m
@Anuj-100-d8m 4 ай бұрын
Thank your ❤❤❤
@techathome
@techathome 4 ай бұрын
Welcome ❤️
@athiganesh6130
@athiganesh6130 2 жыл бұрын
Thanks very helpful
@gouryvijayakumar8304
@gouryvijayakumar8304 11 ай бұрын
How to stop the servo motor after one loops
@techathome
@techathome 10 ай бұрын
Add that logic in setup function. It will execute only once. Keep the loop function empty.
@easyengineering392
@easyengineering392 Ай бұрын
S boss it's working
@asr_ast
@asr_ast Жыл бұрын
Good video
@techathome
@techathome Жыл бұрын
Thank you
@phadigaming3179
@phadigaming3179 3 жыл бұрын
give vidio on code of ultrasonic radar please
@techathome
@techathome 3 жыл бұрын
kzbin.info/www/bejne/Zn3LmJduhbagpJI
@omshah3324
@omshah3324 2 жыл бұрын
It says problem uploading to board. Please help
@techathome
@techathome 2 жыл бұрын
Check u have selected the port and arduino type properly.
@omshah3324
@omshah3324 2 жыл бұрын
@@techathome yes i figured it out, thankyou so much I am facing another problem with my IR, My IR has an LED itself, after connecting the circuit the LED stays on always with or without any obstacles near it, is it a problem in my connection or is the IR malfunctioning?
@techathome
@techathome 2 жыл бұрын
There will be a small pot on IR sensor module to change the sensitivity, I think this might be maximum, try to reduce it. kzbin.info/www/bejne/jZucfHWZg7aql6M
@omshah3324
@omshah3324 2 жыл бұрын
@@techathome It worked, thankyou so much bud, I'm a mechanical engineering student doing a IoT based project... Your videos have been a saviour
@omshah3324
@omshah3324 2 жыл бұрын
@@techathome Hello mate, I have made a set-up where i am using 2 IRs as input and a servo motor as output, both of them i have learnt referring to your videos... I am facing a minor problem, where the code is only taking input from one IR and the other IR is idle... Can you help me out please?
@Rebel-from-Hell
@Rebel-from-Hell Жыл бұрын
that was beautiful
@techathome
@techathome Жыл бұрын
Thank you
@cadillacescalade5428
@cadillacescalade5428 9 ай бұрын
You should have just added a simple link for this code haven to download a zip file just to retrieve a code is to much...... Zip files have a 100001 adds just way to much to deal with to get a simple code.
@techathome
@techathome 9 ай бұрын
I want to keep code and circuit in single file and same link. It is not complex if you use proper tools like 7Zip.
@cadillacescalade5428
@cadillacescalade5428 9 ай бұрын
@techathome I get that and I did download a 7zip app but lots of commercials 1 after the other. And I don't think it unzipped the folder
@wajeehhammad6711
@wajeehhammad6711 2 жыл бұрын
great vid
@techathome
@techathome 2 жыл бұрын
Thank you
@miran_zreative
@miran_zreative 2 жыл бұрын
thank you 😌
@techathome
@techathome 2 жыл бұрын
Welcome
@jpediting9771
@jpediting9771 8 ай бұрын
Sir I need help.
@techathome
@techathome 8 ай бұрын
Yes
@joshuatv7114
@joshuatv7114 Жыл бұрын
Thanks ❤️
@techathome
@techathome Жыл бұрын
Welcome
@Panchothefatcat
@Panchothefatcat Жыл бұрын
WHATS THAT WEBSITE?
@enes72356
@enes72356 Жыл бұрын
arduino software its not an app
@Panchothefatcat
@Panchothefatcat Жыл бұрын
@@enes72356 its an app
@techathome
@techathome Жыл бұрын
Arduino IDE
@hardikupadhyay5131
@hardikupadhyay5131 Жыл бұрын
redefinition of void loop error is coming.
@techathome
@techathome Жыл бұрын
Can you please send me the code u are using
@babyph65
@babyph65 2 жыл бұрын
mine doesnt work
@techathome
@techathome 2 жыл бұрын
What is the issue?
@babyph65
@babyph65 2 жыл бұрын
@@techathome its ok now, i think the files for servo missing so i installed the ide again. Thanks for concern❤️
@techathome
@techathome 2 жыл бұрын
Welcome
@zipityzap7675
@zipityzap7675 Ай бұрын
The servo is probably 160 degree max
@techathome
@techathome Ай бұрын
No, it should be more
@samruddhigaikwad2528
@samruddhigaikwad2528 2 жыл бұрын
Motor not rotate 360 please give proper working code
@techathome
@techathome 2 жыл бұрын
Servo motor have only 180 degree rotation, If you need 360 , then you have to go with stepper motor
@brijeshnayyar9773
@brijeshnayyar9773 2 жыл бұрын
Thanx brother
@techathome
@techathome 2 жыл бұрын
Welcome
@code-to-learn
@code-to-learn Жыл бұрын
Nice
@techathome
@techathome Жыл бұрын
Thank you
@MdAsrafulMercury-
@MdAsrafulMercury- 2 жыл бұрын
Need this software
@techathome
@techathome 2 жыл бұрын
Which one, Arduino ide?
@amaleshguha4163
@amaleshguha4163 2 жыл бұрын
Thanks
@FreddyFazfan
@FreddyFazfan Жыл бұрын
Nevermind i fixed it
@kabarangayviral
@kabarangayviral Жыл бұрын
oh no dont like mix content😅
@techathome
@techathome Жыл бұрын
I didn't get
@codmhumanoid9271
@codmhumanoid9271 Жыл бұрын
my servo motor became too hot
@techathome
@techathome Жыл бұрын
Have you given external 5v supply ?
@diazlorence1666
@diazlorence1666 7 ай бұрын
Jmmb
@techathome
@techathome 6 ай бұрын
?
@sribharathividyalaya-q3l
@sribharathividyalaya-q3l 9 ай бұрын
hii
@techathome
@techathome 9 ай бұрын
Hi
@meghakapoor7475
@meghakapoor7475 3 ай бұрын
Thanks🎉
@techathome
@techathome 3 ай бұрын
Welcome
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Servo Motors, how do they work?
15:12
The Engineering Mindset
Рет қаралды 2 МЛН
Arduino Tutorial 30: Understanding and Using Servos in Projects
18:05
Paul McWhorter
Рет қаралды 252 М.
Make a TINY Arduino Drone with FPV Camera - Will It Fly?
20:26
Max Imagination
Рет қаралды 1,5 МЛН
Beginner's Guide to Controlling Stepper Motors with Arduino
9:59
Rachel De Barros
Рет қаралды 37 М.
What is a Servo Motor and How it Works?
15:45
RealPars
Рет қаралды 2,1 МЛН
How To Make Robots Move Smoothly | Arduino Tutorial
12:28
James Bruton
Рет қаралды 772 М.
Mastering Servo Control: PCA9685 PWM Driver with Arduino Tutorial and Demo
7:50
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН