We can use the a power supply of arduino arduino if we have now consumed more than 300 milli ampere or we have the two or more micro, server or servo motor. That is that we will be using. We should use an external power supply shown here to avoid damaging our arduino uh since typically uh one turbo motor only have uh when it is rotating 100 to 250 milli ampere. So more than 300 milli ampere now could damage our arduino. So an external power supply is needed. Okay, now to connect your external power supply, okay, just connect, instead of connecting directly to five volts in our arduino. Okay, the one that you will now be using is the supply of the um external okay. The red will be connected to the positive five volts of our adapter in the bottom line. Is that, instead of three i three wires connected on our arduino? It will now be only two wires connected which is the ground and then the control wire right. The ground also should be connected to the adapter okay, two connections for the ground. So take note for that uh only the changes under the connection of five volts that will be supplied by the adapter itself. Okay, now let us proceed to the sketches and then the demonstration afterwards. Okay, so we have here the sketch of an arduino. We will be explaining that one okay, while we are to upload this code, so allow me to Music open to connect the arduino uno and then, together with the servo motor right there.

Okay, so opening the arduino in here and then okay yeah lets just copy the code initially before we explain and then the other one okay, ctrl t to auto format. Okay, double check, of course, your board with this arduino uno, uh, your home port, okay and then were now ready, uh press, the upload, save. Let me explain the code itself, okay. So since we are using now the uh servo motor, we will be calling, of course, the server library uh. Fortunately, we have uh an inbuilt okay uh in in build already upon downloading the arduino ide. We have here the servo library, so you can verify that one under sketch and then this include library. So basically we have now the servo motor library in it. Okay, so uh upon creating the uh servo library, num uh hash include the servo calling the arduino library all right. We have here the following of performing now: the creating an object right, creating an object, new object for the servo motor itself and then from the top uh this servo. Now my servo, you can have multiple a server it is connected for. You can call, depending on what you would uh Music name, that one you can say that my server one, my server two, my server three and so on. So you can change the code right to define that what your server now, depending on your microcontroller, you can change this uh pw pin okay uh into any pw digital pin on the your arduino itself.

Uh, in our case, lets just use the default one on our wirings again around okay in our writing, which is nine and then from that we have initialized uh variables, okay, for initial position, zero degrees. Now let us now proceed with our avoid set up. Menu were in recall now that pin on our uh servo library and then from that uh this one 20, 60, 80. 140. 180 is actually the angle right, the precise angle that we want our servo motor to uh move now. So there is a delay of 0.5 seconds in each of its rotation, so very um, straightforward tool to understand, depending on your application, you can modify this code. Okay, so uh. This one is the uploaded code. Already you can see here in my screen, open and upload uploading, okay, so 20, 60 and so on. And then, since we have that one on the loop, so from 180 degrees position, it will go back to the 20 degrees position based on the void loop, that we have okay performing another one based on our presentation. Here we need to another sketch that is inbuilt uh. We will be using inbuilt example here. Okay, let us proceed to the examples. The servo and the intercept. This example, as we have said, is very useful in debugging our Music uh, our sensors, all right our modules on the arduino. So basically, if you have the downloaded already the library so just proceed to a file examples, the one that you have downloaded the library, for example, in this case with the server.

So this is just utilize, this one so example then servo and then swift and then just upload okay. So no nothing will change. If we dont, i mean that will be changed depending on arduino. Is the tin all right Music? So let us scrutinize this one same. Calling the servo library and then, as you, can see, servo my servo, not nothing, will change initial position or the ingall Music and then attach a servo to pin 9. You can see and then just looping, so based on this one. The basic concept under for loop is that it will tell our servo okay to move one degrees at a time until 180 degrees right and then, if it turns up. If it now turns to 183 full rotation of our servo, it will go back counter. Clockwise right, as shown here right here, is the uploaded part, our arduino, so, as you can see here so moving from counter clockwise and then clockwise direction, okay, clockwise and then counterclockwise direction, h, f, one degree, movement, precise movement of our servo motor, okay, continuing with the Presentation here and okay, so basically were done with our presentation under servo motor, okay uh, the main. Let us just review what we have learned. So basically, we have discussed the concept of interfacing, the sg90 servo motor with a microcontroller. Basically, the concept is, it contains three wires on it, the positive, the five volts, the crown and then the control uh, where so thats it for interfacing the servo motor with the arduino.

The main concern that we have is when we have multiple servo motor that were working on so the best option, so that we will not damage our arduino is to connect an external power supply. Take note of the volts. It should be uh five to six volts. Only all right power supply just change the connection under the five volts, instead of connecting directly with arduino connected one on the adapter, so basically thats the main key point under interfacing. Our servo motor with our microcontroller just manipulate the codes that we have demonstrated to you and then shown to you then manipulate also under the examples and reserve water, and then you can do any applications that you would uh want to do. Okay and then we have demonstrated also all right, uh, the basic use of the cell servo motor to precisely control the rotation or linear movement of an object. Okay, specifically, we have shown you the rotation uh per specific position, okay, as shown here, and basically, we have just initialized for zero position here so from 20 degrees, all right, 60, 100, 140 and 180, and then our last code is that from the invid example and The reservoir motor it will um rotate one and from zero to 180 degrees back and forth. Okay, clockwise counter clockwise clockwise counter clockwise direction, so thats the concept and then the basic demonstration of how to use our servo motor okay so that that formally ends our presentation.

https://www.youtube.com/watch?v=3iHdsEuk2dE