Code Monkey home page Code Monkey logo

esp8266_sensor_bme280's Introduction

ESP_8266 Temperature, Pressure & Humidity project

GitHub GitHub all releases AUR last modified

The BME280 module, thanks to its sensors, can detect the temperature, pressure and humidity of the surrounding environment, and send this data to the Wemos board which, thanks to its wifi module, can transmit them to a PC or smartphone.

Feautures

Thanks to code inside (sketch), the data is sent to a web platform (www.thingspeak.com) and displayed through graphics. Moreover, these and other data can be viewed on all network devices because the Wemos card works as a web-server (see below). It is possible to activate a bot on a Telegram with which to remotely interrogate the sensor (see below).

This is my chanel were data are sent . The data are in real-time

Dependency:

Library Source
ESP8266WiFi.h ESP8266 Arduino Core (ver 3.0.2)
Ticker.h ESP8266 Arduino Core (ver 3.0.2)
ESP8266mDNS.h ESP8266 Arduino Core (ver 3.0.2)
FS.h ESP8266 Arduino Core (ver 3.0.2)
ESPAsyncTCP.h https://github.com/me-no-dev/ESPAsyncTCP
ESPAsyncWebServer.h https://github.com/me-no-dev/ESPAsyncWebServer
ESPAsyncWiFiManager.h WifiManager 2.0.3 alpha
AsyncTelegram.h Ver. 1.1.3
ArduinoJson.h Ver 6.15.1
ThingSpeak.h Ver 2.0.1
TimeLib.h Ver 1.6.1
ArduinoOTA.h .......

Necessary material:

Software istruction

First you need to register the service (free but with some limitations) here: www.thingspeak.com.
So, download the code for Arduino from this repository.
With the Arduino IDE, you must enter in the secret.h file and update the Channel ID and the Channel Write Key values whith obtained when the service was activated on Thingspeak.

Very important note: to have the Arduino IDE compile the secret.h file you need to modify the sketch following the instructions in the comments.

In this project, in addition to managing the BMP280 sensor, the Wemos card also acts as a web-server. For this purpose, web pages have been created which function as a user interface. These must be loaded into the SPIFFS of the ESP8266. Here the plug-in about it ESP8266 Sketch Data Upload.

When your ESP starts up, it sets it up in Station mode and tries to connect to a previously saved Access Point. If this is unsuccessful (or no previous network saved) it moves the ESP into Access Point mode and spins up a WebServer (default ip 192.168.4.1) Using any wifi enabled device with a browser (computer, phone, tablet) connect to the newly created Access Point (ESP8266 AP Wifi). Because of the Captive Portal and the DNS server you will either get a 'Join to network' type of popup or get any domain you try to access redirected to the configuration portal. Choose one of the access points scanned, enter password, click save. ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure. Here this tutorial.

Once the wifi connection is made, the card is now reachable on our network. It is sufficient to type in the address bar of the browser the url http://myesp.local to be able to navigate between the sensor pages. The host name is the default but can be changed in the config.json file (see below).

In the landing page the access data (user & password) are available as tip by passing the pointer over the fields. They are editable via the config.json file.

On the setting page you can find different values, such as the IP address of the card, its ID name, the name of the wi-fi network and its power (RSSI), and other specific card data. Below, in the File Manager section, you have the image of the SPIFFS and further down, you have the possibility to update the Html files as well as upload new ones.

Configuration

Through the config.json file it is possible to configure the program at run-time. In fact, in the file you find the following fields and modifiable sub fields:

  • "board":

    • "board_id": the identification name of the card;
    • "type": it must remain unchanged;
    • "local_host_name": the host name of the card to connect to with your browser;
    • "rateo": no longer in use.
  • "login":

    • "user": user;
    • "password": password.
  • "location":

    • "city": the name of the city where the sensor is installed;
    • "country": the name of the country where the sensor is installed.
  • "field_1" & "field_2":

    • "name": it must remain unchanged;
    • "url": Thingspeak channel fields URL.

The other fields are not currently used.

After modifying the file, you can upload it using the "upload file" function on the setting page. The changes will take effect immediately.

Firmware OTA update (Over The Air)

You can now also update the firmware in the card via the OTA (Over The Air) feature. In fact, it is no longer necessary to connect it to the PC but through the Arduino IDE it can be updated remotely. Just select the network port in the menu: tools -> port -> Network Ports.

Enable a Telegram bot to be able to interrogate the sensor

First of all you need to create a bot on the Telegram with BothFather function. The procedure can be found at this link.

Obtained the token of our new bot, it must be inserted in the secret.h file.

Through the bot, you can interrogate the sensor with commands:

  • "read": returns the latest temperature and humidity reading;
  • "wifi": returns the parameters of the wifi connection;
  • "stato": returns the last status of the data transmission to ThingSpeak;
  • "reset": reboot the card.

Project version for DTH22 sensor

Of this project there is also the version for DHT22 sensors. However, only the temperature and humidity can be read with these sensors. you can find it in the repository: https://github.com/birrozza/esp_8266_T-H

Stay tuned!!! (last update March 2022)

If you want to support me, you can always donate to my paypal account https://www.paypal.me/birrozza.

Thanks

esp8266_sensor_bme280's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.