Navigation

Sunday 30 November 2014

TBPDANS001PGUCV Pressure Sensor

The TBPDANS Pressure Sensor is a range of pressure sensor that comes in different pressure range, i.e. from 0 - 1psi; 0 - 5psi; 0 - 100psi, etc. The sensor contains a Wheatstone bridge  and the voltage between the Vout- and Vout+ pins has to measured.

If an Arduino microcontroller is to be used with this sensor, two analog input pins has to be used to measure Vout_ and Vout+ and the difference between these readings will give the voltage as a function of the pressure. But this result of subtracting Vout-  from Vout+ is in the order of 0.1millivolts and therefore the reading will not be evident when using the Arduino because the Arduino uses 10-bit ADC and so the sensitivity for 5v reference is:
This clearly is insufficient as we need a sensitivity less than 0.1mV. If the reference voltage is changed to 3.3v by connecting the AREF pin to 3.3v and writing the code below in the void setup() function:

void setup () {
analogRefence(EXTERNAL); // use AREF for reference voltage
}
This is also inadequate for our use
Also using the 1.1v internal reference of the Arduino by adding the code:
void setup () {
analogRefence(INTERNAL);    // use 1.1v internal reference voltage
}
This resolution is quite good but it should be noted that the using a full scale voltage of 1.1v will result in the maximum voltage that can be measured to be 1.1v. This implies that careful selection as to be made to the supply voltage given to the pressure sensor. The typical supply voltage according to the datasheet is 5v; minimum is 1.5v; maximum is 12v. If a voltage of 5v is applied to the Vcc pin of the pressure sensor, the voltage on the Vout- pin will be the supply voltage divided by 2, i.e. 2.5v while the voltage on the Vout+ pin will be 2.5v plus millivolt changes as the pressure changes.
Therefore using a 1.1v full scale reference will be inadequate, because although we have a higher sensitivity, we cannot measure voltages above 2.5v. 

The solution might be to lower the supply voltage to the pressure sensor. A better solution is to use an op-amp to amplify the voltage to the range the Arduino can measure. INA125 op amp can be used for this. Another better solution is to use a higher ADC bit IC such as a 12-bit ADC or 16-bit ADC or 24-bit ADC.

An example code to read the voltage from the TBPDANS005PGUCV sensor is:

int sensorValue1 = 0;
int sensorValue2 = 0;
float Voutminus;
float Voutplus;
float Vout;
void setup() {
     analogReference(EXTERNAL); // connect AREF pin to the reference voltage being used
                                      // analogReference(INTERNAL) can be used for 1.1v reference on Arduino Uno
     Serial.begin(9600);  
}
void loop() {
 
    sensorValue1 = analogRead(A0);
    sensorValue2 = analogRead(A1);
   
    Voutminus  = (analogRead(A0) * 5000.00) / 1023;   // Voltage in mV
    Voutplus = (analogRead(A1) * 5000.00) / 1023;         // Voltage in mV
    Vout = Voutplus – Voutminus;
    Serial.println(sensorValue1);
    Serial.println(sensorValue2);
    Serial.println(“Vout: ”, Vout, “mV”);
    Serial.println();
   
    delay(2000);          
}


Saturday 15 November 2014

Programming the ASDXACX100PAAA05 pressure sensor


The ASDXACX100PAAA05 pressure sensor is an absolute pressure sensor, that is it measures atmospheric pressure plus any other pressure in the system.

  • Maximum pressure, Pmax is 100psi. Minimum pressure, Pmin is 0psi
  • Power supply is +5V
  • Supply current is 2.5mA
  • It uses 10% - 90% calibration
  • It uses 12-bit analogue output

Pinout: It has 8 pins, three are used, the remaining are not connected

Arduino uses 10-bit ADC (0 - 1023). Therefore the output voltage from the Arduino is in the range og 0 - 1023. Hence, must be converted to its voltage form. This is achieved by mapping 0 1 1023 to 0 - 5v as shown by the equation below.
Reading the voltage from Arduino: The transfer function limits define the output of the sensor at a given pressure input. By specifying the output signal at the maximum (Pmax) and minimum (Pmin) limit of the pressure range, the complete transfer curve for the sensor is defined.
It uses 10% - 90% of the supply voltage and maps it to Pmin and Pmax respectively. That is:

  • At 10% of Vsupply (0.5v), Pmin equals 0psi
  • At 90% of Vsupply (4.5v), Pmax equals 100psi

Pmax = maximum limit of pressure range = 100psi
Pmin= minimum limit of pressure range = 0psi

The equation of the transfer function is:


Therefore, at atmospheric pressure (14.696psi), output voltage should equal:
Therefore, pressure applied equals:

The Arduino Code:


/*

 Reads an analog input pin, converts it to voltage and calculates the corresponding output pressure
 Also prints the results to the serial monitor.

 The circuit:
 * ASDX pressure sensor pin 2 connected to analog pin 0.
   pin 1 connected to Vcc (+5v for ASDXACX100PAAA05)
   pin 3 connected to GND
   the other pins are not connected
 * 

 created 15 July. 2014
 by Toria Olawumi

 */

const int ADCFULLSCALE = 1023;               // ADC full scale of arduino is 10-bit (0-1023)
const float reference_voltage_mv = 5000.0;   // Vcc is 5000mv (5V) for ASDXACX100PAAA05
const int Pmax = 100;                       // 100psi for ASDXACX100PAAA05
const int Pmin = 0;                         // 0 psi FOR ASDXACX100PAAA05

const int analogInPin = A0;     // Analog input pin that the asdx pressure sensor is attached to

int sensorValue = 0;           // value read from the pressure sensor

float voltage_mv = 0.0;         // pressure sensor voltage in mV
float voltage_v = 0.0;         // pressure sensor voltage in volts
float output_pressure = 0.0;   // output pressure in psi
float vacuum_pressure = 0.0;   // (substract atmospheric pressure from output_preesure) // vacuum pressure in psi

void setup() {
    Serial.begin(9600); 
}
void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);                              // digital value of pressure sensor voltage
  voltage_mv =  (sensorValue * reference_voltage_mv) / ADCFULLSCALE;   // pressure sensor voltage in mV
  voltage_v = voltage_mv / 1000;
  Serial.println(voltage_v);
  output_pressure = ( ( (voltage_v - (0.10 * (reference_voltage_mv/1000) )) * (Pmax - Pmin) ) / (0.8 * (reference_voltage_mv/1000) ) ) + Pmin;
  vacuum_pressure = output_pressure - 14.6; // subtract atmospheric pressure
}