Activity › Forums › General Discussion › Pressure sensor reading w/Controllino MAXI Automation
-
Pressure sensor reading w/Controllino MAXI Automation
-
Hello Controllino world,
I have been experimenting around with sensors and the Controllino Maxi Automation and I came across using a pressure sensor. Now I was able to hook everything up and write a simple Arduino code to get the reading of the pressure sensor but now I need help on converting the analog input I am reading into a pressure value (psi, torr, kPa). Could anyone help me or point me to the right direction?
My code is below:
#include <Controllino.h>
const int pressureInput = CONTROLLINO_AI11;
const double pressureZero = 82.0;
const double pressureMax = 921.6;
const int pressureTransducerMaxPSI = 100000;
const int baudRate = 9600;
const int sensorReadDelay = 250;
float pressureValue = 0;
void setup() {
Serial.begin(baudRate);
pinMode(pressureInput, INPUT);
}
void loop() {
pressureValue = analogRead(pressureInput);
//pressureValue = ((pressureValue-pressureZero)*pressureTransducerMaxPSI)/(pressureMax-pressureZero);
Serial.print(“pressure value: “);
Serial.println(pressureValue, 1);
delay(sensorReadDelay);
}
- This discussion was modified 2 years, 11 months ago by dlee-upt.
-
Suspended MemberMemberThis content has been hidden as the member is suspended. -
Suspended MemberMemberThis content has been hidden as the member is suspended.
Log in to reply.