Hello Everyone,
I am trying to work with this 5k potentiometer. I am getting a value between 100 on the low and 750 on the highest on my monitor. I would like your help please why am I not getting 0 and 1023 ? Is it a hardware problem or a software problem ?
I am using a Nano
here is my sketch :
int potPin = A6; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.println(val);
delay(200);
}
What resistance does your multimeter tell you it gives at either end of the range? When turned all the way left, the left + middle should give (near) zero resistance; when turned right that'd be the right + middle.
What resistance does your multimeter tell you it gives at either end of the range? When turned all the way left, the left + middle should give (near) zero resistance; when turned right that'd be the right + middle.
the middle pin is the output and the other pins are gnd and +5V
when I turn it left all the way: the value plays between 96 and 105
when I turn it right all the way: the value plays between 742 and 752
The arduino Nano has "Vin" "5V" and "3.3V" pins, show which you are using.
Can you also post a photograph of your circuit?
You are using a nano. the min is around 78 and the max around 933
for voltmeter the value at min is 0 V and at max it is 3.90V
Why is max=3.90? what is Vcc?
It may not be necessary but as good practice I'd like to see the analog pin declared as an input
pinMode(potPin, INPUT) ;
int potPin = A6; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.println(val);
delay(200);
}
johnerrington:
Can you provide a schematic so we can see how you are connecting it?
The arduino Nano has "Vin" "5V" and "3.3V" pins, show which you are using.
Can you also post a photograph of your circuit?
You are using a nano. the min is around 78 and the max around 933
for voltmeter the value at min is 0 V and at max it is 3.90V
Why is max=3.90? what is Vcc?
It may not be necessary but as good practice I'd like to see the analog pin declared as an input
pinMode(potPin, INPUT) ;
int potPin = A6; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.println(val);
delay(200);
}
Ok I am connecting the left pin of the pot to the GND and the right to the +5 coming from arduino, the middle pin to A7, and the VCC of arduino to nothing
I am not sure if my circuit picture would do any good because I have many ICs connected and 2 breaboards with capacitors, and many connected to the arduino. It is a circuit I started working on a year ago but I kept it on the table till now, it was time to continue with it for a project I was working on since. So I decided to start by checking if the pot is working by connecting it to the arduino and uploading its simple sketch
ok Gentlemen,
what I did is, I took the potentiometer and connected it to an arduino Uno with no connection at it but the potentiometer, and it worked perfectly ! I also tested an arduino nano which has no connections to it but the potentiometer and it also worked perfectly !
The potentiometer gave me readings from 0 to 1023, so do you think I should make no connections to the nano to get the right readings other than the potentiometer of course ? maybe because open connections would create problems ?