My name is Ahmad Shamshiri and I am presenting this tutorial from Canada.
Hi, welcome to Robojax. in this video I'm going to explain the usage of
potentiometer with Arduino. so first I'm going to explain what is a potentiometer?
how it looks like, and how the diagram works, and after that we will have two
projects using the potentiometer. the first one we will measure the center tip
of a potentiometer as you rotate the potentiometer so you will get different
voltages. then I'm gonna show you how you can find the unknown value of resistor
by calculating it with Arduino. so let's get started. okay so this is the
potentiometer and it has three pins. so actually this part inside this housing
so from here it stores one resistor that comes and end here. and this is the
middle wire as you can see here on this diagram I am showing you so that is the
resistance between a and B that's a full resistance and W is at the middle one
which goes between point A to B so so actually is from a if if I look here if
you look here so this is a resistance now if I draw it so that is the
resistance from here to here and the W is the value that gets something in
between. so in this example we have a 10 kilo ohm resistance here this is the
potentiometer of 10 kilo ohm between this point and this portion is rotating
so you rotate it this way and that way so this is the handle this is the one
that you rotate so when you rotate it actually you are putting this in two
different positions as you can see here between point A and B and so what we do
is we connect this to 5 volts so this will be 5 volts and this will be
connected to ground. okay so I'm connecting this to the ground and from
the middle one we will read this value and see
for example from 5-volt to here because this is 5 volt that is video at the
middle if this is 10 kilo ohm at the middle we will get 5 kilo ohm at 5 kilo
ohm the voltage will be 2.5 volts exactly at the middle. so we will rotate
this and we will display different values. okay so this is the project that
that I have here initially at the setup() we have nothing except but setting up
and here it reads the analog from pin A0 so A0 these are analog analog 0 1 2 3 up to 5
so we have 5 analog ports here so A0 is here. because the voltage that we are
connecting is 5 volt we are multiplying it to (5 /1023) to get the voltage
value so that's the value that we are reading so this value that we
read from the center step is multiplied by this value which is 5 divided by that
so that is the voltage and we say go to serial monitor and print the voltage.
value is printed using this line. and now I just delayed by 100 millisecond or 10 times a
second it should display on the screen so. now let's connect this so when you
have potentiometer you just solder three wires and then these two sides its
important that the middle side should not be connected to 5 volts or the
ground. because you might damage your board. so very important. so these two
sides will be 5V and 0V or 0V or 5V doesn't matter. so I'm putting the gray into 5
volts so we have a 5 volt port here the third one from the left so that is 5
so I am now connecting this one to analog A0. now the system will read the
value for us. and you will see the value is already displayed for points it
depends on what we have put it so because the left side is now 5 volts I
know if I rotate this fully towards left if I rotate this fully towards left the
middle will be connected to the 5 volts so you will get close to 5 volt or
absolute 5 volts. so let me rotate it to the left fully and then see. you're
getting 4.798V so that is a voltage that is reading for
the five volts. as I rotate this to the right you see the value decreases
so we can see it become 3.1, 21 volts and if I put it fully on the
right side more and more so it goes towards zero so this is zero point on.e
this discrepancy that you're seeing is due to the fact that even when we put
the Foley on this side this is not zero if this point become fully zero we
should read zero. to test that and let me remove the potentiometer from here and
let me just show you you see now it shows the incorrect value so analog
A0 let me connect this so the analog is now this is a value that Arduino is
reading so if I connect this to 0, so if I connect this to the ground now you
will see that we are getting zero volts. so this input is connected to the ground
now I am removing it and putting it to the 5 volts you see we are getting 5
volts. okay now let's get started with this multi-turn potentiometers. so what
this is is this is very precise when you rotate this multi-turn potentiometers
the value changes very slowly so we will get the very precise value with this. one
so I'm connecting the three of those pins this is exactly the same as the
other one so the tripping is aligned here it shows also the diagram okay so
this is the resistance between this point and these these two points and you
are reading with a metal one so the same way the middle one is connected to
analog zero and I'm just inserting it whatever value read the system is
reading that's 4.2 volts
so slowly become 4.5 volts 4.6 as you can see 4.7 I'm you see this is decreasing
very slowly. and now we are at 4 3 4 point 2 and 3 volt
Determining the value of R (resistance) from the voltage.
now let's see the voltage that we are reading is of what value of R. so let's
find out. so here is a project at the top we are
sitting the R. R mean resistance T means potentiometer. so that's a potentiometer
value and then the unknown value of all R that you want to find out so it's
reading again the same as before as at the point a from A0 from analog 0
and here the value the same as before is just reading the voltage. now here we say
to find the R or convert that voltage and to resistance to find the exact
value of what resistance is producing that voltage. so this is a formula so
voltage times R T which is a 10 kilo ohm divided by 5 that will gives you R. and
I'm just printing it here on the screen so let me upload up so now I'm changing
the potentiometer and let's read the value here as you can see now it shows
at the current setting of this it shows
and that is the voltage. so we are reading the voltage here and that's a
resistance. so if this is 2 volts this is around 8 kilo ohm or 8,000 so let me
just change it now again I'm rotating it to the right so the voltage will
decrease
so let me make it one volt
so when it's one volt it's around 4000 ohm 4200 and so forth. so so I'm just
making it maximum
for maximum voltage corresponds to the maximum resistance since the higher the
voltage and maximum must be the resistance. okay this was a tutorial for
the potentiometer thank you very much
I am making new version of this, please check my channel and subscribe.
Subtitle currected/typed on Sep 15, 2020 by Ahmad Shamshiri in Canada
I did my part to help you learn. Now youc can simply subscribe 🔔 and thumb up 👍 the video and say "thank you"
If you wan to donate cash, my PayPal account is in the description.