Sensor’s special features:
- High pressure (300/1100 hPa) and temperature (-40/+85 °C) detection ranges.
- Fully calibrated digital sensor that makes it easy to use and program using InterIntegrated Circuit (I 2C) serial communication.
- Surface mounted device (SMD), therefore it is very small in size (3.6mm x 3.8mm x 0.93mm).
- High precision digital sensor
- Ultra-low power consumption (3 µA).
- Low noise (0.06 hPa).
In this example, (BMP180) digital pressure temperature (slave device) was connected to myRIO-1900 (master device) serial communication pins as stated in the table below:
As mentioned earlier, to program (BMP180) sensor, I2C interface should be used. To start the pressure and temperature measurements, at the software initialization, the microcontroller (master) should first send slave address (×77) to the sensor (slave), bytes to write (0×AA), and byte count (22). After that, the master device will be able to read the slave calibration coefficients of addresses one time from 0×AA to 0×BF (i.e. 0×BF – 0×AA = 0×15 ……. 191 – 170 = 21) and return the reading values as 1D array of unsigned bytes (8 bit (0 to 255)). Index array then is used to return the separate elements of the 22-deminition array. Each two consecutive outputs of the 22 outputs from the index array are then joined to form the 11 coefficients as unsigned word (16 bit (0 to 65535)). After that, the output numbers are converted using (To Word Integer) block to 16 bit signed and unsigned integers based on the coefficient data type mentioned in the table below from the sensor datasheet. Coefficients then are grouped into single cluster to be used for different calculations in the program.
Since there are 11 calibration coefficients word of 16 bit each (i.e. 2 bytes), the EEPROM size is 176 bit (11 coefficient × 16 bits) and the byte count is 22 (11 coefficient × 2 bytes). The master then reads out the calibration coefficients from the sensor EEPROM. The table below shows the calibration coefficients names, sample readings, data reading registers (MSB, LSB), size, and type.
After reading the calibration coefficients, the LabVIEW program should continuously read the uncompensated value of temperature (UT) by writing (0x2E) into the control register (0xF4) and wait for the converting time 5 mSec. After the converting time elapsed, read register (0×F6) and byte count (2) are sent to the slave. The master then will be able to get the uncompensated value of temperature (UT). Index array then is used to return the separate elements of the 2-deminition array. Outputs from the index array are then joined to form the (UT) as unsigned word (16 bit (0 to 65535)). After that, the output number is converted using (To Long Integer) block to 32 bit long signed integer based on the (UT) data type mentioned in the table below from the sensor datasheet.
After reading the uncompensated value of temperature (UT), the program should continuously read the uncompensated value of pressure (UP) by writing (0x34 + (oss<<6)) into the control register (0xF4) and wait for the converting time (((3<
After that, temperature can be read in its physical unit (°C) using the uncompensated temperature value (UT) and some of the calibration coefficients obtained before. Calculations were based on the sensor datasheet and performed into LabVIEW Formula Node as the following figure of the block diagram shows. Formula used to convert temperature scale from Celsius (denoted °C) Fahrenheit (denoted °F).
𝐭𝐞𝐦𝐩𝐞𝐫𝐚𝐭𝐮𝐫𝐞 (°𝐅) = ( 𝟗 𝟓 ) × (𝟑𝟐) × 𝐭𝐞𝐦𝐩𝐞𝐫𝐚𝐭𝐮𝐫𝐞 (°𝐂)
In addition, pressure can be read in its physical unit (hPa) using the uncompensated pressure value (UP) and some of the calibration coefficients obtained before. Calculations were based on the sensor datasheet and performed into LabVIEW Formula Node as the following figure of the block diagram shows. The unit hectopascal (hPa) is commonly used to display atmospheric pressure and it is equal to millibar (mbar). To convert from hectopascal (hPa) to millimeter of mercury (mmHg) the following formula was used:
𝐏𝐫𝐞𝐬𝐬𝐮𝐫𝐞 (𝐦𝐦𝐇𝐠) = 𝟎. 𝟕𝟓𝟎𝟎𝟔 × 𝐏𝐫𝐞𝐬𝐬𝐮𝐫𝐞(𝐡𝐏𝐚)