Incorrect sensor reading

My arduino UNO is showing incorrect sensor reading on the serial monitor (2.7V instead of 2.5V), however when measured on back of board through the analog and GND soldering pins the value was as it was supposed to be (2.52V). So the problem seems to be with the ADC of Atmega328p micro controller. Could it be because of noise through power supply? Should i use a filter.

Also i was using ethernet shield placed over arduino UNO, however when i powered the board through a 7.5 V battery the lights on the shield were very dim and the program didnt run. And when measured the voltage on the jack (from behind the board) the voltage was 4.3 V. How can i power both arduino and ethernet shield using battery?


What kind of 7.2V battery? What kind of load is on the output pins? Need to see a wiring diagram + your program (between code tags please), like this:

[code]your program here [/code]


Actually its a 9 V carbon zinc battery but the voltage has come down to 7.5-7.6 volts. There isnt any load, i am just giving supply to sensor(5V) grounding on the board and taking the out voltage of sensor and giving to the analog input pin on arduino. Circuit diagram attached.

  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A2);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:

Circuit Diagram.JPG

If you have 7.5V on the jack the 5V pin should be close to 5V, if not then something is wrong with the board I guess, the 5V regulator on the board is there exactly to make the 5V be 5V within a percent or two.

Do you have any other loads being powered from the set up?

If your 9 volt battery is down to 7.5 volts, it's depleted. So it could be failing under the load of the Uno and sensor alone.