Arduino AMS5812_0050-D-B Pressure & Temperature Sensor Tutorial

Published

Introduction: Arduino AMS5812_0050-D-B Pressure & Temperature Sensor Tutorial

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

AMS5812 Amplified Pressure Sensor with Analog and Digital Outputs is a high precision sensor with an analog voltage output and digital I2C interface. It combines a piezoresistive sensing element with a signal conditioning element for its operation. Here is its demonstration with arduino nano.

Step 1: What You Need..!!

1. Arduino Nano

2. AMS5812_0050-D-B

LINK : https://www.controleverything.com/content/Pressure?sku=AMS5812_I2CS_0050-D-B

3. I²C Cable

LINK : https://www.controleverything.com/content/I2C-Cables?sku=I2CAFF3

4. I2C Shield for Arduino Nano

LINK : https://www.controleverything.com/content/I2C-Master?sku=ANI2C

Step 2: Connections:

Take an I2C shield for Arduino Nano and gently push it over the pins of Nano.

Then connect the one end of I2C cable to AMS5812_0050-D-B sensor and the other end to the I2C shield.

Connections are shown in the picture above.

Step 3: Code :

The arduino code for AMS5812_0050-D-B can be downloaded from our github repository-ControlEverythingCommunity

Here is the link for the same :

https://github.com/ControlEverythingCommunity/AMS5...

The datasheet of AMS5812_0050-D-B can be found here:

https://s3.amazonaws.com/controleverything.media/c...

We include library Wire.h to facilitate the I2c communication of the sensor with the Arduino board.

You can also copy the code from here, it is given as follows:

// Distributed with a free-will license.

// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.

// AMS5812

// This code is designed to work with the AMS5812_I2CS_0050-D-B I2C Mini Module available from ControlEverything.com.

// https://www.controleverything.com/content/Pressur...


#include<Wire.h>

// AMS5812 I2C address is 0x78(120)

#define Addr 0x78

void setup()

{

// Initialise I2C communication as MASTER

Wire.begin();

// Initialise serial communication, set baud rate = 9600

Serial.begin(9600);

delay(300);

}

void loop()

{

unsigned int data[4];

delay(500);

// Request 4 bytes of data

Wire.requestFrom(Addr, 4);

// Read 4 bytes of data

// pressure msb, pressure lsb, temp msb, temp lsb

if (Wire.available() == 4)

{

data[0] = Wire.read();

data[1] = Wire.read();

data[2] = Wire.read();

data[3] = Wire.read();

}

// Convert the data

float pressure = ((data[0] & 0xFF) * 256 + (data[1] & 0xFF));

float temp = ((data[2] & 0xFF) * 256 + (data[3] & 0xFF));

pressure = ((pressure - 3277.0) / ((26214.0) / 10.0)) - 5.0;

float cTemp = ((temp - 3277.0) / ((26214.0) / 110.0)) - 25.0;

float fTemp = (cTemp * 1.8 ) + 32;

// Output data to serial monitor

Serial.print("Pressure : ");

Serial.print(pressure);

Serial.println(" PSI");

Serial.print("Temperature in Celsius : ");

Serial.print(cTemp);

Serial.println(" C");

Serial.print("Temperature in Fahrenheit : ");

Serial.print(fTemp);

Serial.println(" F");

delay(500);

}

Step 4: Applications:

AMS5812 is an amplified pressure sensor and it can be employed in systems where static and dynamic pressure measurement and barometric pressure measurement is to be carried out. It plays a pivotal role in Vacuum monitoring,Gas flow monitoring, Fluid level measurement as well as Medical instrumentation.

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest

    Discussions