Today we are going to make a minimal pressure sensor integrated with temperature sensor. This pressure sensor is also able to measure the approx. altitude level. The main idea is to make it simple and to keep the PCB as small as possible. There are many temperature sensors are available in market which offers a lot more precision level, but I choose BMP280 for the project. It is digital pressure and temperature sensor. Which also allows us to for a little bit of whether forecasting. And the size of sensor is very small (2 x 2.2x 0.95 mm), so it can be used in applications like smart watches, mobile phones, GPS, health care devices and other Nano embedded systems.

BMP280:

The BMP280 is an absolute barometric pressure sensor especially designed for mobile applications. The sensor module is housed in an extremely compact 8-pin metal-lid LGA package. As the successor to the widely adopted BMP180, the BMP280 delivers high performance in all applications that require precise pressure measurement. The BMP280 operates at lower noise, supports new filter modes and an SPI interface within a footprint 63% smaller than the BMP180. This sensor is developed by BOSCH technologies and you can Download the original datasheet from here.

Features:

Pressure range 300 to 1100 hPa (-500/+9000 meters range from sea level)

Temperature range 40-to-85-degree Celsius

Current consumption is 2.7uA @1Hz

Communication protocols: SPI and I2C

BMP180 and BMP280 are perfectly suitable for applications like floor detection since both sensors feature excellent relative accuracy is ±0.12 hPa, which is equivalent to ±1 m difference in altitude. The very low offset temperature coefficient (TCO) of 1.5 Pa/K translates to a temperature drift of only 12.6 cm/K.

Components Required:

Arduino Nano

BMP280 sensor

SSH1306 OLED display

5V power supply

Custom PCB from PCBWAY

Circuit diagram:

I choose I2C for the BMP280, my OLED also works on the same protocol. I interfaced both of them using the single I2C lane because of different address. BMP has I2C address of 0x76 and OLED has 0x3C. You can check the 12C address using the scanner programmer given in the description.

Our sensor works on 3.3volt level and OLED works on 5v. Arduino has onboard 3.3v available so need to worry about external regulators. Connect the power pins first, then connect Pin SCL to A5 of the Arduino and SDA to A4. The whole system can be powered using a 5v power supply or 9v battery. The current consumption of the sensor is very less in order of 2.7uA @ 1Hz sampling rate. You can also eliminate the display, the readings can be displayed on serial monitor of the Arduino IDE.

PCB designs:

The project has a very few wires but for the daily usage making a PCB is good Idea. So, I turned by idea into a schematic and then into a PCB. You can download the PCB Gerber files from here. I am using PCBWAY PCB prototype service for a long time. Honestly, PCBWAY is the best PCB manufacturer and never compromise with the product quality. You can get 5pcs of 2layer PCB in just $5. Register now to PCBWAY to get new user discount coupons.

Code:

Get Serial monitor code from here. It doesn't require external display to show values.

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET -1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  while ( !Serial ) delay(100);   // wait for native usb
  Serial.println(F("BMP280 test"));
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  unsigned status;
  //status = bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID);
  status = bmp.begin();
  if (!status) {
    Serial.println(F("Could not find a valid...
Read more »