I'm facing an issue using the MPX4115 pressure sensor in Proteus, and I'm unsure if the problem lies with the simulation software or my code. I've included the conversion equations to kPa from the sensor's datasheet, but I'm still getting incorrect readings. For instance, when I input a pressure of 101 kPa, the display shows 81.44 kPa. Should I consider changing the version of the simulation software, or is there a necessary adjustment in my code? #include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Pressure Sensor");
}
void loop() {
sensorValue = analogRead(sensorPin);
float voltage = sensorValue * (5.0 / 1023.0);
float pressure = (voltage / 5.0 - 0.095) / 0.009;
Serial.print("Sensor Value: ");
Serial.println(sensorValue);
Serial.print("Pressure (kPa): ");
Serial.println(pressure);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Pressure:");
lcd.setCursor(0, 1);
lcd.print(pressure);
delay(500);
}