Skip to content

MicroPython+ESP8266, read SHT30, BMP180, send to Logstash

Notifications You must be signed in to change notification settings

antrew/micropython-air-sensor

Repository files navigation

Monitor Air Quality with ESP8266+MicroPython and Elastic Stack

This project does the following:

  • Read temperature and humidity from an SHT30 sensor
  • Send the read values to Logstash with an HTTP POST request with JSON payload

Prerequisites

Hardware

  • WeMos ESP8266
  • WeMos SHT30

Build tools

You will need to install the following tools to flash this project to an ESP8266 board:

  • adafruit-ampy - a tool to interact with a MicroPython flashed board:
    pip3 install adafruit-ampy
    

Flashing MicroPython

If you haven't already done it, follow this tutorial to flash MicroPython to your ESP8266: http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/intro.html

Uploading scripts

Uploading scripts

  1. Set your WLAN SSID and password in config.py
  2. Run the following commands to upload the scripts from this repository to your MicroPython board:
# modify the path to the USB serial port if necessary
export AMPY_PORT=/dev/ttyUSB0
ampy put sht30.py
ampy put bmp180.py
ampy put config.py
ampy put logstash.py
ampy put wlan.py
ampy put app.py
ampy put main.py

Testing parts

Testing SHT30

ampy run test_sht30.py

Testing BMP180

ampy run test_bmp180.py

Testing WLAN

ampy run test_wlan.py

Testing Logstash

ampy run test_logstash.py

Serial console

miniterm.py --raw /dev/ttyUSB0 115200

Acknowledgements

About

MicroPython+ESP8266, read SHT30, BMP180, send to Logstash

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages