|
Arduino_Nano_v3.x |
x 1 | |
|
16x4 LCD Display |
x 1 | |
|
button |
x 1 | |
|
BME280 sensor board |
x 1 |
![]() |
Soldering iron |
|
![]() |
Soldering Iron Wire Welding Lead Roll |
Arduino Barometer + Barograph with BME280 Sensor
A barograph is a barometer that records the barometric pressure over time in graphical form. This instrument is also used to make a continuous recording of atmospheric pressure.
The former Barographs use the pressure-sensitive element, which is linked to a pen arm in such a way that the vertical displacement of the pen is proportional to the changes in the atmospheric pressure. This pen marks pressure changes on specially marked paper that is placed on a disc that rotates 360 degrees over 24 hours. In the picture below you can see what a Barograph from the last century looks like.
The barometer and the barograph are basic local instruments (independent of the Internet) in Meteorology that serve to predict the weather. This time I will present you a very simple way, using an Arduino microcontroller, you can make an electronic Barometer + Barograph that presents the results in graphic form on a 20x4 LCD display. The basic project is taken from "cxem.net" by the author AMatroskin, in which I modified and now the pressure is displayed in hPa instead of mmHg, and what is much more important, instead of the Absolute, the Relative Atmospheric Pressure for the specific altitude is displayed, which is a common standard in Meteorology.
For this purpose we need to enter the Relative Standard Atmospheric Pressure for the current altitude (As described further in the text), in the line:
#define SEALEVELPRESSURE_HPA (932.17) // for Ohrid, 698m altitude
and we can calculate that, on one of the online calculators, such as:
https://www.mide.com/air-pressure-at-altitude-calculator
Also further down the line
value = round ((bme.seaLevelForAltitude(698, bme.readPressure())/100))
the current altitude in meters should be entered.
As I mentioned before, the device is very simple to build and contains only a few components:
- Arduino Nano microcontroller
- 20x4 I2C protocol LCD Display
- BME 280 Pressure sensor board
- and one Button
Now let's see how the device works in reality. First of all, it takes 24 hours to draw a complete graph. The display shows the current Relative Atmospheric Pressure, as well as the positive or negative difference in hectopascals, for a given previous time period. This period can be 3,6,12, and 24 hours. Correct interpretation of this difference is the basis for accurate weather prediction. And now a few words about the graph. The maximum number of values on the vertical axis can be 28 (7vertical dots on every of four rows). At the beginning of the code, the range in which the air pressure is read can be changed, i.e. the smallest and the largest value. Depending on these values, the resolution of the graph also changes. For example, if we choose the difference between the minimum and maximum pressure to be 28, then 1 Hectopascal corresponds to one line on the Y axis of the graph. The sixteen values on the X axis represent time, and here the resolution depends on the selected elapsed time value.
Basically, when the pressure rises, an improvement in the weather is expected, and conversely, when it decreases, a worsening of the weather is expected.
And finally, the device is placed in a suitable box made of PVC material with a thickness of 5 mm, and covered with self-adhesive colored wallpaper. Let me mention that the BME280 sensor is placed inside the box, because in this case we measure only the pressure, which is independent of the temperature .
/* Barometer with digital and graphic display of atmospheric pressure data. Components: Screen text LCD 2004, platform: arduinio nano/uno (Atmega328 or more), pressure sensor: BME 280. Amatroskin 2022. */ #include <LiquidCrystal_I2C.h> #include <Wire.h> #include "GyverButton.h" #include <Adafruit_Sensor.h> #include <Adafruit_BME280.h> #define SEALEVELPRESSURE_HPA (933,17) // Set the height #define BTN_PIN 3 //Button Pin #define BASE_PERIOD 675000 //Main array acquisition period 675000ms = 11.25 min (*16 bars = 3 hours) maximum graph resolution #define MIN_VAL 990 //The minimum value displayed on the chart #define MAX_VAL 1035 //The maximum value displayed on the graph LiquidCrystal_I2C lcd(0x27, 20, 4); //We create the necessary objects GButton butt1(BTN_PIN); Adafruit_BME280 bme; uint32_t tmr1, tmr2; //timer variables uint32_t set_period = BASE_PERIOD; //Display period, changes in multiples of 3 hours (3, 6, 12, 24) int16_t plot_array[20]; //Data array for drawing a chart uint16_t base_array [128]; //The base array stores all measurements for the last 24 hours (128 cells * 11.25 minutes = 1440 minutes = 24 hours) int16_t value, delta; //Current (taken) readings, difference in readings for a selected period of time byte interval = 1; //Interval displayed on the screen (time difference between adjacent chart bars) // 11.25 min * 16 = 3 hours, 22.5 min - 6 hours, 45 min - 12 hours, 90 min - 24 hours void setup() { read_all (); // Serial.begin(9600); attachInterrupt(1, isr, CHANGE); butt1.setDebounce(80); // anti-bounce setting (default 80 ms) butt1.setTimeout(300); // hold timeout setting (default 500ms) lcd.init(); lcd.backlight(); lcd.clear(); if (!bme.begin(0x76)) { //Initialization of the BME280 sensor at address 0x76 (default) //Serial.println("Could not find a valid BME280!");//Printing an Error Message to the Port Monitor lcd.setCursor(3, 1); lcd.print(F("No connection")); //___________________________or on the screen lcd.setCursor(5, 2); lcd.print(F("to sensor")); while (1); //won't go without a sensor. } if (!digitalRead(BTN_PIN)) { //Reset settings when turned on with the button held down for (byte i = 0; i < 128; i++) base_array [i] = 0; //Erase data update_all (); //Save lcd.setCursor(5, 1); //Report it lcd.print(F("Reset data")); lcd.setCursor(9, 2); lcd.print(F("OK")); } while (!digitalRead(BTN_PIN)); lcd.clear(); initPlot(); //Initializing Symbols for Rendering value = round ((bme.seaLevelForAltitude(700, bme.readPressure())/100));//We take the current readings, convert to mm Hg. base_array[0] = value; get_data (); } void isr() { //We poll the button in the interrupt to catch the click anyway butt1.tick(); } void loop() { butt1.tick(); //Poll button if (butt1.isClick()) { //When you press: interval *= 2; //Switching the chart scale if (interval > 8) interval = 1; set_period = BASE_PERIOD * interval; //Recalculate the interval for updating data from the sensor get_data (); //Update information on the display } if (millis() - tmr1 >= BASE_PERIOD) { //We collect the basic array of data tmr1 = millis(); //Every 11.25 minutes we take readings from the sensor for (int i = 126; i >= 0; i--) { //Shift the entire array by one point base_array[i + 1] = base_array[i]; } value = round ((bme.seaLevelForAltitude(700, bme.readPressure())/100));//Convert to mm/Hg. base_array[0] = value; //Write the latest readings to an array update_all (); //And remember in EEPROM } if (millis() - tmr2 >= set_period) { //After a period of time set_period (milliseconds) tmr2 = millis(); //Refreshing the data on the screen get_data (); } } void get_data () { //We draw 16 columns of the diagram on the screen for (int i = 15; i >= 0; i--) { drawPlot(0, 3, 16, 4, MIN_VAL, MAX_VAL, (base_array[i * interval])); } delta = ((base_array[0]) - (base_array[15 * interval])); //We calculate the delta (pressure change) for the selected interval screen_data (value, delta, (interval * 3)); //Displaying text information on the screen } void screen_data (int value, int delta, byte interval) { //The function of displaying text information on the screen (everything except for the chart bars) lcd.setCursor(16, 0); lcd.print(value); lcd.setCursor(17, 2); if (delta == value) delta = 0; if (delta > 0) { lcd.print("+"); } else if (delta < 0) { lcd.print("-"); } else if (delta == 0) { lcd.print(" "); } lcd.setCursor(18, 2); lcd.print(abs(delta)); if (abs(delta) < 10) { lcd.setCursor(19, 2); lcd.print(" "); } lcd.setCursor(17, 1); lcd.print("hPa"); lcd.setCursor(17, 3); lcd.print(interval); (interval < 10) ? lcd.print("h ") : lcd.print("h"); } void initPlot() { // necessary symbols for work // created in http://maxpromer.github.io/LCD-Character-Creator/ byte row8[8] = {0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111}; byte row7[8] = {0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111}; byte row6[8] = {0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111}; byte row5[8] = {0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111}; byte row4[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111}; byte row3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111}; byte row2[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111}; byte row1[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111}; lcd.createChar(0, row8); lcd.createChar(1, row1); lcd.createChar(2, row2); lcd.createChar(3, row3); lcd.createChar(4, row4); lcd.createChar(5, row5); lcd.createChar(6, row6); lcd.createChar(7, row7); } //Diagram drawing, code taken from Guyver https://alexgyver.ru/lcd-plots-and-bars/ void drawPlot(byte pos, byte row, byte width, byte height, int min_val, int max_val, int fill_val) { for (byte i = 0; i < width; i++) { plot_array[i] = plot_array[i + 1]; } fill_val = constrain(fill_val, min_val, max_val); plot_array[width - 1] = fill_val; for (byte i = 0; i < width; i++) { // each parameter column int infill, fract; // find the number of whole blocks, taking into account the minimum and maximum, to display on the chart infill = floor((float)(plot_array[i] - min_val) / (max_val - min_val) * height * 10); fract = (infill % 10) * 8 / 10; // find the number of remaining stripes infill = infill / 10; for (byte n = 0; n < height; n++) { // for all graph lines if (n < infill && infill > 0) { // while we're below the level lcd.setCursor(i, (row - n)); // fill in cells lcd.write(0); } if (n >= infill) { // if you reach the level lcd.setCursor(i, (row - n)); if (fract > 0) lcd.write(fract); // заполняем дробные ячейки else lcd.write(16); // if fractional == 0, fill empty for (byte k = n + 1; k < height; k++) { // everything that is on top is filled with empty lcd.setCursor(i, (row - k)); lcd.write(16); } break; } } } } void update_all () { //Обновляем данные в EEPROM eeprom_update_block((void*)&base_array, 0, sizeof(base_array)); } void read_all () { //Reading data from EEPROM eeprom_read_block((void*)&base_array, 0, sizeof(base_array)); }

Arduino Barometer + Barograph with BME280 Sensor

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(1)

-
Engineer Jun 16,2024
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Mirko Pavleski
-
DIY ESP32 Bioresonance Rife Machine with ZAPPER function Rife machine therapy is an alternative treatment developed by Dr. Royal Raymond Rife in the 1930s. H...
-
Arduino VFO Project with a Large LCD Display A Variable Frequency Oscillator (VFO) is an electronic oscillator whose output frequency can be adj...
-
Exploring the Tesla Coil Driver Board, Full Review & Test Results Some time ago I presented you a video in which I analyzed a super cheap Tesla Coil driver that cost...
-
Arduino Eatrthquake alarm and protection system with D7S seismic Sensor Earthquakes are extremely common events around the world. On average, there are fifty earthquakes a...
-
Review and Comparison of Three Inexpensive Metal Detector Kits A metal detector is a device used to detect the presence of metal objects in the ground or other ma...
-
How to make simple Arduino RGB Led strip VU Meter VU meter or volume unit meter is a device intended for visual presentation of the audio signal. It ...
-
Arduino 3D Printed self Balancing Cube Self-balancing devices are electronic devices that use sensors and motors to keep themselves balanc...
-
OpenWebRX - Simplest Rasprberry Pi + RTLSDR Web SDR Radio Software-Defined Radio is a radio communication system where components that have traditionally bee...
-
Colorful Arduino Tetris Game - WS2812B LED Matrix Tutorial Tetris is a puzzle video game created in 1985 by Alexey Pajitnov. Players manipulate falling geomet...
-
Ultra cheap Ultrasonic levitation Device - functionality and testing Ultrasonic levitation is phenomenon where objects are suspended in mid-air using the power of sound ...
-
DIY -Spirit PI- ESP32 + Smartphone Sensitive Metal Detector Pulse Induction (PI) metal detector operates on a principle based on sending short pulses of electr...
-
ESP32 Analog style VU meter with GC9A01 Round Dispalys + Peak Meters A typical VU meter measures audio signals and displays them with a visual indicator. In the classic...
-
Arduino two weel self Balancing Robot Self Balancing Robot is device that can balance itself from falling to the ground. Its function is ...
-
ELECROW CrowPanel ESP32 4.2” E-paper Wi-Fi Info-Dispaly Project An e-paper display (also known as an electronic paper display or E Ink display) is a type of screen...
-
ESP32 Fluid simulation on 16x16 Led Matrix Fluid simulation is a way of replicating the movement and behavior of liquids and gases in differen...
-
Simple GU50 VTTC Tesla Coil with MOT (25+cm Spark) Vacuum Tube Tesla Coils are a common choice for homebuilders for several practical reasons. At Soli...
-
Hourglass ESP8266 Code A hourglass, also known as an sand clock, is a device used to measure the passage of time. It consi...
-
Tug of War Arduino Game on WS2812 Led strip A Tug of War is a classic team-based game where two opposing teams compete to pull a rope in opposi...
-
DIY ESP32 Bioresonance Rife Machine with ZAPPER function Rife machine therapy is an alternative treatment developed by Dr. Royal Raymond Rife in the 1930s. H...
-
Arduino VFO Project with a Large LCD Display A Variable Frequency Oscillator (VFO) is an electronic oscillator whose output frequency can be adj...
-
Exploring the Tesla Coil Driver Board, Full Review & Test Results Some time ago I presented you a video in which I analyzed a super cheap Tesla Coil driver that cost...
-
Arduino Eatrthquake alarm and protection system with D7S seismic Sensor Earthquakes are extremely common events around the world. On average, there are fifty earthquakes a...
-
Review and Comparison of Three Inexpensive Metal Detector Kits A metal detector is a device used to detect the presence of metal objects in the ground or other ma...
-
How to make simple Arduino RGB Led strip VU Meter VU meter or volume unit meter is a device intended for visual presentation of the audio signal. It ...
-
Arduino 3D Printed self Balancing Cube Self-balancing devices are electronic devices that use sensors and motors to keep themselves balanc...
-
OpenWebRX - Simplest Rasprberry Pi + RTLSDR Web SDR Radio Software-Defined Radio is a radio communication system where components that have traditionally bee...
-
Colorful Arduino Tetris Game - WS2812B LED Matrix Tutorial Tetris is a puzzle video game created in 1985 by Alexey Pajitnov. Players manipulate falling geomet...
-
Ultra cheap Ultrasonic levitation Device - functionality and testing Ultrasonic levitation is phenomenon where objects are suspended in mid-air using the power of sound ...
-
DIY -Spirit PI- ESP32 + Smartphone Sensitive Metal Detector Pulse Induction (PI) metal detector operates on a principle based on sending short pulses of electr...
-
ESP32 Analog style VU meter with GC9A01 Round Dispalys + Peak Meters A typical VU meter measures audio signals and displays them with a visual indicator. In the classic...
-
Commodore 64 1541-II Floppy Disk Drive C64 Power Supply Unit USB-C 5V 12V DIN connector 5.25
139 1 2 -
Easy to print simple stacking organizer with drawers
79 0 0 -
-
-
-
Modifying a Hotplate to a Reflow Solder Station
1120 1 6 -
MPL3115A2 Barometric Pressure, Altitude, and Temperature Sensor
630 0 1 -
-
Nintendo 64DD Replacement Shell
485 0 2 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
1407 4 3