top of page

Safari browser sometimes has issues displaying images...

I.e: *you have to click on the images to see them...

For a better browsing experience on Brainy-Bits

Please use Chrome, Edge or Firefox browser.

Writer's pictureBrainy-Bits

Do Potentiometer values make a difference with an Arduino?



OVERVIEW


In some Arduino projects we will end up using Potentiometers.


The potentiometer (or pot, as it is more commonly known) converts rotary or linear motion into a change of resistance that can be read by an Arduino analog pin.


But which value (ohms) should you use in your project?


Let’s find out if the Potentiometer Values have an impact when read from an Arduino.

 

PARTS USED


Arduino UNO

10K Potentiometer


These are Amazon affiliate links...

They don't cost you anything and it helps me keep the lights on

if you buy something on Amazon. Thank you!

 

CONNECTIONS




We are using 4 Potentiometer values: 10K, 50K, 100K and 500K.


The outer pins of each Pot is connected to 5V and Ground from the UNO through a breadboard.


Each Pot center (or Signal) pin, is connected to an Analog pin (A0-A3).


 

THE CODE


The sketch used to test is using the serial monitor to display the resulting values of each potentiometer values.

Since the Arduino is doing an Analog to Digital conversion, the results will be between 0-1023.


As always please have a look at the tutorial video for more information.


/*
  Analog input of different Potentiometers
  Testing 10K - 50K - 100K and 500K 

*/

// These constants won't change.  They're used to give names
// to the pins used:
#define analogInPin0 A0  // Analog input pin that the potentiometer is attached to
#define analogInPin1 A1  // Analog input pin that the potentiometer is attached to
#define analogInPin2 A2  // Analog input pin that the potentiometer is attached to
#define analogInPin3 A3  // Analog input pin that the potentiometer is attached to

void setup() {
  // initialize serial communications at 9600 bps 
  // (Make sure your Serial Monitor window is set to same)
  Serial.begin(9600);
}

void loop() {

  // display values on the serial monitor:  
  Serial.print("Pot-10K = ");
  Serial.print(analogRead(analogInPin0));
  
  Serial.print("    Pot-50K = ");
  Serial.print(analogRead(analogInPin1));
  
  Serial.print("    Pot-100K = ");
  Serial.print(analogRead(analogInPin2));
  
  Serial.print("    Pot-500K = ");
  Serial.println(analogRead(analogInPin3));

  // wait 10 milliseconds before the next loop  
  delay(100);
}


 

TUTORIAL VIDEO




 

DOWNLOAD


Copy the above Sketch code in your Arduino IDE software to program your Arduino.

1,838 views0 comments

Recent Posts

See All

All my content is and will always be Free.

If you feel that my Videos / Tutorials are helping, and you would like to contribute...

 You can toss some coins in the Tip Jar via PayPal.

Select amount then click the “Donate” button.

©2020 by Brainy-Bits

bottom of page