Publish by telegram
Telegram so far is another chat application but it is also a great IOT platform to rip off many benefits - How? Here's it is.
Publish by telegram
Prelude: Publishing data on IOT platforms like thingspeak.com has gain immense popularity over last four years. Millions of channels have cropped up publishing useful and useless data all over the world. One advantage of thingspeak.com is that you can see your data in a beautiful timeline trend curve. However, many a times you may not need to see data on a timeline. Rather the raw data in quick succession will give you everything that you need to know. Telegram Bot channel really comes handy for the same. While a free account in thingspeak.com gives you maximum 4 data per minute, the telegram channel provides maximum 12 raw data per minute flat, means every 5 seconds a data can be published which is by thingspeak standard 3 times faster! Please ensure that your internet connection is anything but slow, otherwise the maximum number of data will be reduced. Right now in India mostly under 45 persons are using telegram app for getting / using slot booking for vaccinations. This is the right time now to get into telegram venture to spread your message as well!
Project idea: What you need is an ESP32, an LED and a sensor of your interest, which can be connected to the ESP32 and which can give data in less than 5 seconds interval. There are choices of having multiple wifi network connections. If one fails others witl be tried up automatically by the ESPs. Also if the connections stalls or fails to transfer data to telegram, the ESPs will restart with another connection. The LED connected is used as an indication that the data is just uploaded.
Telegram Bot principle: To start with first you have to create a channel in telegram which will then communicate with your ESPs. For this step, the first thing you need to do is to install the Telegram app into your mobile phone, tablet, or any of the other devices of your choice. You can get the free app easily from Google Play Store, App Store, etc.
After installing the app and setting up your account. Search Botfather in your app as soon as you open Botfather you will see a Start or a Restart button this will open up a list of commands and their applications you need to click on the /newbot command. After this command, you need to give your bot a name. I have given the name "bera_arduino". As the name of the bot is set, you need to set the username. While setting the username you should keep in mind that the username must be unique and it should end with the word "bot" - bera1bot. As soon as you set the username your bot will be created and you will see an API token save this somewhere as it will be needed in the next step.
Now two more parameters to be found out for this bera_arduino channel – chat_id and bot_token to prepare our sketch. After having created the chat name and user id, give a /mybots command ,it will open your bots. Select your chosen bot and you will be presented with a graphical window like this. Press the API_token and you will receive the write bot_token for your bot.
The only other data required is your chatid. To get it find the bot named @GetIDsBot and you will be presented with an window like this describing your chat ID.
Well, now you are all set with all the credentials to run your chatbot in Telegram. Write down these two ghostly looking numbers clearly for using them in the sketch.
Schematic:
BOM: 1. ESP32 - $4 to $5 a piece. 2. DS18B20 - $1 a piece. LED, 5.6K Resistor & Power supply
Software: Most of the heavy loads are lifted by the Telegram library file -
#include < universaltelegrambot.h > // Universal Telegram Bot Library written by Brian Lough: https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot
#include < arduinojson.h >
These two header files can be obtained from online by “Sketch” -> “Include Library” -> “Manage Libraries” or they can be taken from the attached software bundle coming with this project.
In case the network goes down or hangs the ESP will restart. I have provided the facility for getting the software works on ESP8266 as well.
Prototype:
Aftermath: With my Fiber to Home internet connection I get 12 readings per minute – one reading in every 5 seconds which is extremely good. If the network slows down, the number of uploads will be reduced. I wish telegram also to have trend recording like that we have in thingspeak.com.
Bye bye,
Bera / Vindhyanagar
< /arduinojson.h >< /universaltelegrambot.h >
Prelude: Publishing data on IOT platforms like thingspeak.com has gain immense popularity over last four years. Millions of channels have cropped up publishing useful and useless data all over the world. One advantage of thingspeak.com is that you can see your data in a beautiful timeline trend curve. However, many a times you may not need to see data on a timeline. Rather the raw data in quick succession will give you everything that you need to know. Telegram Bot channel really comes handy for the same. While a free account in thingspeak.com gives you maximum 4 data per minute, the telegram channel provides maximum 12 raw data per minute flat, means every 5 seconds a data can be published which is by thingspeak standard 3 times faster! Please ensure that your internet connection is anything but slow, otherwise the maximum number of data will be reduced. Right now in India mostly under 45 persons are using telegram app for getting / using slot booking for vaccinations. This is the right time now to get into telegram venture to spread your message as well!
Project idea: What you need is an ESP32, an LED and a sensor of your interest, which can be connected to the ESP32 and which can give data in less than 5 seconds interval. There are choices of having multiple wifi network connections. If one fails others witl be tried up automatically by the ESPs. Also if the connections stalls or fails to transfer data to telegram, the ESPs will restart with another connection. The LED connected is used as an indication that the data is just uploaded.
Telegram Bot principle: To start with first you have to create a channel in telegram which will then communicate with your ESPs. For this step, the first thing you need to do is to install the Telegram app into your mobile phone, tablet, or any of the other devices of your choice. You can get the free app easily from Google Play Store, App Store, etc.
After installing the app and setting up your account. Search Botfather in your app as soon as you open Botfather you will see a Start or a Restart button this will open up a list of commands and their applications you need to click on the /newbot command. After this command, you need to give your bot a name. I have given the name "bera_arduino". As the name of the bot is set, you need to set the username. While setting the username you should keep in mind that the username must be unique and it should end with the word "bot" - bera1bot. As soon as you set the username your bot will be created and you will see an API token save this somewhere as it will be needed in the next step.
Now two more parameters to be found out for this bera_arduino channel – chat_id and bot_token to prepare our sketch. After having created the chat name and user id, give a /mybots command ,it will open your bots. Select your chosen bot and you will be presented with a graphical window like this. Press the API_token and you will receive the write bot_token for your bot.
The only other data required is your chatid. To get it find the bot named @GetIDsBot and you will be presented with an window like this describing your chat ID.
Well, now you are all set with all the credentials to run your chatbot in Telegram. Write down these two ghostly looking numbers clearly for using them in the sketch.
Schematic:
BOM: 1. ESP32 - $4 to $5 a piece. 2. DS18B20 - $1 a piece. LED, 5.6K Resistor & Power supply
Software: Most of the heavy loads are lifted by the Telegram library file -
#include < universaltelegrambot.h > // Universal Telegram Bot Library written by Brian Lough: https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot
#include < arduinojson.h >
These two header files can be obtained from online by “Sketch” -> “Include Library” -> “Manage Libraries” or they can be taken from the attached software bundle coming with this project.
In case the network goes down or hangs the ESP will restart. I have provided the facility for getting the software works on ESP8266 as well.
Prototype:
Aftermath: With my Fiber to Home internet connection I get 12 readings per minute – one reading in every 5 seconds which is extremely good. If the network slows down, the number of uploads will be reduced. I wish telegram also to have trend recording like that we have in thingspeak.com.
Bye bye,
Bera / Vindhyanagar
< /arduinojson.h >< /universaltelegrambot.h >
Discussion (0 commentaire(s))