Skip to content

Obviate.io

To anticipate and prevent

  • Home
  • About Us
  • History
  • Privacy Policy
  • Toggle search form

Video Tutorial: BME820 Environmental Sensor and MQTT under Micropython

Posted on 2018-02-20 By Jon No Comments on Video Tutorial: BME820 Environmental Sensor and MQTT under Micropython

This week we’re starting to make our Micropython powered Wemos D1 truly useful with a sensor and data collection. We’ll wire up a BME280 sensor which measures temperature, humidity and air pressure. After we know it works, we’ll use Wifi and MQTT to send the data to a website for viewing.

(View on youtube)

Links & Commands

  • Bosch product page for the BME280
  • BME280 available on Aliexpress
  • “Wide range of Hygrometers: DHT22, AM2302, AM2320, AM2321, SHT71, HTU21D, Si7021, BME280”
  • git clone https://github.com/catdog2/mpy_bme280_esp8266.git
  • GitHub repository for BME280 Library
  • Alternate Zip download link

  • git clone https://github.com/obviateio/micropython.git

  • GitHub repository Micropython sample code
  • Alternate Zip download link

  • IO.Adafruit.com

  • Delete the default feed
  • Create the following feeds: ‘temp’, ‘pres’, ‘humid’
  • The feed names must exactly match that which is in the code.

  • MQTT.org

  • Wikipedia on MQTT
  • Wiring is VIN (on BME280) to 3.3v (on Wemos D1), GND to GND, SCL to D1 & SDA to D2
  • ls /dev/cu.*
  • export AMPY_PORT=/dev/cu.wchusbserial1450
  • ampy run i2cscanner.py
  • ampy put bme280.py bme280.py
  • ampy put bme280-print.py main.py
  • screen /dev/cu.wchusbserial1450 115200
  • ampy put wificlient-boot.py boot.py
  • ampy put bme280-mqtt.py main.py

The above seems like a fairly long list of commands and links, but a lot of it is just background information — not to mention the usual “build up” of a tutorial. Realistically you can wire a BME280 to the controller, load the code and be fully “up and running” in just a few minutes. This code could also be used on a “bring your own MQTT server”, but I wanted to keep it simple for the purposes of the tutorial (hence Adafruit). This also shows that with the proper application of libraries, we could send data from just about any sensor to the internet with ease (and just a few lines of code).

If you enjoyed it, please like / subscribe / comment. Let me know what you’d like to see next! I’ve gotten some great content requests already so keep the suggestions coming!

DIY, Electronics Tags:adafruit, AliExpress, bme280, bosch, DIY, electronics, enviromental, esp8266, humidity, hygrometer, i2c, micropython, pressure, sensor, temperature, weather, wemos d1

Post navigation

Previous Post: Video Tutorial: Writing code onto Micropython Wemos D1 using Ampy
Next Post: Video Tutorial: How NOT to package your ESP8266 & BME280

More Related Articles

A Pinterest success story DIY
Video Tutorial: Flashing Micropython on a Wemos D1 Mini Video
Recording high quality voice prompts for Asterisk VoIP

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

February 2018
S M T W T F S
 123
45678910
11121314151617
18192021222324
25262728  
« Jan   Nov »

Copyright © 2022 Obviate.io

Powered by PressBook Premium theme