Go Down

Topic: Incorrect voltages at analog pins (Read 901 times) previous topic - next topic

alexwd80

I am using a voltage divider to measure an input voltage with an analog pin. The problem is that none of the pins give the right reading. Each pin gives its own wrong answer (as compared to a multimeter), and stays at that value whether connected to the voltage source or completely disconnected.

As a reference, I tried connecting an analog pin to the Arduino's 5V source, which should give 1023. I also tried connecting it to ground, which should give 0. In both cases the reading didn't change. I tried using analogReference(DEFAULT) to make sure I was using the right reference, but that also did not change anything.

I am concerned that I damaged the chip. When setting up the divider, I accidentally connected a 13v source (wall wart) directly to one of the analog pins. Could I have damaged the ADC? Possibly related, the 5v source actually reads 4.6v from my multimeter (which I've verified is giving accurate results). Everything else seems to be operating fine - I can load sketches, set PWM outputs, etc.

Wanted to see if there might be any other reasons for these readings before I go and buy a new chip...

weirdo557

sure sounds like you destroyed the adc. sorry :( no quick fixes there.

GaryP

Show the code you are using, it would help. Nobody knows how experienced you are, so there might be just something little to be fixed. Or your board is toasted.

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

mowcius

Quote
Possibly related, the 5v source actually reads 4.6v from my multimeter (which I've verified is giving accurate results).

Well if that's when using USB that wouldn't surprise me - your USB ports might not be supplying 5V (like my desktop computer).

If you connected 13V into an analog pin, it is highly likely that your ADC is fried

AWOL

It's a fine distinction, and little comfort, but it is probably the input mux that is fried.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mowcius

Quote
It's a fine distinction, and little comfort, but it is probably the input mux that is fried.

Something's fried anyway :P

alexwd80

Thanks all for the responses. Sounds like the chip is shot. FWIW, here's my code:

Code: [Select]
int LastTime = 0;
float Vin1 = 0;
float Vin2 = 0;
float Iin = 0;
float R = 995.0 / 219.0; // voltage divider for Vin & Iin measurement
float Power = 0;
float test = 0;

void setup() {
  pinMode(6, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  analogWrite(6, 200);
 
  unsigned long Now = millis() / 500;

  test = analogRead(0);
  Vin1 = 5.0 * test/1023.0;
  //analogRead(  // converts to the voltage read by Arduino
  //Iin = Vin - 5.0 * analogRead(1)/1023.0; // voltage drop across shunt (as read by Arduino)
  Vin2 = 1.0 + Vin1 * R;                    // converts Arduino signal to actual input voltage
  Iin = 1.0 + Iin * R;                    // converts Arduino signal to actual voltage across shunt
  Iin = Iin / 0.235;                      // Current through shunt resistor at measured voltage drop
  //Power = Iin * Vin;
 
  if (Now >= LastTime + 4) {
    Serial.print(Vin1);
    Serial.print(", ");
    Serial.print(Vin2);
    Serial.print(", ");
    Serial.println(test);
    LastTime = Now;
  }
 
 
}


Also, yes I had it plugged into my computer, which would explain the 4.6V.

Any reason to think the board itself is damaged (Arduino Uno)? I'm planning to just buy an ATMEGA328 chip from sparkfun instead of buying a whole new Arduino.

Thanks.

jraskell

If the unit powers up and runs fine (short of ADC not working), then it's likely just the microcontroller chip that would need to be replaced.  It wouldn't be a bad idea to test some of the Digital IO points just to be sure (shouldn't be any problem there if you only connected 13V to the ADC points).

Go Up