Envico_Barometer.php 7522 Bytes 02-04-2024 16:30:51
ENVICO®light
Barometer Adapter
✈ Circuit Description
This Adapter / Sensor consists only of two integrated circuits. One is an eeprom which holds information such as type of sensor,
warning and alarm levels, the other one is an integrated Miniature I2C Digital Barometer, MPL115A2, from Freescale Semiconductor.
Some decoupling capacitors as well as pull-up resistors round the design up.
✈ Downloads
✈ Arduino Sketch - The TEST - Code
Double click on code to select ...
/*
Standalone Sketch to test the Barometer sensor with an MPL155A2
(Just to test the sensor and the I2C communication)
Do not forget to supply the arduino with Vin, +12V !!!
Alexander C. Frank, 15.07.2015, Version 1.0
*/
#include <Wire.h>
byte I2C_address = 0x60;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
Serial.print("Barometer MPL-115 Test\n");
}
void loop()
{
// START CONVERSION
Wire.beginTransmission(I2C_address);
Wire.write(0x12);
Wire.write(0xAF);
Wire.endTransmission();
// WAIT FOR MEASUREMENT TO COMPLETE
delay(5); // max. 3 ms
// READ ALL MEMORY LOCATIOSN
Wire.beginTransmission(I2C_address);
Wire.write(0x00);
Wire.endTransmission();
Wire.requestFrom(I2C_address,12);
unsigned int Padc_MSB = Wire.read(); // 0x00
unsigned int Padc_LSB = Wire.read(); // 0x01
unsigned int Tadc_MSB = Wire.read(); // 0x02
unsigned int Tadc_LSB = Wire.read(); // 0x03
unsigned int a0_MSB = Wire.read(); // 0x04
unsigned int a0_LSB = Wire.read(); // 0x05
unsigned int b1_MSB = Wire.read(); // 0x06
unsigned int b1_LSB = Wire.read(); // 0x07
unsigned int b2_MSB = Wire.read(); // 0x08
unsigned int b2_LSB = Wire.read(); // 0x09
unsigned int c12_MSB = Wire.read(); // 0x0A
unsigned int c12_LSB = Wire.read(); // 0x0B
// COMBINE MSB AND LSB
unsigned long Padc = ( ( Padc_MSB << 8 ) + Padc_LSB ) >> 6 ;
unsigned long Tadc = ( ( Tadc_MSB << 8 ) + Tadc_LSB ) >> 6 ;
float a0 = ( a0_MSB << 5 ) + ( a0_LSB >> 3 ) + ( a0_LSB & 0x07 ) / 8.0 ;
float b1 = ( ( ( ( b1_MSB & 0x1F ) * 0x100 ) + b1_LSB ) / 8192.0) - 3 ;
float b2 = ( ( ( ( b2_MSB - 0x80 ) << 8 ) + b2_LSB ) / 16384.0 ) - 2 ;
float c12 = ( ( ( c12_MSB * 0x100 ) + c12_LSB ) / 16777216.0 ) ;
// CALCULATE PRESSURE
float Pcomp = a0 + ( b1 + c12 * Tadc ) * Padc + b2 * Tadc ;
float PressurekPa = Pcomp * 0.0635 + 50 ;
float PressuremBar = 10 * PressurekPa ;
// Serial.print(PressurekPa, 2); Serial.write(" kPa");Serial.write("\n");
Serial.print(PressuremBar, 2); Serial.write(" mBar");Serial.write("\n");
delay(10000);
}
✈ Share your thoughts
The webmaster does not read these comments regularely. Urgent questions should be send via email.
Ads or links to completely uncorrelated things will be removed.
Your Browser says that you allow tracking. Mayst we suggest that you check that DNT thing ?