Arduino Weather station with BME280 sensor and NOKIA 5110 LCD

This topic shows how to make an Arduino based weather station using BME280 sensor and NOKIA 5110 LCD screen.
The BME280 is a digital barometric pressure, temperature and relative humidity sensor from Bosch Sensortec. In this project the BME280 sensor is used in I2C mode.
Nokia 5110 LCD has a resolution of 84 x 48 pixel, it’s used in this project to display values of pressure, temperature and humidity.

To see how to interface Arduino with Nokia 5110 LCD, visit the following post:
Interfacing Arduino with Nokia 5110 LCD

And to see how to interface Arduino with BME280 sensor for the first time, take a look at this post:
Arduino with BME280 pressure, temperature and humidity sensor

Hardware Required:

  • Arduino board
  • Nokia 5110 LCD screen
  • BME280 sensor module with 3.3V regulator and level shifter   —->  BME280 datasheet
  • 5 x 3.3k ohm resistor
  • 5 x 2.2k ohm resistor
  • Breadboard
  • Jumper wires

Arduino weather station using BME280 sensor NOKIA 5110 LCD

The BME280 chip works with maximum voltage of 3.6V (supply voltage range is from 1.71 to 3.6V) which means we’ve to use a 3V3 voltage regulator to supply it from a 5V source.
Also if we’re working with a 5V system (development board, microcontroller …) like the Arduino UNO board we’ve to use a voltage level shifter (level converter) which converts the 3.3V (comes from the BME280 chip) into 5V (goes to the Arduino) and vice versa. This level shifter is for the I2C bus lines (clock and data).

In this example I’m using a Chinese BME280 module came with 3.3V regulator and level shifter, this means connection will be more easier!

Arduino with BME280 sensor and NOKIA 5110 LCD circuit:
The following image shows project circuit schematic diagram.
Note that the BME280 module shown in the circuit diagram has a 3.3V regulator and level shifter.

Arduino BME280 Nokia 5110 LCD

Generally, the BME280 module has at least 4 pins because it can work in SPI mode or I2C mode. For the I2C mode we need 4 pins: VCC, GND, SDA and SCL where:
GND (ground) is connected to Arduino GND pin
VCC is the supply pin which is connected to Arduino 5V pin
SDA is I2C bus serial data line, connected to Arduino analog pin 4 (A4)
SCL is I2C bus serial clock line, connected to Arduino analog pin 5 (A5).

Nokia 5110 LCD pins are connected to Arduino UNO board as follows (each one through voltage divider):
RST (reset) pin is connected to Arduino digital pin 3
CE (chip enable) pin is connected to Arduino digital pin 4
DC (data/command) pin is connected to Arduino digital pin 5
DIN (data in)  pin is connected to Arduino digital pin 6
CLK (clock) pin is connected to Arduino digital pin 7
VCC and BL are connected to Arduino 3V3 pin
GND is connected to Arduino GND pin.

The voltage dividers are used to drip the Arduino 5V into 3V because applying a 5V directly to the LCD controller could damage it!

Arduino with BME280 sensor and NOKIA 5110 LCD code:
The following Arduino code requires 3 libraries from Adafruit Industries:
The first library is a driver for the Nokia 5110 LCD (PCD8544 controller) which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “nokia” and install the one from Adafruit).

The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.
The third library is for the BME280 sensor.

The previous 3 libraries can also be installed manually, download links are below:
Adafruit Nokia 5110 LCD library   —->  direct link
Adafruit graphics library             —->  direct link
Adafruit BME280 Library            —->  direct link

You may need to install the Adafruit Unified Sensor library if it’s not already installed, download link is below:
Adafruit Unified Sensor library   —->    direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library files.

In the code there are total of 4 libraries, they’re included in the code as follows:

Nokia 5110 LCD connection with the Arduino is configured as shown below:

As any other I2C device, the BME280 sensor has an I2C slave address which is 0x76 or 0x77. This address depends on the connection of the SDO pin (used for SPI mode as serial data out or MISO), if the SDO pin is connected (directly or through resistor) to VCC (3.3V) the address will be 0x77, and if it’s connected to GND the address will be 0x76.

The default I2C address of the library is defined as 0x77 and my device I2C address is 0x76.
In the code, the definition of the I2C slave address is as shown below:

The initialization of the BME280 sensor is done using the function begin() which returns 1 if OK and 0 if error. In the code the initialization with the previously defined address is as shown below:

Reading the values of temperature and pressure is done as shown below:

Note that the BME280 sensor library returns the value of the pressure in Pa unit and to convert it to hPa we’ve to divide it by 100.

1 bar = 10000 Pa = 100 hPa. ( 1 hPa = 100 Pa = 1 millibar)
Pa: Pascal
hPa: hectoPascal

Full Arduino Code:

Arduino weather station video:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.