Hi.
Has any one used a pressure sensor interfaced with arduino to show the pressure value of compressed air bottles? 300 bar.
I'm looking at
Omega PXM309 sensor
NodeMCU or other arduino
LCD Display
Hi.
Has any one used a pressure sensor interfaced with arduino to show the pressure value of compressed air bottles? 300 bar.
I'm looking at
Omega PXM309 sensor
NodeMCU or other arduino
LCD Display
I use Omega sensors. They are very high quality, very robust and work as specified.
I found a Wika Eco-1 sensor locally.
It will be connected to 12v battery, and I'm thinking to use a NodeMCU to read the values and show them in "Bar" on a LCD display.
The connection would be as follows? (I left the display out of it)
250 ohm is the wrong value for a NodeMCU. That value is for 5volt Arduinos.
The NodeMCU expects about 3.3volt max, and that calculates to a 3.3/0.02 = 165 ohm resistor for 20mA.
I would use about 160 ohm for a bit of headroom (standard 1% metalfilm E24 value).
You can also make that value from two E12 resitors, using this online calculator.
Leo
Wawa:
The NodeMCU expects about 3.3volt max, and that calculates to a 3.3/0.02 = 165 ohm resistor for 20mA.
True, I completely forgot.
I put 100 + 20 + 20 +20 ohms resistors in series.
I'm a bit new to this but this was my thought ;
4ma out of 20ma = 20%
205 out of 1023 = 20%
Full-scale : I tested with 1023 value on fullScale, and even with a 5-10% decrease in case the sensor didn't use the full range. I actually had to increase the value to 1050 for the sensor value to match the analogue pressure gauge when at 250bar pressure. Granted the analogue pressure gauge is correct.
I set full-scale = 1050 and set offset to 20% of that (217)
The sensor values and gauge values seem to match, but does the above make sense or am I still off somewhere in my calculations or code?
int offset = 217;
int fullScale = 1050;
float pressure;
void setup() {
Serial.begin(9600);
}
void loop() {
pressure = (analogRead(A0) - offset) * 400 / (fullScale - offset);
Serial.print("Pressure is ");
Serial.print(pressure);
Serial.println(" bar");
delay(1000);
}
"offset' is the A/D value you get without any pressure on the sensor. That value becomes fixed.
Then you can set 'fullscale' value to 1023, and tweak the number in the maths line until the display matches the real pressure on the sensor. Measure with a pressure close to max of the sensor.
Or, you can tweak that 1023 value.
Final results will be the same.
Leo..
What is your ADC reading with 0 bar on the sensor? With 250 bar? What is the full scale pressure of the sensor?
What is your ADC reading with 0 bar on the sensor?
Offset @ 217 = 0 bar
With 250 bar?
I need to check again the ADC value @ 250 bar.
I just filled the bottle to 250 bar and checked that both the analogue diving gauge and pressure showed around the same value. The diving gauge has increments of 10 bar.
What is the full scale pressure of the sensor?
0 - 400 bar
So, is all well then?
Note that the NodeMCU has a voltage divider and a ~1volt Aref.
Both are not perfectly accurate, so you better tweak that 1023 value, and leave the 400 as is.
Leo..
Thanks for all the help so far.
I'll hook everything up to a high pressure compressor with digital reading, to verify the values at different stages.
So far it seems to run well.
Now I just need to wait for the LCD display to arrive.
In the meantime I tested it in ThingSpeak with good results.
Value in ThingSpeak + on a local LCD display is what I want.
#include <ESP8266WiFi.h>;
#include <WiFiClient.h>;
#include <ThingSpeak.h>;
const char* ssid = "xxxx";
const char* password = "xxxxx";int offset = 217;
int fullScale = 1050;
float pressure;WiFiClient client;
unsigned long myChannelNumber = xxxx;
const char * myWriteAPIKey = "xxxx";void setup() {
Serial.begin(9600);
delay(10);WiFi.begin(ssid, password);
ThingSpeak.begin(client);
}void loop() {
pressure = (analogRead(A0) - offset) * 400 / (fullScale - offset);
Serial.print("Pressure is ");
Serial.print(pressure);
Serial.println(" bar");
delay(1000);
ThingSpeak.writeField(myChannelNumber, 1,pressure, myWriteAPIKey);
delay(300000);
}