Skip to main content
added 122 characters in body
Source Link
Joris Groosman
  • 1.2k
  • 3
  • 11
  • 26

I'm using an LM35 temperature sensor, and it outputs 190 mV (which agrees with 19°C). I'm using an external reference voltage which I measure as 417mV. (This is set by the pin "aRefCntrl"). So I should have a reading around 467, but I get 1023, i.e. the ADC overflows. When I use the internal 1.1V reference I get a correct reading. Any ideas?

This is my code (Arduino waits for a request from the PC to send the data):

#define lm35 A0
#define aRefCtrl 10

void setup() {    
  pinMode(aRefCtrl, OUTPUT);
  digitalWrite(aRefCtrl, 0);
  analogReference(EXTERNAL);
  analogRead(lm35); // dummy read
  Serial.begin(9600);  
}  

void loop() {
  if ( Serial.available() ) {
    Serial.read(); // PC's request is a single byte
    int temperature = analogRead(lm35);
    Serial.println(temperature);    
  }
}   

follow-up on Ignacio's comment: would a decoupling capacitor do? (I can't test for the moment, I have to order some)

I'm using an LM35 temperature sensor, and it outputs 190 mV (which agrees with 19°C). I'm using an external reference voltage which I measure as 417mV. (This is set by the pin "aRefCntrl"). So I should have a reading around 467, but I get 1023, i.e. the ADC overflows. When I use the internal 1.1V reference I get a correct reading. Any ideas?

This is my code (Arduino waits for a request from the PC to send the data):

#define lm35 A0
#define aRefCtrl 10

void setup() {    
  pinMode(aRefCtrl, OUTPUT);
  digitalWrite(aRefCtrl, 0);
  analogReference(EXTERNAL);
  analogRead(lm35); // dummy read
  Serial.begin(9600);  
}  

void loop() {
  if ( Serial.available() ) {
    Serial.read(); // PC's request is a single byte
    int temperature = analogRead(lm35);
    Serial.println(temperature);    
  }
}   

I'm using an LM35 temperature sensor, and it outputs 190 mV (which agrees with 19°C). I'm using an external reference voltage which I measure as 417mV. (This is set by the pin "aRefCntrl"). So I should have a reading around 467, but I get 1023, i.e. the ADC overflows. When I use the internal 1.1V reference I get a correct reading. Any ideas?

This is my code (Arduino waits for a request from the PC to send the data):

#define lm35 A0
#define aRefCtrl 10

void setup() {    
  pinMode(aRefCtrl, OUTPUT);
  digitalWrite(aRefCtrl, 0);
  analogReference(EXTERNAL);
  analogRead(lm35); // dummy read
  Serial.begin(9600);  
}  

void loop() {
  if ( Serial.available() ) {
    Serial.read(); // PC's request is a single byte
    int temperature = analogRead(lm35);
    Serial.println(temperature);    
  }
}   

follow-up on Ignacio's comment: would a decoupling capacitor do? (I can't test for the moment, I have to order some)

Source Link
Joris Groosman
  • 1.2k
  • 3
  • 11
  • 26

Why does the ADC overflow when using an external Aref?

I'm using an LM35 temperature sensor, and it outputs 190 mV (which agrees with 19°C). I'm using an external reference voltage which I measure as 417mV. (This is set by the pin "aRefCntrl"). So I should have a reading around 467, but I get 1023, i.e. the ADC overflows. When I use the internal 1.1V reference I get a correct reading. Any ideas?

This is my code (Arduino waits for a request from the PC to send the data):

#define lm35 A0
#define aRefCtrl 10

void setup() {    
  pinMode(aRefCtrl, OUTPUT);
  digitalWrite(aRefCtrl, 0);
  analogReference(EXTERNAL);
  analogRead(lm35); // dummy read
  Serial.begin(9600);  
}  

void loop() {
  if ( Serial.available() ) {
    Serial.read(); // PC's request is a single byte
    int temperature = analogRead(lm35);
    Serial.println(temperature);    
  }
}