Im using my Arduino DUE analog to digital converter to "Analogread" a voltage out of a seonsr
I modified my Analogrefrence source from 3.3 volt to 2.2
this is my code :
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
analogReadResolution(10);// Max. 12 Bit for Arduino DUE
float sensorValue = analogRead(A0);
float voltage = (sensorValue * (2.5 / 1023.0));//Analogrefrence 2.5 volt
Serial.println (voltage);
delay(200) ;
}
the code works correctly !
I figured out that my sensor have about 100 mV Voltageoffset when I try to substrace the offest from my variable "sensorValue" I recive strange values e.g. 980 esc. Can anyone tell me where is my failure ? Thanks in advance !
Maybe you should change the title: ADC .... doesn't work correctly is a poor title choice. Maybe, "Newbie needs assistance with Due ADC offset" or something similarly descriptive of what you really need. Titles that are posted by newbies that imply a fault in the hardware are often overlooked.
float voltageOffset= 0.106 ;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
analogReadResolution(10);// Max. 12 Bit for Arduino DUE
float sensorValue = analogRead(A0);
float voltage = (sensorValue-voltageOffset * (2.5 / 1023.0));//Analogrefrence 2.5 volt
Serial.println (voltage);