Lowest Pot Value not 0

Hello,

For some odd reason, the lowest potentiometer values of the potentiometers that I am using stop at 6 or 7. I need it to go all the way down to 0. How do I fix this?

Heavier wiring?

Better pots?

The potentiometers should be fine. They were working fine a few hours ago

Great. Just get a DeLorean, and all will be good.

How do I fix this?

You don't. It's called end resistance.

Perhaps you have a low value pot as the effect is more pronounced as the value of the pot goes down. If The fact that the analog reading doesn't go to zero matters to your program, you're doing something wrong.

What resistor value, and what type (lin/log) pot are you using.
10kb (10kohm linear) is normally used here.

You can always 'fix' it with the map function, but you shouldn't have to.
Not going fully to the end is not normal, and could be a sign of a bad pot, or a pot that has been connected wrong before (burned track).
Leo..

avr_fred:
If The fact that the analog reading doesn't go to zero matters to your program, you're doing something wrong.

The reason it needs to go down to 0 is because I am making an RGB Color Picker. Each Potentiometer controls the amount of r, g, or b in an RGB LED.

Wawa:
What resistor value, and what type (lin/log) pot are you using.
10kb (10kohm linear) is normally used here.

You can always 'fix' it with the map function, but you shouldn't have to.
Not going fully to the end is not normal, and could be a sign of a bad pot, or a pot that has been connected wrong before (burned track).
Leo..

Here is the link to the product: https://www.amazon.com/gp/product/B019F8BXHQ/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
How do I use the map function?

The lowest value just went up to 16. Here is a picture of the circuit: IMG_0913.JPG - Google Drive

This is my code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 10, 9, 8, 7);

const int rPot=2;
const int gPot=1;
const int bPot=0;

const int rLED=6;
const int gLED=5;
const int bLED=3;

const int rInd=4;
const int gInd=2;
const int bInd=1;

void setup() {
  pinMode(rPot, INPUT);
  pinMode(gPot, INPUT);
  pinMode(bPot, INPUT);

  pinMode(rLED, OUTPUT);
  pinMode(gLED, OUTPUT);
  pinMode(bLED, OUTPUT);

  analogWrite(11,100);
  lcd.begin(16,2);
}

void loop() {

  int r=analogRead(rPot)/(1023/255);
  int b=analogRead(bPot)/(1023/255);
  int g=analogRead(gPot)/(1023/255);

  setColor(r, g, b);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("(");
  lcd.print(r);
  lcd.print(", ");
  lcd.print(g);
  lcd.print(", ");
  lcd.print(b);
  lcd.print(")");
  findHex(r,g,b);
  delay(1000);


}

void setColor(int r, int g, int b){
  analogWrite(rLED, r);
  analogWrite(gLED, g);
  analogWrite(bLED, b);
}

void findHex(int r, int g, int b){
  String rr = String(r, HEX);
  String gg = String(g, HEX);
  String bb = String(b, HEX);

  if (rr.length()==1){
    rr=rr+rr;
  }
  if (gg.length()==1){
    gg=gg+gg;
  }
  if (bb.length()==1){
    bb=bb+bb;
  }

  String hex=rr+gg+bb;

  lcd.setCursor(0,1);
  lcd.print("Hex:");
  lcd.print(hex);
}

Pots (5kB) seem ok.
Are you sure your pot ground connections are good.
Maybe wise to connect the three pot grounds to a separate ground pin of the Arduino
(not shared by other devices like the LCD).

int r=analogRead(rPot)/(1023/255);
etc.

could be written as

int r = analogRead(rPot) >> 2; // divide by four

Map and bitshift (>>) can be found in the IDE>Help>Reference.
Leo..

It's likely to be your wiring. The potentiometers need to have their own ground connection, directly to one of the Arduino GND pins.

The way you have it wired the current drawn by all the components on the breadboard flows through a single wire to the Arduino GND pin.

This current develops a voltage across that (resistive) wire, and hence the low voltage end of the potentiometers is a few 10s of millivolts above GND potential, which is causing your problem.

Solution:
Disconnect that orange link that you have at the centre of the GND rail on the breadboard, and connect left hand side (i.e. just the 3 potentiometers) with a new wire to one of the other GND pins on the Arduino.

Hi,
If you use map function, instead of multplying and dividing, you can adjust the zero output for non zero output.

Ops Picture


There are a lot of connections between gnd on the pots and gnd on the UNO.

Tom.. :slight_smile:

JohnLincoln:
It's likely to be your wiring. The potentiometers need to have their own ground connection, directly to one of the Arduino GND pins.

The way you have it wired the current drawn by all the components on the breadboard flows through a single wire to the Arduino GND pin.

This current develops a voltage across that (resistive) wire, and hence the low voltage end of the potentiometers is a few 10s of millivolts above GND potential, which is causing your problem.

Solution:
Disconnect that orange link that you have at the centre of the GND rail on the breadboard, and connect left hand side (i.e. just the 3 potentiometers) with a new wire to one of the other GND pins on the Arduino.

That solved it. Thank you so much!