BME680 to Web service


#1

I bought a BME680 sensor and got it working on the command line.

What I’m wondering is how do I hook it up to a web service where I can conveniently see the readings? I can’t find any tutorials about this. What are the best web services for viewing the data created by this sensor. Thanks


#2

I use Python3 the and the BME680 modules and send via MQTT to Cayenne.

It wasn’t difficult and you can do it in a few lines.

Cayenne is still a bit rough around the edges, but it does work and is easy to setup
(It ‘rough’ as they had a switch to MQTT and are now catching up with all the other things they had intended to add).

If interested I can post how to do it.

Also as it is MQTT, for any other service using MQTT you can just alter the server and the message it needs to see.


#3

Hi bensimmo,

Thank you for your helpful tips. I now have some terms which I can use to research more about this topic.

I would really appreciate if you did write how you setup yours, that would be very helpful for me and others getting started.

Thank you


#4

I send all data to bigquery, a service from google cloud. With the sensor hooked to the raspberry, you can stream data to a table by adding a few lines of python.

There’s a service called data studio that can connect to bigquery, which might work for you. I prefer to have more fine grained tables/charts so I’ve written scripts in R that can read from bigquery. Integration is pretty good.


#5

Thanks Koaning,

I’d like to use an open source and/or independent solution if I can, preferably non Google.

I like the sound of the suggestion by bensimmo, but I’m at a loss as to where to start. His steps will be invaluable.


#6

in that case, if you can log everything into a csv file i might suggest using open source tools locally.

if you prefer python -> google pandas, jupyter and matplotlib
if you dont mind to learn a bit of R [its fun!] -> google dplyr, ggplot and shiny


#7

Can you share your steps bensimmo?

I’ve settled on using the Cayenne method as I like the iOS app integration.

Unfortunately it seems that BME680 is not supported out of the box and your wisdom is the missing link to making it work.

Thank you everyone for the help on this topic.


#8

First of all there are only a few auto detected devices if you install Cayenne from the App (I use Android) to the Pi.
Mainly the basic Pi measurements and a few sensors that they used to support pre-MQTT updates.
Now you DIY the sensors.
I’m not quite sure how to add them from a setup done from the App as the layout is a bit different to just doing it from Raspbian.
But it is probably just a case of finding the location.

To do it from Raspbian
You use this https://github.com/myDevicesIoT/Cayenne-MQTT-Python
which is basically
pip3 install cayenne-mqtt

then you create you python programme using the Pimoroni BME680 module
Then using the code there as a base, follow it adding you code and sending to your Bring Your Own credentials.
I can add more later if needed.


#9

Thank you,

I can follow as far as installing, but the last part is beyond me! I think I get the concept, taking the example sensor python file and adding the Cayenne authentication credentials, but exactly how you do that and communicate with the API isn’t obvious to me.

Do you have an example you could share?


#10

Hi,
You can also use beebotte, free version could be sufficient. Am using it with the bme680 too.

from beebotte import *
# ----------------------------
# Beebotte
# ----------------------------

bbt = BBT(token,secret)
temp_resource   = Resource(bbt, 'Station', 'Temperature')
humid_resource  = Resource(bbt, 'Station', 'Humidity')
gas_resource   = Resource(bbt, 'Station', 'Gas')
score_resource  = Resource(bbt, 'Station', 'Score')

def send_to_beebotte(t,h,g,a):
    try:
      temp_resource.write(t)
      humid_resource.write(h)
      gas_resource.write(g)
      score_resource.write(a)
    except Exception:
      print ("Error while writing to Beebotte")


if time.time() - last_update > 300: # Limit update to every 5 minutes
            last_update = time.time()
            send_to_beebotte(temp,hum,gas,air_quality_score)
            send_to_jeedom(288,int(air_quality_score))

You can use mqtt as well with beebotte
and here the dashboard
https://beebotte.com/dash/b9882bb0-b088-11e8-ac97-37475ed922b8


#11

Thank you, i’ll Have to check out BeeBotte too. I appreciate you posting the required code, I wouldn’t know where to start otherwise.

To run this, would pasting your code into one of the example python scripts supplied for the sensor and running, be enough to post data to the service? I figure I’d also need to install some software from BeeBotte firstly also.


#12

U wlc
More details here
https://beebotte.com/tutorials/monitor_humidity_and_temperature_with_raspberrypi
;)


#13

That guide is for DHT11 sensors, will that matter?

Thanks for your help


#14