Hello,
Im working on a code from sparkfun for the MS5803 sensor and i've come to the section of code that talks about
'ADC_4096'
Is this meaning analogue to digital conversion?
If so what does the 4096 part mean?
Thankyou kindly,
Hello,
Im working on a code from sparkfun for the MS5803 sensor and i've come to the section of code that talks about
'ADC_4096'
Is this meaning analogue to digital conversion?
If so what does the 4096 part mean?
Thankyou kindly,
what does the 4096 part mean?
It sounds like the ADC returns one of 4096 discrete values depending on the input voltage. Compare that with the Arduino analogRead() function which returns one of 1024 different values.
This, however, is speculation as you did not provide a link to the part being used or the Sparkfun code.
Thank you for your reply, i thought i had added the code in, my apologize.
I'm grateful for all advice.
#include <Wire.h>
#include <SparkFun_MS5803_I2C.h>
MS5803 sensor(ADDRESS_HIGH);
float temperature_c, temperature_f;
double pressure_abs, pressure_relative, altitude_delta, pressure_baseline;
double base_altitude = 1655.0; // Altitude of SparkFun's HQ in Boulder, CO. in (m)
void setup() {
Serial.begin(9600);
sensor.reset();
sensor.begin();
pressure_baseline = sensor.getPressure(ADC_4096);
}
void loop() {
temperature_c = sensor.getTemperature(CELSIUS, ADC_512);
temperature_f = sensor.getTemperature(FAHRENHEIT, ADC_512);
pressure_abs = sensor.getPressure(ADC_4096);
pressure_relative = sealevel(pressure_abs, base_altitude);
altitude_delta = altitude(pressure_abs , pressure_baseline);
Serial.print("Temperature C = ");
Serial.println(temperature_c);
Serial.print("Temperature F = ");
Serial.println(temperature_f);
Serial.print("Pressure abs (mbar)= ");
Serial.println(pressure_abs);
Serial.print("Pressure relative (mbar)= ");
Serial.println(pressure_relative);
Serial.print("Altitude change (m) = ");
Serial.println(altitude_delta);
delay(1000);
}
double sealevel(double P, double A)
{
return(P/pow(1-(A/44330.0),5.255));
}
double altitude(double P, double P0)
{
return(44330.0*(1-pow(P/P0,1/5.255)));
}
I am not familiar with the library or the device but, from the code, the ADC_ parameters would appear to set the resolution of the values returned by the library functions.