Pages: [1]   Go Down
Author Topic: Incorrect voltages at analog pins  (Read 832 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

United States (Texas)
Offline Offline
God Member
*****
Karma: 3
Posts: 525
Arduino socks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sure sounds like you destroyed the adc. sorry smiley-sad no quick fixes there.
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


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

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26327
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

"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.

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It's a fine distinction, and little comfort, but it is probably the input mux that is fried.
Something's fried anyway smiley-razz
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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.
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged


Pages: [1]   Go Up
Jump to: