Arduino AMS5812_0050-D-B Pressure & Temperature Sensor Tutorial




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

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


3. I²C Cable


4. I2C Shield for Arduino Nano


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 :

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

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



// AMS5812 I2C address is 0x78(120)

#define Addr 0x78

void setup()


// Initialise I2C communication as MASTER


// Initialise serial communication, set baud rate = 9600




void loop()


unsigned int data[4];


// 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] =;

data[1] =;

data[2] =;

data[3] =;


// 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.println(" PSI");

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


Serial.println(" C");

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


Serial.println(" F");



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.



    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.