Hi at all
I am working on getting the Grove - I2C ADC converter working.
I chose this device because it has 12 bit resolution and is fast.
It interfaces with a Teensy 4.1.
Perfect grounds and power supplies.
Accuracy of my voltmeter: on a calibrated and stable source of 10,000 volts it reads 9.999V.
The ADC board is powered by a stable reference voltage REF02 of 5 volts, 4.98 volts real.
The ADC reference voltage is the internal 3 volt reference.
The documentation available on the board is poor, basically a reading routine that however works fine.
Problems:
Accuracy: with an input voltage of 1,250 volts measured with the voltmeter, on the Arduino serial monitor appears 1.192V, 60 mV less;
I didn't expect this from a 12-bit converter, I expected max +/- 0.7mV inaccuracy;
The original sw is available on https:/ /wiki.seeedstudio.com/Grove-I2C_ADC/
A summary of the SW:
#define V_REF 3.00 //Internal 3 volt reference
unsigned int getData;
unsigned int Raw;
//SUBROUTINE DECLARATION
void init_adc() {
Wire.beginTransmission(ADDR_ADC121);
Wire.write(REG_ADDR_CONFIG);
Wire.write(0x20);
Wire.endTransmission();
}
void read_adc() //unsigned int *data
{
Wire.beginTransmission(ADDR_ADC121); // transmit to device
Wire.write(REG_ADDR_RESULT); // get result
Wire.endTransmission();
Wire.requestFrom(ADDR_ADC121, 2); // request 2byte from device
delay(1);
if (Wire.available() <= 2) {
getData = (Wire.read() & 0x0f) << 8; //bitwiseAND with F (15) then shift left 8 position (like multiply for 256?)
getData |= Wire.read(); //getData bitwise OR with Wire.read().
}
void loop() {
read_adc();
Raw = (getData * V_REF * 2 / 4096); // It's not working properly
Serial.print("The analog value is:");
Serial.print((getData * V_REF * 2 / 4096),3); //With 1.250 volt input I read 1.192 volt
Serial.print(Raw); // With 1.250 volt input I read 6291455 (???)
Serial.println("V");
}
What about accuracy?
How to transfer the getData to another variable to be able to process it?