Now we can check out the depth of the sea level by using the Pressure Sensor(MS5803–01 BA) connected with Arduino and display the sensor data in Node-Red Dashboard
In this blogtut, we will find out the best way to find out the depth of sea level as well as test out the pressure using MS5803–01BA sensor the sensor is easy to connect with ESP32, Xbee, and many other Communication devices.
Hardware
Arduino Uno
Software Platforms
Node-Red
Arduino IDE
About Pressure Sensor
The ROHS compliant MS5803–01BA pressure sensor shares the precise parameters of operational pressure range from 1kPa to 130kPa and which uses the high resolution of about 10cm. We can receive the 24bits precise variation using MS5803–01BA sensor
Application of Pressure Sensor
Being a newbie to this sensor we have figure out the way to receive the sensor data by using the modular I2C breakout board. We were able to find out the pressure as well as temperature and with the help of the earlier blogtut we will be able to find out the distance between the object and the earth using specified formulae and process called as Altitude measurement
But being good robust designs and for underwater process system, we recommend to use this sensor to find out the depth of sea from earth surface to the core easily. These sensors can majorly be used in submarines for various other application to monitor as well as controlling the actuators. With the help of various communication devices, you will be able to operate the sensor data at longer miles also.
I2C Code
- Initialize the Wire.h file called as I2C Library especially use in Arduino IDE
#include <Wire.h>
- Initialize the I2C registers of sensor module which is specified to work with 2 wire protocol.
#define Addr 0x77
- Begin the I2C transmission and Initialize the baud rate as per the requirements for serial communication.
void setup(){ // Initialise I2C communication as MASTER Wire.begin(); // Initialise Serial Communication, set baud rate = 9600 Serial.begin(9600);
- Request for 3 bytes of Data which we want to read from the sensor through I2C connection for pressure and temperature
if(Wire.available() == 3) { data[0] = Wire.read(); data[1] = Wire.read(); data[2] = Wire.read(); }
- If 3 bytes of data is available then use the mentioned below formula will help to convert the data bytes and display desired values
unsigned long ptemp = ((data[0] * 65536.0) + (data[1] * 256.0) + data[2]);
- Manipulate the parameters as per the requirement of precision settings which is given in datasheet
unsigned long dT = temp - ((Coff[4] * 256)); temp = 2000 + (dT * (Coff[5] / pow(2, 23))); // Offset and Sensitivity calculation unsigned long long off = Coff[1] * 65536 + (Coff[3] * dT) / 128; unsigned long long sens = Coff[0] * 32768 + (Coff[2] * dT) / 256;
// Convert the final data ptemp = (((ptemp * sens) / 2097152) - off); ptemp /= 32768.0; float pressure = ptemp / 100.0; float ctemp = temp / 100.0; float fTemp = ctemp * 1.8 + 32.0;
- Using Serial.print you will be able to read the sensor data in the serial monitor screen.
// Output data to serial monitor Serial.print("Temperature in Celsius : "); Serial.print(ctemp); Serial.println(" C"); Serial.print("Temperature in Fahrenheit : "); Serial.print(fTemp); Serial.println(" F"); Serial.print("Pressure : "); Serial.print(pressure); Serial.println(" mbar"); delay(500);
Node-Red
With the help of node -red you will be able to display the sensor data in dashboard format which is already been mentioned in previous blogtuts.
The newbies can check out the tutorial for Node-Red installation here.
Code
https://github.com/varul29/Node-Red_Tutorial
https://github.com/varul29/MS5803-01BA/blob/master/Arduino/MS5803_01BA.ino
Credits
- Control everything
- Node-Red
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.