Arduino Tutorial 30: Understanding and Using Servos in Projects

  Рет қаралды 244,884

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 708
@grayson2455
@grayson2455 4 жыл бұрын
Anyone else feel sad when you have to disassemble a previous project to continue learning? A small price to pay for salvation...
@l.halawani
@l.halawani 3 жыл бұрын
nope.
@williamreisner894
@williamreisner894 3 жыл бұрын
Extremely
@turatsell
@turatsell 3 жыл бұрын
nope, but i have different problem- every free place is now occupied with Arduino Projects :)
@BHFJohnny
@BHFJohnny 3 жыл бұрын
A bit, but I know I could make it again so, not really.
@gundoggydog
@gundoggydog 3 жыл бұрын
hahahah was feeling exactly this
@adnan.khuzema396
@adnan.khuzema396 3 жыл бұрын
man, if you read this comment, I am inspired by people like you who does not charge for learning. Complete role model
@delandbrooks3291
@delandbrooks3291 2 жыл бұрын
True scholars share knowledge for the betterment of everyone. They have to eat but are not usually money driven.
@aaronmilliman7685
@aaronmilliman7685 2 жыл бұрын
So have you "Hooked a brother up yet"?
@FurkanOz480
@FurkanOz480 Жыл бұрын
@@aaronmilliman7685 xDDD
@andreasa1293
@andreasa1293 Жыл бұрын
@@aaronmilliman7685 heading over to his Patreon. Thanks for the reminder.
@rubenacruzorengo8592
@rubenacruzorengo8592 3 жыл бұрын
When I graduated, I'm going to give a big shoutout to PAUL MCWHORTER!! SHEEEESHHHHHHH!
@leJzer__
@leJzer__ 3 жыл бұрын
SHHHEEEEEEEEESHHHHH
@Anonymous-yy5qr
@Anonymous-yy5qr 3 жыл бұрын
SHEEEESHHHHHHH!
@imbaduknow
@imbaduknow 3 жыл бұрын
SHHHHEEEEEEESHHHH
@muhammadtamim451
@muhammadtamim451 3 жыл бұрын
In Bangla Shesh means Completed. Tai na?
@austinfox4130
@austinfox4130 2 жыл бұрын
@@muhammadtamim451 it's a pop culture thing in America in 2020. It's meaning has changed with time but right now it's sort just an exclamation.
@tiberiumihaescu7348
@tiberiumihaescu7348 5 жыл бұрын
That awesome feeling when you're actually excited about homework!
@thethubbedone
@thethubbedone 4 жыл бұрын
The delivery on the vodka joke was a work of art. Well done, Sir. Thanks for the excellent lessons, BTW
@freemind2pointo
@freemind2pointo 5 жыл бұрын
47 seconds in. I am subscribing. This guy is too real.
@brock1793
@brock1793 4 жыл бұрын
lol to real about coffee
@johnicebourne217
@johnicebourne217 4 ай бұрын
I am teacher John I am teaching Robotics in Primary Level I just want you to know that you saved my life. please be safe and take care of yourself the world needs you.
@paulmcwhorter
@paulmcwhorter 4 ай бұрын
Excellent!
@higuy2k
@higuy2k 4 жыл бұрын
Hello Paul and everyone, I have been following along with the lessons and have been thoroughly enjoying the series so far. Thank you for taking the time to put these videos together. I have completed all lessons so far. I got this assignement to work very nicely with the photo sensor. If anyone was wondering, I'm 36, and still do my homework, lol. Thanks again! Matt
@aaronmilliman7685
@aaronmilliman7685 2 жыл бұрын
AMEN, same here. This is my College because I have a family to support and the GI Bill didn't pay out. So this is my formal education to get me into the Sales and Service of Robotics.
@rishitsoneja307
@rishitsoneja307 Жыл бұрын
he is probably sponsored by elegoo by the way he talks about it + there's AdSense revenue
@wc2420
@wc2420 3 жыл бұрын
I had a difficult time with the servo wanting to return to the 0' position after the position was entered. At first the servo would hold position with the simple code, but once the serial monitoring was introduced it would first go to the "asked position" then return to 0' position. After doing extensive trouble shooting with codes and GTS-ing the issue, the solution was simply selecting "No line ending" on the serial monitor. Upon successfully trouble shooting this, the homework was a piece of cake. I love the math (finally understanding dependent vs independent variables when graphing them. Thank you Paul for the amazing lesions and topics!
@undiamecai
@undiamecai 2 жыл бұрын
this helped me a lot, thank you
@justinshankle
@justinshankle 2 жыл бұрын
I had the same issue, thanks for the posting the fix!
@ecksdude
@ecksdude 2 жыл бұрын
Many thanks. I'd have been banging my head on the wall, ran into this as well.
@zhangpico7th816
@zhangpico7th816 2 жыл бұрын
I had this problem, too!
@blazepascal1878
@blazepascal1878 2 жыл бұрын
Thank you for posting this, I had the same issue.
@perjohnsen5048
@perjohnsen5048 3 жыл бұрын
I like the fact that I can watch a whole tutorial without commercial breaks.
@Seanseerey
@Seanseerey 5 жыл бұрын
Us old guys appreciate your patience
@yakuppala9130
@yakuppala9130 4 жыл бұрын
when i start circle, servo moove 90 degree automaticly and when i stop circle, servo moove back firs position automaticly. Why?
@thomaspoole1429
@thomaspoole1429 4 жыл бұрын
Yakup Pala set serial monitor to now line ending’
@Blink-ut7uh
@Blink-ut7uh 4 жыл бұрын
Pick "No line ending" on the Serial monitor
@CascadePacificNW
@CascadePacificNW 4 жыл бұрын
@@thomaspoole1429 you're amazing
@themisf5077
@themisf5077 4 жыл бұрын
@@thomaspoole1429 Why does this thing happen ? Please tell me if you know !
@rj-rq5mj
@rj-rq5mj 4 жыл бұрын
@@themisf5077 are you still getting input from the Serial monitor? have you set the servo to something and then the monitor is resetting it?
@patbrennan7966
@patbrennan7966 2 жыл бұрын
Not having any background in this field, I started at tutorial 1 and played along bit by bit; making sure I understood everything before moving on. I surprised myself when I actually pulled this assignment off with ease. It pays to keep good notes, but mostly, it pays to have a teacher that knows how to teach. Many thanks Paul...
@highscores3503
@highscores3503 6 ай бұрын
two years ater im in the same boat. started from lesson 1 taking notes all along the way. about to start the homework once the kids nap but feel pretty confident in my ability to get it done. so far the biggest struggle was the toggle push botton to turn the light on and off. took way to long to realize i needed to put an if condition inside an if condition lol.
@ylevite
@ylevite Жыл бұрын
I did my homework. It worked! I have not ever done homework ever, not in school, never. Only in your course, Paul!
@chuckpickering6040
@chuckpickering6040 5 жыл бұрын
I have followed this tutorial, and every thing works. I modified the interactive script to also print the angle the server is at. I noticed a weirdness that I can't explain. I had to make a few changes in my print statements to get the print format I wanted. I noticed when reloading the code to test the formatting, the servo would reset to the 90 deg position each time. My code sets servoPos to 0 in the variable declaration. What is happening? I can past my code here if you like.
@zhangandy1174
@zhangandy1174 4 жыл бұрын
there is timeout issue, please use this code somewhere in the loop function, better at first line, Serial.setTimeout(50000); just type in a big number to solve it
@orndorff52
@orndorff52 4 жыл бұрын
Crushed it!!! I had to go refresh lesson 25 real quick, but it was smooth sailing after that
@cw4608
@cw4608 4 жыл бұрын
Lesson learned: If you power your servo off of a battery, make sure the Arduino and servo share a common ground or nothing happens. Also wondering why my servo returns to the zero position after each move.
@HeatherJordanJewelry
@HeatherJordanJewelry 4 жыл бұрын
I did the homework all by myself! :D I'm showing the assignments to my friends on Facebook so someone knows I'm actually doing the work. I don't know if I will ever use servo motors in any of my own projects but it's good practice and the challenge was fun.
@AndrewLanier.
@AndrewLanier. 3 жыл бұрын
Got a tip, if you want to use a bigger servo get a transistor and get a battery
@chrisingram7277
@chrisingram7277 5 жыл бұрын
Good Evening Paul, now that I've finished binge watching your videos and have seven days to finish the homework assignment, it's interesting to see that your other students are also going out and researching the current assignment. Several others have noted in the comments about the map() function that is found deep in the servo instructions on the arduino site, it goes to show how well we are all taking your assignments to task. Thanks for keeping us all thinking and learning.
@jonnyjohnson5025
@jonnyjohnson5025 4 жыл бұрын
The homework is where I have really set the things you've taught me! I am always excited for the homework. I like that you come up with the idea and then I need to make it real. Thank you, Paul!
@YourLifeWasting
@YourLifeWasting 4 жыл бұрын
hey paul can you take a look at my code for the assignment im not sure where I went wrong. #include int servoPin=9; int lightVal; int servoPos = lightVal; Servo myServo; int lightPin = A0; int DT=250; void setup() { Serial.begin(9600); myServo.attach(servoPin); pinMode(lightPin,INPUT); } void loop() { lightVal=analogRead(lightPin); delay(DT); Serial.print(" the servo is at angle "); Serial.println(lightVal); while (Serial.available() ==0) { servoPos=analogRead(lightVal); } myServo.write(servoPos); }
@kenmohler4081
@kenmohler4081 2 жыл бұрын
I wasn’t supposed to put vodka in my iced coffee? Well then, would bourbon be OK?
@hazcard449
@hazcard449 4 жыл бұрын
No vodka!?!?... I'm unsubscribing! 😉 Great lesson as always!
@aryarajendra1088
@aryarajendra1088 2 жыл бұрын
RIP to the guy, who had been drinking vodka instead of black coffee till now.
@GaryGraham-y7x
@GaryGraham-y7x Жыл бұрын
I did the home work and got the circuit and servo to work. I am a mechanical engineer which made it easier for me to figure out.
@harshityadav8934
@harshityadav8934 4 жыл бұрын
I am from India. And I love the way you explain everything in detail, And you inspire me a lot . Be heathy and be safe:-)
@imbored742
@imbored742 2 жыл бұрын
instructions unclear, made Blind Russian instead of iced coffee, tastes fantastic though.
@jerrylathem8634
@jerrylathem8634 4 жыл бұрын
My servo kept returning to zero so I added a serial.read to stop that. On the homework, I substituted 0 to 180° for the delay in the linear equation in lesson 26, it worked.
@aloysiusstaana
@aloysiusstaana 2 жыл бұрын
Yup Paul, I did the homework on my own. Thanks for the guidance. I think it's easy for us who has a n engineering background to put up the circuit and learn the programming. I'm already 54 and what I have only learned from my college days is BASIC and COBOL programming language. Thanks for putting up this arduino series of tutorial videos. It's really addicting..LOL
@andreiandrei8240
@andreiandrei8240 16 күн бұрын
It's been a while since the video was uploaded, but I wanted to say that I did the homeworked, I did it on my own and it worked (17:44) :) Thank you for being a great teacher
@paulmcwhorter
@paulmcwhorter 16 күн бұрын
Glad it helped!
@mitjaglobocnik8357
@mitjaglobocnik8357 2 жыл бұрын
My servo is returning to 0 position by itself...why?
@FULLUPE1
@FULLUPE1 5 жыл бұрын
Yes thank you sir ...I did the assignment and is working perfectly ...thanks once again
@markfuentes3666
@markfuentes3666 4 жыл бұрын
I have not had to do this type of math in 30 plus years. You are killing me. But, please do not stop giving us home work with math in them. I need to find and dust off my math hat. Thanks for these wonderful videos.
@leonardbenzies6374
@leonardbenzies6374 11 ай бұрын
It's amazing that companies can sell something that is not working properly, even being cheap. You would not have that 50 years ago, society is allowing the lowering of standards and other topics. Thanks Paul, your videos are great.
@moshikb
@moshikb 4 жыл бұрын
Hi, after the servo reches the angle i inputed on the serial monitor it resets and goes all the way to zero, anyone knows why? #include int servoPin=9; int servoPos; Servo myServo; void setup() { // put your setup code here, to run once: Serial.begin(9600); myServo.attach(servoPin); } void loop() { // put your main code here, to run repeatedly: Serial.println("what angle for the servo? "); while (Serial.available()==0){ } servoPos=Serial.parseInt(); myServo.write(servoPos); }
@paulmcwhorter
@paulmcwhorter 4 жыл бұрын
Make sure your serial monitor is set to no line ending.
@wesleymace6078
@wesleymace6078 4 жыл бұрын
@@paulmcwhorter Yes! That fixed it!
@johnellick7778
@johnellick7778 Жыл бұрын
I know it's been 3 years since these lessons were posted,but I'm a Newby to Arduino. I enjoy the little successes ,like seeing the servo motor moving for the first time. Thanks Paul for these awesome lessons. 👍
@astrodennis
@astrodennis Жыл бұрын
Hi Paul I did the assignment myself, and surprisingly found how I can apply it in prosthetics. Thanks alot
@Harrison-nq5ty
@Harrison-nq5ty 3 ай бұрын
I did my homework... I did it on my own ...and it worked
@metoliusdad
@metoliusdad 4 жыл бұрын
I did the homework. I did it on my own, AND IT WORKED!!!
@harshwardhanchaube706
@harshwardhanchaube706 3 жыл бұрын
Sir u r really great..........lots of love from INDIA
@fabrom7792
@fabrom7792 4 жыл бұрын
I did my homework and everything works nicely ! Wow, thanks to Paul, I'm becoming an Arduino programmer ;-) !! Fab from France
@abdullahmuslim280
@abdullahmuslim280 4 жыл бұрын
I did the homework!!! Also I am so glad that I have Kept on doing the Tutorials. They are better then any book I have read, when working with the Arduino and by far the Tutorials are the best on KZbin for the Arduino.
@preetamsingh147
@preetamsingh147 3 жыл бұрын
Hey man, I did the homework by myself. And it was fun. So, thank you so much
@laurentc864
@laurentc864 5 жыл бұрын
I succeeded in doing your homework. I am following you since the beginning. Thank you for sharing your skills and passion. Your structured way of explaining things does not only teach us a lot about Arduino, but also in addressing other little challenges in electronics and IT. -- A Belgian guy in London.
@robjameson7965
@robjameson7965 4 жыл бұрын
# = "Hash-tag" in Englsh. £ = Pound sign (as in money). Coming from the UK I learnt that at, funnily enough, Houston Airport once, when the automated telephone message, to order the hotel courtesy shuttle bus, was asking me to press the 'pound' sign on the keypad - too me about 20 mins to work it out!
@Win52D
@Win52D Жыл бұрын
Each servo is different, my range was 13 to 180. Putting it at 0 caused it to spin. Also, it looks like the Uno R4 can't source enough current to drive the servo by itself; the I/O pins are limited to 8mA. Great tutorial series! I will be using the series as a reference for future projects. Update: The R4 works fine, you just have to make to use pinMode if you use a variable. (Doesn't seem to be required on R3)
@DeeGeeDeFi
@DeeGeeDeFi 4 жыл бұрын
Hmm. When I use value of servoPosition of 0 to 9, my servo goes around and around continuously.... TowerPro MicroServo 9g SG90
@Laurenzollamass
@Laurenzollamass 7 ай бұрын
Aspiring top tech boi here. Pour-over coffee (black) and homework complete ✅ AND one step closer to building an automatic chicken coop door! Thanks for the great lessons Paul!
@amarkoshy1164
@amarkoshy1164 2 жыл бұрын
i did it on my own and it worked thank you
@richardalexander633
@richardalexander633 2 жыл бұрын
Just completed this one myself by referring back to lessons 25 and 26 for the code written in these and how to work the maths out. Great series of bitesize tutorials - very relaxed lesson style that's easy to digest - learning is best when it is fun and well explained. Thank you Paul for creating this.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Great job!
@hail2287
@hail2287 3 жыл бұрын
I owe my whole degree to this guy 😂
@yveslagace8212
@yveslagace8212 4 жыл бұрын
I did the homework yesterday, BOOM! It worked on my first try, I guess I am making a lot of progress with this Arduino contraption ;-)
@7dskei379
@7dskei379 3 жыл бұрын
Completed the homework. Had an initial circuit problem with reading my light sensor, but resolved it quickly. I have been a software engineer for roughly 6 years. I wanted to help a friend automate some hydroponics for his crops. Your tutorials have been amazingly helpful! I also saw your video on your high-tech hydroponics green house. I hope to have one of my own someday!
@katherineclarke4435
@katherineclarke4435 4 жыл бұрын
I managed to do the homework with some research from Tutorial 25 code. The bit that took the longest was working out the && in the middle setting, but I did it on my own. Very pleased with myself, lol. Great teaching, thanks Mr McWhorter!
@boowonder888
@boowonder888 5 жыл бұрын
Im back after a while. It just so happens I made a front end out of popsicle sticks for my diy RC car. I have attached the servo and now I need to program the arduino. I need to re study this. So let me get my drink......
@raminamiri9610
@raminamiri9610 2 жыл бұрын
I am a chemical engineer dealing with a project of sensor application. I have done it. Before your videos, I did not have any insight about electronics but now I can make things moves. Thank you so much for your great lessons.
@chrisgosling5408
@chrisgosling5408 2 жыл бұрын
Hello Paul, don't get stressed about the curly braces, hit return and this splits the braces with a line space. this helps to keep the formatting tidy as after writing some code it is very easy to forget the closing barce and cuts down on debugging due to poor writing.
@mosseautotech
@mosseautotech 2 жыл бұрын
Hey I have some problem with my coding, I can't verify or download it in the Arduino Uno, I try all my best but still nothing happened, I can't continue the lesson anymore 🙏🙏🙏🙏 Please I need help 🥺
@leebasham1107
@leebasham1107 17 күн бұрын
Watching the intro and see you have the S O S code running in the background, is this a cry for help? Looking forward this as i have a project in mind for a servo. By the way, in the UK the # is called a Hash. The pound sign is £
@michaela5532
@michaela5532 4 жыл бұрын
I did my homework and it worked after a looot of troubleshooting, haha. Very happy :). Thank you for this tutorial series - gives me something cool to do during the quarantine.
@erikvarga5212
@erikvarga5212 2 жыл бұрын
Best robotics teacher!
@AshwinKMenon
@AshwinKMenon 3 ай бұрын
/*Hello everyone here in this project i have combined all the thing * learned for Paul McWhorter sir up to this lecture video(30).Hope you enjoy making this. * For this project:- *tactile switches(x3) with pullUp resister (10kohm(x3)) * *(switch1)--> used for mode select * Mode1:-(red led on) we will use pot for changing the angle. * Mode2:-(red led and green led on) we will use switches for changing the angle. * Mode3:-(Both leds is off) reset *(switch2)--> used for increase the angle *(switch3)--> used for decrease the angle * 2 leds with 330ohms(x2) * * pot of 10kohm connect 104pf capacitor ground and middle pin to avoid jitter */ #include int buttonPin1=12; int buttonPin2=11; int buttonPin3=10; int pin1Read; int pin2Read; int pin3Read; int dt=200; int servoPin=9; int servoPos=90; int redLed=2; int greenLed=3; int potPin=A1; int potVal; int counter=0; Servo myServo; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(buttonPin1,INPUT); pinMode(buttonPin2,INPUT); pinMode(buttonPin3,INPUT); myServo.attach(servoPin); pinMode(redLed,OUTPUT); pinMode(greenLed,OUTPUT); } void loop() { // put your main code here, to run repeatedly: pin1Read=digitalRead(buttonPin1); pin2Read=digitalRead(buttonPin2); pin3Read=digitalRead(buttonPin3); digitalWrite(redLed,LOW); digitalWrite(greenLed,LOW); myServo.write(servoPos); if(pin1Read==0){ counter+=1; Serial.println(counter); } if(counter==1){ digitalWrite(redLed,HIGH); digitalWrite(greenLed,LOW); potVal=analogRead(potPin); //(0,0) (1022,180) //m=y2-y1/x2-x1 =(90./511.) //y-y1=m(x-x1) //y-0=(90./511.)(x-0) //y=(90./511.)*potVal; servoPos=(90./511.)*potVal; Serial.println(servoPos); myServo.write(servoPos); } //................................... //to operate with switches if(counter==2){ digitalWrite(redLed,HIGH); digitalWrite(greenLed,HIGH); //to increase the angle. if(pin2Read==0){ servoPos=servoPos+10; Serial.print(servoPos); myServo.write(servoPos); Serial.print("button2: "); Serial.println( pin2Read); } //to decrease the angle. if(pin3Read==0){ servoPos=servoPos-10; Serial.print(servoPos); myServo.write(servoPos); Serial.print("button3: "); Serial.println( pin3Read); } else if(servoPos180){ servoPos=180; } } if(counter==3){ counter=0; digitalWrite(redLed,LOW); digitalWrite(greenLed,LOW); } delay(dt); }
@manjunathop04
@manjunathop04 Жыл бұрын
#include int pin=9; int position; Servo motu; int r=A0; int v; int dt=150; void setup() { // put your setup code here, to run once: motu.attach(pin); pinMode(r,INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: v=analogRead(r); Serial.println(v); delay(dt); if(v>100){ position=0; motu.write(position); } else{ position=180; motu.write(position); } }
@ErlankBru
@ErlankBru 5 ай бұрын
I just did my homework and it work, even while it is 2:37am at this moment...'cause I LOVE this! If only I discovered this hobby a few years ago! Then I could've studied Arduino properly during hard lockdown in 2020 instead of being a LOT less productive!😇
@FelixSamulevich
@FelixSamulevich Ай бұрын
Lest tell about NEMA 17-32 connection in right way with drivers for . It can be very very interesting for variety of range of professional people
@filipbinda6703
@filipbinda6703 Ай бұрын
I did homework by myself. Thanks for teaching me. You are so helpfull!!!
@madmark2072
@madmark2072 4 жыл бұрын
Naied it with math boo ya !!! #include int servoPin=9; int servoPos=180; Servo myServo; int lightVal; int lightPin=A0; int dt(50); void setup() { // put your setup code here, to run once: Serial.begin(9600); myServo.attach(servoPin); } void loop() { // put your main code here, to run repeatedly: lightVal=analogRead(lightPin); Serial.print("the light val is "); Serial.println(lightVal); delay(dt); servoPos=(180/115)*lightVal-(6300/155); myServo.write(servoPos);
@DerekPower-i2d
@DerekPower-i2d 9 ай бұрын
Did it. Did the required calculations. Here is my result: angle = map(PRVal, 245, 613, 0, 160);//with photoresistor i had, measured 245 to 613 counts on a 1023 scale.
@emoraven88
@emoraven88 2 жыл бұрын
Hi, everyone. I had "Servo.h: No such file or directory" error. My spelling was correct and I found out that I actually have the library and the file in the correct places. I also had the library in the Sketch tab: Include Library/Arduino Libraries/Servo. The only solution that worked for me was going to the Sketch tab and selecting Include Library/Manage Libraries. On the "Type" filter I chose Installed and then I navigated to Servo. There I saw that I had Version 1.1.8 INSTALLED. I clicked on Select Version, then I selected Version 1.1.7 and I clicked Install. This fixed the problem for me. I hope someone finds this information helpful. I also did the homework by my self.
@gustavoescuderocanalantigu1491
@gustavoescuderocanalantigu1491 2 жыл бұрын
Homework! #include int servoPin=9; int servoPos; Servo myServo; int readV=A5; float valueV; int wait=500; int servoMin=10; int servoMax=165; void setup() { // put your setup code here, to run once: Serial.begin(9600); myServo.attach(servoPin); myServo.write(servoMin); delay(wait); pinMode(readV,INPUT); } void loop() { // put your main code here, to run repeatedly: valueV=analogRead(readV)*(5./1023.); servoPos=servoMin+(servoMax-servoMin)*valueV/5.; myServo.write(servoPos); Serial.print(valueV); Serial.println(" V"); Serial.print(servoPos); Serial.println(" °"); delay(wait); }
@wayneandrews1738
@wayneandrews1738 Жыл бұрын
I figured it out! Using if statements for a set of if statements to test maximum and minimum readings from the photo resistor, I used 45 degrees for Dark. Used 90 degrees for Cloudy, and 135 degrees for Sunny. If the value is somewhere between two if statements, the servo motor pointer oscillates. Used pin 9 for servo output . Using 5V or 0V (ground potential) for servo input does nothing. The Floppy (5 1/4" disk) like the 1541 drive for the C64 and the 3" "flippy".motors use an actuator to move the read-write arm pickup head across the slot thru the protective cover. Although the head floats above the surface. These motors use a set of 4 coils to rotate the shaft to very precise positions. It's hard to imagine, a 3" disk with a 1" or 5 1/2 " with a 2" slot and 80 writable tracks for the C64 or older PC that used them. Some copy protection schemes used half tracks. Now that's very precise movements! Wayne
@robertschuldenfrei2402
@robertschuldenfrei2402 10 ай бұрын
I was able to successfully do the assignment after watching this tutorial. You need to add the knowledge gleaned in Tutorial 14 about dimmable LEDs. The simulation (TinkerCAD) needed no delay time, but the real-world servo needed time to react. I used dt= 1000.
@MarvelBi
@MarvelBi 4 ай бұрын
Because of where my table, the only surface I can do this on, is kind of far from my not so bright living room light. I made mine using a handheld LED keychain light and it reads dark or bright. I did it first try by myself only having to tweak a few error in code on my part. You’re doing amazing as a teacher.🎉
@MechElec208
@MechElec208 17 күн бұрын
I did the homework. I did it on my own and it worked. Thanks again Paul for another terrific lesson!
@dougrowell7817
@dougrowell7817 3 жыл бұрын
I admit I don't do the homework per se. I watch the episodes and build a custom project using the info. Like a dimmable led to indicate 'system voltage". Sorry I used the 'special coloured LEDs but with good reason - a 'special occasion'. Pot adjusts the voltage, dimming the LED. Three 'digital' LEDs Green =3V/4V. >4 shuts the system down and sounds an active buzzer for 500ms. A pushbutton resets the system if voltage is set lower than alarm level. You have inspired me to change out the trim-pot for a pair of push buttons. I like to do it alone, but in bigger steps after seeing your vids. Great work Paul...and regarding complaints about taking too long - You have a target audience. If they are ahead of the game, choose a different tutor and support you at Patreon if they want a say in the content, otherwise it's free. Take it for what it is and be thankful. Some KZbin is rubbish, but you a re clearly a hard worker and very professional. Thanks again. Happy to be a Patreon. Be proud.
@misterdecaro
@misterdecaro 2 жыл бұрын
At 10:28 and beside myself! ADRIUNO uses Onject Oriented Programming (OOP)? Why didn't I look into this before! Super cool!
@shmoe820
@shmoe820 8 ай бұрын
I did it! Two new learnings today...I setup a file from scratch and I had void loop and void setup switched around! luckily I caught the mistake only after a few uploads of code. there were not errors. I was able to do this homework assignment but with some struggle. I had to think "do I need to use analog pins? what am I trying to receive from the equipment?"...I also had help with a little bit of googling. Rather than go back to your previous lectures on photoresistors, I was able to google "how to setup a photoresistor for aduino" and I found the wiring diagram quickly. With the lessons you have taught me, it was surprisingly uncomplicated. Without having followed your videos, I definitely would be looking at the bread board diagram with a puzzled look. Thank you Paul.
@edcox7666
@edcox7666 7 ай бұрын
Did that there homework on my own and successfully completed the homework. Although the sunfounder's servo would only go to 20 degrees, going to 0 degrees created erratic movement. Used the servo from the elegoo kit. Bingo we in business... Another great one! thank ya sir. O' hooked a brother up.
@eitancohen6056
@eitancohen6056 3 жыл бұрын
While trying running the simple program I got into a problem where Serial.available() return '1' twice (i.e. in the first and second lopp), thus the second time it reads 0. In order to fix that I had to add the following: while (Serial.available() != 0 ) { Serial.read(); Which actually fixed my problem, however, anyone has any idea what is the root cause and how to fix it?
@JeniMaguire
@JeniMaguire 5 ай бұрын
I also had an issue with servo going back to position 0. I tried the comment regarding 'No Line Ending' but that didn't resolve it. I googled and saw suggestions that the servo could be drawing too much current, and causing the arduino to reset. To test the theory I put a Serial.println(..) in the setup and sure enough it was getting invoked after the loop(), so it was resetting. I rewired it so the servo was powered from external supply (using the parts supplied in the kit) and everything is now working fine. I wanted to share in case others had similar issues. Thanks for a great series!!
@restorationrogue8992
@restorationrogue8992 Жыл бұрын
When I type in an angle, the servo goes to that angle, and then immediately returns to zero. I'm pretty certain that I've copied Paul's code exactly. Anybody have any ideas as to why the servo would go to the correct angle and then return to zero? EDIT: I figured it out. My Serial monitor had "New Line" selected in the preference drop=down. I change changed it to "No Line Ending and it worked.
@The2xWhiskey
@The2xWhiskey 5 ай бұрын
I'm building a Pinewood Derby Timer with provided code and want to incorporate a servo to actuate the release gate. This is going to help me immensely! Thank you!
@wayneswan3092
@wayneswan3092 3 жыл бұрын
the homework assignment wasn't that complicated. Sorry to say. Looking for a bigger challenge. IDK, Like maybe to build a Lego Technic Robot arm with technic compatible servos, and program it?
@souljr.
@souljr. 6 ай бұрын
Proud to say I nailed the homework from this lesson! May or may not have "cheated" and copied my code from one of the previous lessons. I figured this one functioned with the same principals as the photoresistor tone changing assignment. And I happily found out I was correct! Worked no problems and had the whole project running in less than 5 mins.
@steveholt8991
@steveholt8991 3 ай бұрын
Nice lesson. Did it myself after figuring out all the wiring connections. Made me think, thanks!
@binyammamo707
@binyammamo707 4 жыл бұрын
Hi Mr.Paul McWhorter you can remove the auto-brace completion if you have arduino IDE 1.8.3 or newer version. You just have to go to "files > preferences > then under the text saying 'more preferences can be edited directly in the file', there is a link which takes you to the location of 'prefernces.txt' . click on the link and open the 'prefernces.txt' file and on line 14 there will be some text saying 'editor.auto_close_braces=true' and then change 'true' to 'false'. BTW you have to close the arduino IDE after opening the .txt file. now save the preferences.txt file and close it. Now you can open the arduino IDE and you will see it stops to auto complete the braces. and you can find more information on the arduino forum. link >> forum.arduino.cc/index.php?topic=349103.0
@ishsiriram8286
@ishsiriram8286 4 жыл бұрын
Hi guys, sorry for the dump question. I don't understand the void loop. what is the value in printing …" what angle for the servo? There isn't any feedback angle being displayed!
@Jim-mn7yq
@Jim-mn7yq 4 жыл бұрын
Paul. I did the homework; I did it on my own; and it worked. And I'm sure there are many many others that have done the same. Very good lesson and one that fits into a future project that I'm anticipating building.
@thomasdiyaudio5353
@thomasdiyaudio5353 5 ай бұрын
The LED is blinking so I take it the board is powered on. Shouldn't it be powered off before physically connecting any hardware to it?
@doverivermedia3937
@doverivermedia3937 Жыл бұрын
for some reason, at '0' servoPos, mine starts spinning continuously, slowing down at 0' ... weird. maybe its a defective servo. Amazon shop tomorrow for me then ..
@jamesrichie7423
@jamesrichie7423 Жыл бұрын
Hi Paul, Thanks for your great works! I'm on lesson #30. Program can't find servo.h. Any suggestions?
@mayankshigaonker7725
@mayankshigaonker7725 5 жыл бұрын
/* * Written by Mayank A. Shigaonker * 13 years * * This is my code for the assignment * given by Sir Paul McWhorter in lesson 30. * * When there is a lot of light the servo * points in one direction and with less * light in the other. */ #include const uint8_t servoPin = 3; // The pin that the servo is connected to const uint8_t lightPin = A0; // The pin that the photo resistor is connected to Servo s; // Create a servo object void setup() { Serial.begin(9600); s.attach(servoPin); } void loop() { s.write(round(analogRead(lightPin) / 5.7)); // This will read the light from photo resistor divide it by 5.7 to get value very close to the angle of servo and then round it up } Well Sir after all of this i was thinking is possible to create your own library for your own servo. If so are you going to teach us in these tutorials. If not then could you please tell me where I could learn this. Thank you!!!!!!!!!!!!!!!!!
@paulmcwhorter
@paulmcwhorter 5 жыл бұрын
Not working on developing libraries, as at some point You have to rely on work of others or never get any projects done. you could try operating the servo by using PWM but you would have to do some research.
@mayankshigaonker7725
@mayankshigaonker7725 5 жыл бұрын
@@paulmcwhorter I have done some research after uploading this comment and as per what I read you need to output a pulse of 20 milli seconds or 50 Hertz and make the pulse go high only for 500 micro seconds (which will turn the servo to the 0 degree position) to 2.5 milli seconds (which will turn the servo to the 180 degree position). The rest of the pulse will be low.
@eetech_fix2393
@eetech_fix2393 5 жыл бұрын
@@mayankshigaonker7725 The servo write() function handles pulse manipulation behind the scene. You can accomplish that manually by use the writeMicroseconds() function that is part of the same servo library in this lesson. There’s even an example sketch. writeMicroseconds() writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On standard servos a parameter value of 1000 (1ms) is fully counter-clockwise, 2000 (2ms) is fully clockwise, and 1500 (1.5ms) is in the middle. some manufactures do not follow this standard very closely so servos often respond to values between 700uS and 2300uS. www.arduino.cc/en/Reference/ServoWriteMicroseconds www.horizonhobby.com/pdf/HRC33322S-Servo_Manual.pdf
@eetech_fix2393
@eetech_fix2393 5 жыл бұрын
Your code would not yield the linear progression desired from this exercise. It needs to in a more linear fashion. The way to do that is write an equation in either the point-slope or Y-intercept form. In this case, point-slope form, since the Y-intercept may not be apparent, y - y1 = m(x - x1). Example link below: i.imgur.com/VoIf8a4.jpg
@mayankshigaonker7725
@mayankshigaonker7725 5 жыл бұрын
@@eetech_fix2393 Hello thank you for telling I didn't know all this. But to tell you the truth I don't want to use the servo library I want to control the servo on my own. And well actually, I recently even created my own servo library by doing a lot of research in the last week. I saw videos on how to create library in general and then I learned how to directly manipulate registers of the atmega328P and then I saw videos on how to use Arduino timers. With all this information, a patient mind and lot of failures I finally have created my own servo library with only 3 available functions which are servo.attach(), servo.turn() and servo.detach(). Now when creating my own projects I will most probably never use the servo library given by Arduino not because it is bad but because I have my own library. But whatever thank you for telling.
@johnhechtlinger9465
@johnhechtlinger9465 8 ай бұрын
now I'm getting a black diamond with a white question mark in the serial monitor....my baud rate is 9600
@alanford7933
@alanford7933 3 жыл бұрын
As always a great tutorial. I'm using some slightly different hardware so have to compensate slightly. Keep going Paul I can see that loads of people including myself thoroughly enjoy the sessions. Many thanks from England P.S .Well done for spelling colour correctly in an earlier tutorial.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Cool, thanks
@briankelly4095
@briankelly4095 Жыл бұрын
My servo is pretty well behaved. It covers 0 - 180 degrees without complaining. My 'overcast meter' works as required. I am surprised that you seem to have got away without a pinMode statement for the servo control line. Does the attach statement take care of that?
@yadusolparterre
@yadusolparterre 4 жыл бұрын
This code doesn't work for me. I wrote exactly the same code and my servo keeps spinning without stopping. In the Serial monitor, I see that the position always goes back to 0 after it's changed... How come???
@hansronstadt3401
@hansronstadt3401 4 жыл бұрын
The code is java, but the Arduino can not make coffee!
@l.dexter4361
@l.dexter4361 2 жыл бұрын
Gee I hope I'm meeting McWhorter regulatory policies by drinking sugarless store-bought iced coffee :O
@Chris-m1x6o
@Chris-m1x6o Жыл бұрын
Hi Paul, I'm curious, I work on the repair and diagnosis on servo motors using the Mitchell electrics hardware/software.. as you're probably aware this costs each time I need to confirm correct alignment of resolvers encoders etc.. is there an option where I can create some sort of Arduino option for getting the basic parameters in order. Power supply and oscilloscope do part of ... Please give me some sort of setup or option which gives me access to setting each parameter for diff encoders / resolvers. Your help would be greatly appreciated 👍
@rolfvanderbijl
@rolfvanderbijl 3 жыл бұрын
I keep getting an error, according to the internet it's the Serial.parseInt(); After sending a number, it's registered, processed and processes again automatically, filling in 0 as the new value;
Arduino Tutorial 31: Using Servo in a Simple Project
37:51
Paul McWhorter
Рет қаралды 139 М.
Arduino Tutorial 32: Understanding and Using Joysticks in a Project
24:25
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 1,8 МЛН
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 69 МЛН
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 6 МЛН
Arduino Tutorial 25: Understanding Photoresistors and Photo Detectors
36:19
Using Servo Motors with Arduino
43:06
DroneBot Workshop
Рет қаралды 1,4 МЛН
Arduino Tutorial 35: Understanding How to Use a Stepper Motor
40:09
Paul McWhorter
Рет қаралды 298 М.
Arduino Tutorial 28: Using a Pushbutton as a Toggle Switch
21:58
Paul McWhorter
Рет қаралды 292 М.
Arduino Tutorial 29: Using Push Buttons to Create Dimmable LED
41:38
Paul McWhorter
Рет қаралды 142 М.
Arduino Tutorial 37: Understanding How to Control DC Motors in Projects
31:25
Arduino Tutorial 33: Understanding How to Control Servos with a Joystick
49:14
Arduino Tutorial 26: More Fun with Photo Resistors
31:38
Paul McWhorter
Рет қаралды 116 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 1,8 МЛН