I am using the ResponsiveAnalogRead library to read voltage output from a 5V pressure transducer. It is working well for me, however, one limitation is that the values are pegged to a default voltage of 5V. I need to benchmark it to supply voltage.
Can someone please advise how do I do that?
I am sharing a shortened version of the code for simplicity.
const int ANALOG_PIN = A7;
ResponsiveAnalogRead analog(ANALOG_PIN, true);
void loop() {
// put your main code here, to run repeatedly:
analog.update();
ReadPressure();
SetDisplayTemperature(sensor_voltage);
if (sensor_voltage >= (base_voltage + 3)) {
ChangeRelayState(0, 0);
} else {
ChangeRelayState(2, 1);
}
delay(500);
}
void ReadPressure() {
sensor_voltage = analog.getValue();
}
The datasheet is of no use. Attached herewith. NB157-EN.pdf (185.7 KB)
As observed, even a minor adjustment in SMPS output leads to variation in the pressure readings. Would the analogReference() function help in my case? Not sure how to proceed further.
In this case the output of the sensor varies with the supply voltage, and the ADC also refers to the supply voltage, making the reading independent of the supply voltage. Using any constant reference voltage would make things unnecessary difficult.