Hi guys,
I have a strange problem with the analogue inputs of my arduino. I’m reading 0-5V with 10 bit of resolution that gives a precision of 0,0048mV right?
The problem is if I put 0,005mV, 0,010mV or 0,015mV the analogueRead returns 0. Just after the 0,015mV it starts to return 1, 2, 3….1023.
Any idea what can be?
The code I’m using its very basic:
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(1000);
}
Thanks
In theory you are right in practice however ... the 10 bits are +- 1~2 bits (noise, thermal influences etc)
=> Does your Arduino power supply deliver a constant 5.00V? is there noise on the line?
If you want to measure such low voltages you should set AREF to INTERNAL using 1.1V as reference
see - analogReference() - Arduino Reference -
I have exactly 5.00V. I know that I can change the analogReference() but the thing is I need to use 0 to 5V. If I use 1.1V or in case of the mega 2.56V of reference the pin can only read to this value. Is there any other way?
Sorry. Yes you are right what I meant was V not mV. But do you know how to fix this problem?
big_jose:
Sorry. Yes you are right what I meant was V not mV. But do you know how to fix this problem?
I'm not even sure you have a problem, maybe just expectation of ADC performance that don't account for real world electrical noise both internal and external to the AVR chip. What are you using to generate the test voltages? What is the source impedance of the device that is generating the test voltages? At what analog input voltage do you see a one count returned? If you put a steady 2.5 Volt test signal to the analog input pin what count do you see returned and how steady is the reading? You are now in the analog electronics domain and there are many variables to account for rather then the more simple ON and OFF states of the digital domain.
Lefty
I have already fixed the problem that in fact wasn’t a problem just a limitation of the analog inputs. I solved this issue by adding offset voltage of 0.25V to have more correct readings.
Thanks anyway