Monitor and Control Weather Station With Telegram App

by make2explore in Circuits > Arduino

1787 Views, 11 Favorites, 0 Comments

Monitor and Control Weather Station With Telegram App

monitor-weather-make2explore.png

In this project we've build Weather Station which keeps record of meteorological parameters. It measures atmospheric conditions to provide information for weather forecasts and to study the weather and climate.

We'll add a facility to this weather station which makes it to be accessed and controlled from anywhere from the world. We'll create Telegram Bot for our Weather Station and program it to get interact and give responses about sensor readings and relay outputs whenever we will contact it using telegram Application from our Smartphone or from PC.

So you just need to send a message to your Telegram Bot to monitor/Control your sensors/Outputs from anywhere in the world.

Supplies

We'll require following components to build this project on breadboard.

Parts Required

1. NodeMCU ESP32s Development Board

2. DHT22 Temperature and Humidity Sensor Module

3. BMP280 Temperature and Pressure Sensor

4. Four Channel Relay Board

5. MB102 Breadboard Power Supply module

6. 12V DC Fan

7. Batteries - 11.1V LiPo and 7.4V LiPo

What Are Telegram Bots ?

make2explore-weather-station.gif

"Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to our Bot API."

you can check out more info about bots on Telegram Website - https://core.telegram.org/bots

Functional Block Diagram

make2explore-ESP-Tele-monotor-WT.gif
  • As shown in above block diagram DHT22 and BMP280 Sensors fed (Temperature, Humidity, Atmospheric Pressure and Altitude) Readings to ESP32 Development Board
  • The ESP32 Development Board is WiFi enabled which can connect to wireless router which is further connected to Internet.
  • You’ll create and program Telegram bot for your ESP32 board;
  • You can start a conversation with that bot.
  • When you send the message /readings to the bot, the ESP board receives the message and responds with the current meteorological parameters.
  • You can send the /start message to receive a welcome message with the commands to control the board.
  • We've also implemented commands to control the Outputs of ESP32 like turning relays ON/OFF.
  • So in this way if you have Smartphone with internet connectivity, and you are authorized user then you can monitor and control this weather station from anywhere from world using Telegram App

Schematics

Weather-Station-Telegram-Monitor-Control.png

The circuit diagram or schematics of the project is given above or you can also get it on our GitHub

Software Setup : Apps

In software setup, You need to complete following four steps

1. We need Telegram Application to be Installed on our smartphone.

2. Get Your Telegram Chat ID -

  • Why ? - To chat with an Authorized User ESPCAM needs USER ID / CHAT ID of our Telegram
  • Because anyone that knows your bot username can interact with it. To make sure that we ignore such spam messages that are not from our Telegram account (or any authorized users). We need to get our Telegram Chat ID.
  • Whenever your telegram bot receives a message, the ESP CAM Board can check whether the sender ID corresponds to your User ID and if it is correct then and then only it handle the message.

3. Create Telegram Bot -

  • Create Telegram bot for our Home Security Application/Project
  • Chat with Masterbot named “BotFather” to create a new bot

4. Get Bot Token -

  • When you create new bot – “BotFather” will issue a new bot token for your bot
  • Save the bot token because you’ll need it later (to Enter it in code) so that the ESP32 CAM can interact with the bot.

So we've explained all above steps in following video, check out and complete all above steps

Software : Installing Libraries

  • For this project you need to install several libraries.

==> Telegram Bot Library, ArduinoJson Library, BMP280 and DHT sensor library

The following libraries can be installed through the Arduino Library Manager. Go to Sketch > Include Library> Manage Libraries and search for the library name.

==> Universal Telegram Bot Library

To interact with the Telegram bot, we’ll use the Universal Telegram Bot Library created by Brian Lough that provides an easy interface for the Telegram Bot API.

Follow the next steps to install the latest release of the library.

  • Click here to download the Universal Arduino Telegram Bot library.
  • Go to Sketch > Include Library > Add.ZIP Library...
  • Add the library you’ve just downloaded

Important Note: don’t install the library through the Arduino Library Manager because it might get install a deprecated version.

For all the details about the library, take a look at the Universal Arduino Telegram Bot Library GitHub page.

Software : Code of the Project

Code of the project is given below, with libraries. It is also available on our GitHub. We have explained code in following video, check out to learn more

Demonstration

Monitoring and Controlling ESP Weather Station using Telegram App

Check out following video where we have explained detailed working of this project, its block diagram, schematics and Implementation. Finally you can also see the working demo of this project.

Source Code + Schematics + Libraries

You'll find all the information about this project on make2explore Github Repository