which formula to use for a pressure sensor

Thread Starter

khalad

Joined Feb 9, 2017
55
As1 bar =100kpa, so you have a range of 0kpa thru 600kpa
If you use a 250R resistor , at 4mA == 0bar will be 1v.
at 20mA = = 6bar will be 5v.

So 4v change is 6bar change or 600kpa.

Subtract 1v from your meter reading and then multiply the rmainder by 1.5 to give a bar value.
For a kpa value multiply this by 100.

Examples:

Meter reads 3v, sub 1v then, 2v *1.5 = 3bar = 300kpa.
5v -1v = 4v *1.5 = 6 bar
1v-1v =0 bar

OK.??
well i used this code
void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
float v=analogRead(A0);
float R0=148+98.7;
float mA=(v/1.024*5.0)/R0;
Serial.print(mA);
Serial.println(" mA");
float mA0=4;// this should be 4 officialy
float mAmax=20;
float pressure=100+(600/(mAmax-mA0))*(mA-mA0);
Serial.print(pressure);
Serial.println(" KPa");
delay(500);



void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
float v=analogRead(A0);
float R0=148+98.7;
float mA=(v/1.024*5.0)/R0;
Serial.print(mA);
Serial.println(" mA");
float mA0=4;// this should be 4 officialy
float mAmax=20;
float pressure=100+(600/(mAmax-mA0))*(mA-mA0);
Serial.print(pressure);
Serial.println(" KPa");
delay(500);
}

and i do get right reading 4mA and 101kp
 

ericgibbs

Joined Jan 29, 2010
21,448
hi,
Assuming a 12 Bit ADC.

Have you considered using a 183.1R load resistor for the current loop.?

4mA * 183.1 = 0.7324v, which gives an ADC count of [0.7324v/5v] *1024 = ~150
20ma * 183.1 = 3.662v, ADC count [3.662v/5v] *1024 = ~750

Subtract 150 from 750 gives 600 , which is the value in kpa,

eg: 12mA == ~300kpa


E
 
Top