CONTROLLING LIGHT USING TELEGRAM BOT WITH ADAFRUIT_IO

I am very happy to share my first bog, which I have recently learned about IoT,robotics and embedded system from internship class provided by Inmovidu.

CONTROLLING LIGHT FROM BOT:

This is about sending command from telegram and turning light ON\OFF. The values are sent to the adafruit for storage and indication. The values are can be viewed in the dashboard by indicator, toogle etc…This is implemented using the GOOGLE COLAB and it is deployed in HEROKU.

When we send the commands like “/start” , “/turnonthelight” and “/turnoffthelight” . The picture related to command will be displayed on the same telegram page with some text. The values are sent to the adafruit and it shows the status of the bulb in the indicator.

What is Telegram bot?

Telegram bots are small programs that can embed in Telegram chats or public channels and perform a specific function. It is based on a server which uses telegram bot API(Application Programming Interface) to connect telegram servers.API,It is a software intermediary that allows two applications to talk to each other.

What is Adafruit?

Adafruit.io is a cloud service — that just means we run it for you and you don’t have to manage it. You can connect to it over the Internet. It’s meant primarily for storing and then retrieving data but it can do a lot more than just that!

Create a account on adafruit.io and create new dashboard and in that create a feed. I have created my feed as “bot”. And created a toggle block to view the output. I have created a bot in my telegram with the name ‘Bot’ itself

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

when I give the command /turnon a data point with value 1 is sent to respective feed on the adafruit and the light is ON .

In the same way when I enter the command /turnoff a data point with value 0 is sent to the feed and the light is OFF.

The entire code is deployed on Heroku which is a container-based cloud platform service supporting several programming languages.

The python code for this can be viewed by clicking here

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store