Arduino tutorial 7- How to control Servo motor with Arduino (code explained) | using servo library
ฝัง
- เผยแพร่เมื่อ 12 พ.ค. 2020
- Part 7:
* Servo working
* Using Servo library
Code and Circuit : drive.google.com/file/d/1ZbaU...
Part-8 (Servo with Potentiometer) : • Control servo motor wi...
Learn Arduino programming even without components (Online Arduino Simulator) :
Tutorial video - • How to learn Arduino u...
-*-*-*-*-*-*-*-*
Product Links:
Arduino Uno : amzn.to/3C1vKxF
Servo Motor: amzn.to/3aLMDC2
*-*-*-*-*-*-*
Follow us on Instagram :
/ tech_at_home
Like us on Facebook :
/ tech-at-home-220885266...
#ArduinoTutorials#servo#techathome
Thanks for watching!
*Like Share and Subscribe - วิทยาศาสตร์และเทคโนโลยี
Perfect, this is what i need. I'm totally new to servos and arduino, but this seems pretty easy.
Thank you
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
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?
That was simple and interesting. Awesome
But the motor was not showing the 180 complete rotation.
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.
Very useful tutorial. It helped me understand how servos work in a easy way.
Thank you ❤️
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.
Thank you so much, keep making videos mate!
Welcome
Man thank you so much your video is lifesaver, this video help me on some of my projects
Welcome
Nice...for showing two different code to run servo motor....
Thank you
i did everything according to the video . code connection devise everything is proper the servo is just not rotating . what shold i do
on the second line when I try to declare the servo , I type "Servo" but it doesn't turn orange like yours does
Thank you you really help me. I just started today.
Welcome
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?
yes we can do that, can you please send request on our mail
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!
get a servo driver module. you can connect up to 16 servos without resistors and transistors
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?
Welcome!
Use this way inside the void loop function:
write 0 degree
delay(1000)
write 90 degree
delay(1000)
write 180 degree
delay(1000)
How to move each servo at different angle with for loop. Can u share Code plz
that was beautiful
Thank you
Thanks very helpful
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.
Use (millis)
thank you very much
Welcome
Do the servo motors need to be connected to arduino while uploading the code?
No impact even if you keep connected or not.
You can follow any way.
Which software did you use to coding? Can I do this in phone? Then which app? Give link?
It's Arduino software
You can also do in phone,.use ArduinoDroid app
Thanks Bro! How to modify the code so the motor rotates once in a hour?
If you use delay it will not execute the remaining lines of program. You can search for millis in Arduino and its usage.
@@techathome ok, Thanks
very easy and well explained
Thank you
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
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?
@@techathome I want to use one DC motor, one Big servo motor, one metal detector sensor total 3 elements
DC motor driver : th-cam.com/video/Y8HmbR1c7ag/w-d-xo.html
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
Can u send the complete code which is not working.
thank you this video was great
Welcome
which wires on the servo motor go to which pins on the arduino?
Red: Vcc/5v
Brown: GND
Orange: 9
I have provided link in description for circuit and code.
@@techathome thank you
seriously! this video is super
Thank you
What is the wire you plugged in to 9?
Signal pin of servo (orange color)
So a bread board and resistors are not necessary, is that right? I'm new 😅
Yes , for controlling one servo breadboard not required
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
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
absolute fucking life saver mate
How to stop the servo at 90°
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.
Thank you
Standard value they give as 180 degree
@@techathomeCan you compensate for this by passing a value > 180 ?
great video!
Thank you
Excellent project
Can we write If condition for servo motor
Means If servo motor is 90 degree then led will on
Yes , you can do that
Can you please give me code of it
I mean how we can write IF condition in servo motor
Thank you
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???
Can you try to upload code with for loop
@@techathome no no now its done after some time
bhai my servo is not working with this code also please help.i checked with servo tester it is working nice.
Have you connected the servo signal pin to the same one declared in the code
thank you 😌
Welcome
Thanks
Sg 90 have 360 degree roation?
No, 180
Great videos,,really helping me but when i set the delay to 15 my servo just 'judders' and will not complete the rotation
Delay is in milliseconds, you need more time to let the servo actually move
His code seems to give fifteen milliseconds for each singular degree as its turning, so 180 times 15 is the total time
Try to give more delay
Where can i get those 3 jumpers
you can get in amazon also.
great vid
Thank you
Hey what is within the delay why did u wrote it 10000 what will happen if I put 15in it
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.
Can you give a link of servomotor library?
www.arduino.cc/reference/en/libraries/servo/
Sir which app to run the code
For computer you can download arduino IDE.
For smartphone you can watch this video: th-cam.com/video/HueSXtQQNLM/w-d-xo.htmlsi=UnTleKtYCzfpJwp-
Thanks ❤️
Welcome
Is this 180° or 360° servo motor?
180
Thanx brother
Welcome
No hate, But dont know the servo wont keep on repeating,it would only rotate once and then nothing would happen
The logic is inside the loop() so it should repeat.
Did you change anything in the code?
Good video
Thank you
can we use 2 motors
Yes
@@techathome can i get u r mail id...
deepakhd20@gmail.com
Nice
Thank you
I can i make my servi motor roatate at 360 degrees continuously please tell a code
Servo motor
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.
How did go to prgrame pls pls tell
😢😢😢😢
Sorry, I didn't get your question.
@@techathomeI think their asking how you opened the program to code
The code in the description can't be opened, please write me the code
You have to extract that file using any of the softwares like WinRar, 7Zip etc.
You r a good teache
Thank you
How to stop the servo motor after one loops
Add that logic in setup function. It will execute only once.
Keep the loop function empty.
I want to go deep in this,how can i?
You can watch all these basic tutorials: th-cam.com/play/PL4B0LEKY-jrT_fjOGkX_NZ52ZHZf8s9S-.html
Once you have basics, start doing projects, u can learn new things in every different project
@@techathome thank you for suggestions.
give vidio on code of ultrasonic radar please
th-cam.com/video/0Lhgd8PQmn0/w-d-xo.html
Sir I need help.
Yes
It says problem uploading to board.
Please help
Check u have selected the port and arduino type properly.
@@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?
There will be a small pot on IR sensor module to change the sensitivity,
I think this might be maximum, try to reduce it.
th-cam.com/video/Wj9KBcNQwaA/w-d-xo.html
@@techathome It worked, thankyou so much bud, I'm a mechanical engineering student doing a IoT based project... Your videos have been a saviour
@@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?
WHATS THAT WEBSITE?
arduino software its not an app
@@enes72356 its an app
Arduino IDE
Need this software
Which one, Arduino ide?
mine doesnt work
What is the issue?
@@techathome its ok now, i think the files for servo missing so i installed the ide again. Thanks for concern❤️
Welcome
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.
I want to keep code and circuit in single file and same link. It is not complex if you use proper tools like 7Zip.
@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
redefinition of void loop error is coming.
Can you please send me the code u are using
Nevermind i fixed it
Motor not rotate 360 please give proper working code
Servo motor have only 180 degree rotation,
If you need 360 , then you have to go with stepper motor
oh no dont like mix content😅
I didn't get
hii
Hi
my servo motor became too hot
Have you given external 5v supply ?