top of page
Writer's pictureUsha Saha

Controlling Raspberry Pi's GPIOs using the Telegram bot

Updated: Sep 28


This article Controlling Raspberry Pi's GPIOs using the Telegram bot is all about how one can control the Raspberry Pi's #GPIOs(General Purpose Input/Output's) with a telegram bot. Let's have some idea about what is a Telegram bot. The Telegram bot is basically a platform provided by telegram where the #telegram is controlled by software rather than manually. The bot can perform functions like search, remind, teach, broadcast, and many more. So let's get headed towards the article and the codes implemented.


Hardware used

The list of components used are shown below;


Raspberry Pi 3 Model B+

The Raspberry Pi is a series of small single-board computers. Here 3 Model B+ indicates the generation of the RPi board. The Raspberry Pi is also written as RPI or RPi or Raspberry Pie. The Raspberry Pi Model B+ is of the nearby size of a credit card.


Raspberry Pi 3 Model  B+
Raspberry Pi 3 Model B+



Bread Board:- A breadboard is a rectangular board with small holes in it which are used for connecting elements. The connections are not fixed and can be varied. In a breadboard, all the holes in one horizontal line are in series connection with each other. Breadboards are made from plastic and come in all shapes, sizes, and even different colors, the most common sizes are "full-size," "half-size," and "mini" breadboards.

Bread Board
Bread Board

Jumper wires:- Jumper wires are used to establish a connection between different elements in the circuit and #Raspberrypi board. There are two types of wire, male and female. The male wires have the ends that can be connected to other ends and the female wires are the ones that have the receiving end.

Jumper Wires
Jumper Wires




USB Cable

This cable is used to connect the RaspberryPi to the power supply. It also helps in the transmission of data.



 USB Cable
USB Cable

LED:- A Light Emitting Diode is a semiconductor device that emits light when current flows through it.

LED's
LED's

Circuit Connections


The circuit connections are very easy to understand. Here the GPIO pins are connected to the anode of the two LEDs. The #GPIO 17 and 27 pins are connected to the two anode pins of the green and red led respectively. The cathode terminal of the diodes is grounded on the breadboard along with the negative terminal of the Raspberrypi board.



Download the codes from here






Working

To start with download the telegram application form the play store, sign in making an account, and search for the #BotFather account. Under this click on start and this will initiate the process of creating the bot. On the left-hand side on can see the control commands from there choose the /newbot to create a new bot and furnish a few details like the name, username for the bot, and done with the bot creation process.


In this article, the working is based on fetching the keywords form the text that had been entered in the application. The next step is to open the newly created bot and start the session. With the program running in the background enter text like turn on/off any specific led and see the output on the led. Let us have a view on the implementation part.


For a better understanding lets understand with the help of images. The first image command to turn on the green led.


GREEN led on command
GREEN led on command

As a response to the command, the green led turns on.

GREEN led glowing
GREEN led glowing

Similarly, the next command would be to turn on the red led.

RED led on command
RED led on command



Responding to the command the red led turns on.


RED led Glowing
RED led Glowing

Turn off all the led command.

All led off command
All led off command

Both the LEDs are turned off.


All leds off
All leds off




Turn on both the LED's command.


All on command
All on command

Both the LEDs are turned ON.

All leds on
All leds on

In the same way, one can design for any other commands also like turn off one led. Turn off green led, or turn off red led and check for the outputs. If having any doubt go through the video configuration, the link is given below.


To sum up, through the article #Controlling Raspberry Pi's GPIOs using the Telegram bot one would learn how to connect the telegram bot in the mobile with the Raspberry Pi's along with how to command the Raspberry Pi's GPIOs and make actions more automated.



 

To learn more of such similar projects visit the links below


Order Electronics Projects


Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607


You can -


  • Order Basic Electronics Projects

  • Order Embedded Systems Projects

  • Order IoT Projects

  • Order FPGA Projects

  • Order VLSI Projects

  • Order Image Processing Projects

  • Order Matlab Projects

  • Order TinkerCAD Projects

  • Order Proteus Projects


Click on the button below to fill out the project inquiry form -





Create Various Projects


Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


Follow us -


Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.




435 views2 comments

2 Comments


Anushka Gupta
Anushka Gupta
Jul 27, 2023

This blog from Learn Electronics India deserves all the praise. The in-depth coverage of both Telegram and Raspberry Pi aspects was outstanding. I now feel confident enough to embark on my own Telegram-controlled electronics projects. Grateful for this invaluable resource.

Like

ashitanarvekar2002
Jul 21, 2023

Short and effective! LearnElectronics India never disappoints.

Like
bottom of page