# Bme280 temp dashboard

**URL:** <https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875>\
**Category:** Raspberry Pi\
**Created:** [23 January 2022 05:22 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875 "2022-01-23T05:22:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![karl70817](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@karl70817](https://forum.core-electronics.com.au/u/karl70817)\
**Post date:** [23 January 2022 05:22 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/1 "2022-01-23T05:22:52Z")

</div>

Hi all

Im new to this, i havd a raspberry pi 4 and piicodev bme280  
I can run some code and see temps pressures rolling over every sec, is there a way to have a dashboard or something to display temp in a nice way like a guage so its not just a massive line of code ?

Thanks karl

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [23 January 2022 05:45 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/2 "2022-01-23T05:45:33Z")

</div>

If you are using Python then have a look at “pygame”.  
It is a library that allows for graphical display on the screen.

I used it on a few small projects, happy with the results.

Cheers  
Jim

---

<div class="post-metadata">

**Author:** ![Liam120347](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam120347/32/5003_2.png) [@Liam120347](https://forum.core-electronics.com.au/u/Liam120347)\
**Post date:** [23 January 2022 05:46 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/3 "2022-01-23T05:46:09Z")

</div>

Hi Karl,

Welcome to the forum!!

I’d take a look at combining the output with [matplotlib](https://matplotlib.org/) to make a real time graph on your Pi’s screen or using [Flask](https://core-electronics.com.au/tutorials/flask-with-python.html) to host a local webserver.

There are plenty of options out there!

---

<div class="post-metadata">

**Author:** ![Oliver33](https://avatars.discourse-cdn.com/v4/letter/o/a9adbd/32.png) [@Oliver33](https://forum.core-electronics.com.au/u/Oliver33)\
**Post date:** [23 January 2022 05:46 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/4 "2022-01-23T05:46:11Z")

</div>

For something simple, checkout Tkinter

> **[Raspberry Pi Workshop for Beginners - Tutorial](https://core-electronics.com.au/tutorials/raspberry-pi-workshop-for-beginners.html#ch4)**
>
> Welcome to the Raspberry Pi Workshop for Beginners! Here you'll be able to follow along with our series of bite-sized videos that cover everything you'll need to know to get started with your Raspberry Pi, and start making awesome projects. My name...

---

<div class="post-metadata">

**Author:** ![karl70817](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@karl70817](https://forum.core-electronics.com.au/u/karl70817)\
**Post date:** [23 February 2022 09:59 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/5 "2022-02-23T09:59:57Z")

</div>

so i have been playing round with the temp sensoor and rpi4,  
i have been uploading to weather underground dont know if any one uses this but the code will run for about 2 days then have an error and stop uploading, can restart code then all good again for 2 days,  
not sure this issue,

another questin is there some filtering i can use for this sensor?  
i am using temp, hum, press aswell as a formula for dew point,  
data is uploaded every 3 mins also

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)\
**Post date:** [24 February 2022 01:38 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/6 "2022-02-24T01:38:34Z")

</div>

Hi Karl,

Neat project!!

Could you please send through your code so we can take a look - alongside this what hardware are you using?

Since the sensor uses I2C rather than an analog, filtering has to be done in software. There are some super simple filters that you could implement such as a [moving average(MA) filter](https://towardsdatascience.com/moving-averages-in-python-16170e20f6c), each filter has some drawbacks (MA has a time delay but noise suppression)

Liam.

---

<div class="post-metadata">

**Author:** ![karl70817](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@karl70817](https://forum.core-electronics.com.au/u/karl70817)\
**Post date:** [26 February 2022 01:30 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/7 "2022-02-26T01:30:05Z")

</div>

ok sorry for delayed reply, so i have as raspberry pi4 and a piicodev bme280 and an adaptor board  
i have this code now i wasn’t the designer of this but i have moded this to work with this sensor, added a 3min refresh and am able to calculate due point, i removed station id and password,  
after about 2 days it stops uploading as says connection error and the code stops i can start it again and its fine again for about 2 days then same thing happens,  
i have this = sensor = PiicoDev\_BME280(t\_mode=2, p\_mode=5, h\_mode=1, iir=2)  
and i think it is filtering but not realy sure  
all this work on weather underground

---

<div class="post-metadata">

**Author:** ![karl70817](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@karl70817](https://forum.core-electronics.com.au/u/karl70817)\
**Post date:** [26 February 2022 01:31 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/8 "2022-02-26T01:31:41Z")

</div>

version = “1.51”  
import requests  
import time  
from PiicoDev\_BME280 import PiicoDev\_BME280  
from PiicoDev\_Unified import sleep\_ms  
from datetime import datetime

# Station ID

station\_ID =

# Auth key

station\_KEY =

interval = 60\*3 #Time between sends in seconds

# Execution below this line, no need to edit

#-----------------------------------------------------------------------#

# Base URL

base\_URL = “[https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php](https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php)”

while True:  
software\_type = “WU\_Upload-v” + version

```
print("Reading sensor...")

sensor = PiicoDev_BME280(t_mode=2, p_mode=5, h_mode=1, iir=2)

tempC, presPa, humRH = sensor.values()

#Convert temp to degF
tempF = tempC*(9/5) + 32

#Convert pressure to inches of mercury
inchMerc = presPa*0.0002953

#Put dew point stuff here

c = tempF
x = 1 - 0.01 * humRH;

dewpoint = (14.55 + 0.114 * c) * x;
dewpoint = dewpoint + ((2.5 + 0.007 * c) * x) ** 3;
dewpoint = dewpoint + (15.9 + 0.117 * c) * x ** 14;
dewpoint = c - dewpoint;

# Build first half of POST
post_URL = base_URL+"?ID="+station_ID+"&PASSWORD="+station_KEY+"&dateutc=now"

# Fill dictionary with variables
payload = {"tempf": tempF, "humidity": humRH, "baromin": inchMerc,\
    "dewptf": dewpoint,"softwaretype": software_type, "version": version,\
    "action": "updateraw"}

# Push data, exit on error
print("Connecting to Weather Underground...")
try:
    wu_push = requests.get(post_URL, params=payload, timeout=15)
except requests.exceptions.Timeout:
    print("Timeout!")
    exit()
except requests.exceptions.ConnectionError:
    print("Network Error!")
    exit()
except requests.exceptions.RequestException as e:
    print("Unknown Error!")
    exit()

# See if there was a good connection
if wu_push.status_code != 200:
    print("Error communicating with server")
    exit()

# Check response
if "success" in wu_push.text:
    # Print status message and write conditions to log
    print("Upload OK!")

elif "Password" in wu_push.text:
    print("Station ID or password error!")
else:
    print("Invalid response!")

# Close file and print message
print("Done")

#Wait interval until next data send
time.sleep(interval)

```

# EOF

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [26 February 2022 18:59 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/9 "2022-02-26T18:59:43Z")

</div>

> [@karl70817](#):
>
> ```auto
> # See if there was a good connection
> if wu_push.status_code != 200:
> print("Error communicating with server")
> exit()
> 
> ```

Is this the error you get ?  
How is the Pi4 connected to the internet, Wifi or Ethernet Cable ?

If it is “Error communicating with server”.  
Exiting the program because the server cannot be communicated with just once, is not good programming. Internet communications are far from perfect. If anything the program should print the error message and continue, one reading lost.

You could try removing the `exit()` in the above code and see what happens.

Of course it may be something else.  
You could try printing the readings to the Pi4 screen and not send to the URL and see if it runs for more than 2 days. If not it is something in the Pi4 that is stopping the program. If it runs ok then it could be the internet connection to the Pi4.

The aim is to find what it causing the program to exit.

Regards  
Jim

---

<div class="post-metadata">

**Author:** ![karl70817](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@karl70817](https://forum.core-electronics.com.au/u/karl70817)\
**Post date:** [27 February 2022 01:11 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/10 "2022-02-27T01:11:31Z")

</div>

Yes that might do it ill get rid of it and see what happens but still weird that it does it after 2 days

I guess i will change it and wait

---

<div class="post-metadata">

**Author:** ![MuhammadSalman191151](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@MuhammadSalman191151](https://forum.core-electronics.com.au/u/MuhammadSalman191151)\
**Post date:** [28 February 2022 21:39 UTC](https://forum.core-electronics.com.au/t/bme280-temp-dashboard/12875/11 "2022-02-28T21:39:04Z")

</div>

> **[Tiny BME280 Weather Station housing PCB - Share Project - PCBWay](https://www.pcbway.com/project/shareproject/Tiny_BME280_Weather_Station_housing_PCB.html)**
>
> This PCB was designed for Weather Station sensor housing, but instead of using SHTxx sensor, the BME280 provides an all-in-one solution with Temperature, Humidity and Pressure in one package! Most of ...

see this project he has used BME280 to show and declear the dashboard to show temperature.  
this will help you in this regard, clearing the issue of guage and dashboard.
