Hi, Welcome to our video tutorial from Robojax. In this video I'm going to
show you how we can use multi turn or continuous or sometimes they call it 360
server. This server can be small or big but we are going to learn this video how
can we rotate it in one direction and the other direction or we can stop
it something like this. For example if I want to say make it left so it rotates
left or if I want right I can rotate it right and if I want to stop it
I can stop with something like that you can get the code for this project by
clicking at the link in the description below which will take you to
robojax.comaccom/learn/arduino Let's get started with this.
My name is Ahmad Shamshiri and I am presenting this tutorial from Canada
unlike this tiny server that rotates and up to 180 for example if enter L
so this goes from zero degree and if R enter our it goes to 180. this
continuous servo or 360 sometimes people call it will not stop because we don't
know where it will stop it will continue rotate and that's a big problem in terms
of understanding the position unless you use other means some kind of sensor here
and the position of this and as soon as I rotate so you have to do two things
first you have to find the exact location of starting point and also then
after that the direction of rotation so you have to record it through other
means and then after that you will be able to fully control this and stop it
and change the direction. If you don't do that you will be able to just
change a direction left or right or stop it in this video I'm going to show you
how you can do that so can you rotate it to one direction
and you can rotate it on the other direction or stop. It depending on the
quality of your servo you will be able to fully stop it and it needs some
experiment to achieve that and in this video I'm gonna explain through the code
and also do practically show you how this works. So this continuous servo
could be this size or may be this size or maybe even bigger but doesn't matter
the functionality is the same except the quality and sensitivity of the servo is
determining how much control you have over the movement of this 360 servo and
it's actually this package
Code Explained
when you enter the values here on serial monitor you're actually entering any
letter that you have in terms of ASCII characters. for example if you
enter K you're actually entering 107 so the Arduino is converting it. so you have
to have a means or mechanism to understand what it is and then use it
for that reason you need to use this ASCII table just do the Google or Bing
search and then find the tables. I'm just using it as an image here most of the
value that I will use will be around here I am entering left or L which is
108 and then I'm entering just R which 114 and then because and then I detect
and check if 108 I'm sending one value to the Servo and it's 114
I'm sending another value manually and then for stopping I'm using
one of these values and this on experimented you it's supposed to be
90 that stops. the capital Z but in my case it did not work so I have to
change it and it came to be around 60 to 69. these values less-than-sign < and all
those which I'm going to show you practically which one stops my Servo
but you will do the same thing so that program that I will offer you will help
you find that what value your Servo stops. not start. now but left and
right turning will be very easy because we are sending one command left or right
and then accordingly we will be able to change the direction of it. Let me now
explain the code. I've used the servo library which is included with Arduino ID
(Arduino Program) and this is just creating the object of this class myservo you
can change it to anything that you want but through the code you have to use the
same word. And then the position variable this is not being used. "incomingByte"
this is used when you type something from the command line
and this is 9600 baud. The value is of value that is used here so it must match
and then pin 9 is the pin that is used to control the servo. Servo is connected to pin 9. And inside the loop()
which is sort from here to here this line which says serial.available
that means if there is some value and it's bigger than zero which means there
is not empty space so when you enter something, it will return "TRUE" it will
continue otherwise it will not. Then it will go it goes to serial.read
whatever you enter it goes and stores and the incomingByte variable and then this is just
printing the character, the text that we have here; so you will see that.
And then we will print the value so this is actual value for example
for example if you enter a value which is a character which is controlling to rotates to left or L is in
after this we come and we check if it's 108 which is L then we say
sent so that is this sent value and then we say 0 sent 0 rotating clockwise and 0
rotating clockwise and then what we do is we send 0 right to my servo so this
is the one that command is sent to the servo to change the direction so this
doesn't mean it's rotating right or left and that is a problem. we have to find
out when you turn it on which way it rotates because it's very random but
this whatever direction it is it will just change it and then then we say else
if "r" is 114 this is a value so R small R 114 (in ASCII)
then we print the 114 and then after that we we also show that it's going
180 ideas sent so we are sending 180 but also
printing this text so this is the value that is sent so first we sent to make it
rotate in one direction and now we are sending 180 so we are sending either 0
or 180 and then here the value from my experiment was that if we put around 60
then we also print the text ,servo stopped so this is you have to experiment and find
out what value (for your Servo) it is from the this ASCII character table so initially less-than-sign <
was sending 60 and a stop. But if other servo worked but got hotter
after a few moments changed so greater than equal
sign on earth so value is close to around 60 was stopping the Servo fully.
and then we say if the value is not this value that you have experimented then we
just say random value and then whatever value you have will be transferred to
the server this time we're sending 60, 0, 180 but here whatever you enter the say
enter 62, 62 will be transferred and the loop continues like that
Wiring Explained
now let me explain the wiring because this needs at least 500 or 550mA milliampere
current Arduino is not able to supply that with 5 volts I've connected it to
external power supply that can supply that current. There are positive of that
signal so power supply is connected to the middle of this which is connected to
5 volt and then the ground GND of this one is connected to Arduino GND and
also I've connected another ground here so the ground of Arduino and this must
be common so this is connected to power supply and two of these or the ground
are connecte. The line that is an input signal for this is connected to
pin 9. And we are sending pulses modulation PMW to this device. The wiring is
the same as this small servo no difference except this servo if you're
not putting load on it can work directly with this Arduino. And you don't need
external power
Demonstration Now let me demonstrate it.
as you can see here this is now powered up and it's totally stopped and here
"random moving". as I've put. because depending on the circuitry
and the type of the servo you will have to enter different values so we have a
serial monitor here open and here opened the ASCII characters that we are
entering these values and the value that is transferred (or sent) to the Servo will be
this value this column which is a decimal value. Right now when I enter L
which means left I use left for counterclockwise and right for clockwise.
simple and I put this point (on servo) so we can see which way this is rotating. so right
now I'm entering L lowercase L and it's sitting left and then left or right
doesn't matter because it depends on what state this server has started and
if I put R here or 114 and to show you that R is 114 this is the 114
and I entered R. For L this will be 108 for that
reason you see these these two values and if i reset the
arduino you will see that this is rotating in some random direction. So
we have to keep in mind and now if i enter l or r doesn't matter
we just need to disturb it and give another value so if I enter L which
means I entered 108 but zero was sent so what we do is we send 0 or 180 and then
our well well send 180 to change the direction of this we just need to enter
0 or 180 now the problem is how we can stop it in order to stop it I've
experimented theoretically we have to enter something between 180 and 0 which
is 90 but 90 will not be able to do the job for us here. 90 is capital Z so
now if I enter capital Z it just slowed a little it did not work so I
tried different values and it turns out that this device will be turned off
around 68 or 65 and let's test it for example I'm entering equal sign (=)
which is 68 I entered equal sign and pressing enter
now this is stopped but still it seems there is a little juggling and it now
stopped so if I enters instead of the equal sign so I don't know if you can
hear it I'm getting it closer to microphone so this is now so I have to
increase the value I'm putting greater than sign (>) no change
let me put equal sign (=) still , try @ stopped it but because this is a
threshold current slowly within a few minutes it might change or it might not
depending the type of the type of the servo and how reliable and how
high-quality the serve ways it seems this is not as high-quality as I was
expecting you hear the buzzing. So I have to enter now capital A, B or C and D
under all capital letters starting with A as you can see here the value that you
see 61 62 63 64 so I have entered 64 which
is question mark (?) , @ and then entering capital A now stopped let's enter
capital B still good capital C capital D it started moving to the other
direction when I touch it I hear the vibration slowly it's trying so in order
to jump a little farther let's say if I entered N it has started but it is slow
meaning if you enter a value between 0 and 180 you can change the speed of that
so let me enter L which is 0 and R 180 but we can go in
something in between those values and get this but in order to stop it I can
enter capital A and as you can see it's still juggling so I have to go B C
capital D capital e F no it means I have to go smaller equal sign (=)
stopped it fully. and still do you see now is sort buzzing so you will try it
and find the value I believe internal electronic circuit of this is
determining at what value it will fully stop but theoretically it is supposed to
be stopped at 90 and few minutes or second maybe the resistors other
components will heat up and threshold of stopping this will change but so it
seems it's working so 64 was for example I found that is working .
This was how to use this continuous or 360 servo using Arduino or control it please
subscribe so you can get updates of my upcoming videos and also thumb up 👍 the
video and share that I appreciate it. If you have comment or question please
post it below in the comment section and I'll try to answer and reply.
to get All Robojax codes, visit robojax.com
you