We are all locked in our houses in this COVID-19 pandemic situation.When everything will fall into place then also we would all be scared with it.The precaution measures advised by the WHO are to maintain social distancing and to wash hands regularly.To maintain social distancing is a tough task. Hence we have designed a smart bot which will alert if anyone is at a distance less than 1m. Also it will send a message to the telegram bot to alert the person and also will make him aware by buzzing the buzzer and a red light will be on. The distance will also be displayed to create awareness.It will work as a two way device
1) Measure and alert about the distance
2) Check if the social distancing norm is broken and alerts he person smartly
HARDWARE SETUPWe have used Arduino Uno and interfaced it with HC-SR04 ultrasonic sensor. The data from the Arduino is transferred serially to the Bolt Wifi Module.
Further a Buzzer and a LED is connected to the GPIO pin of the IOT module such that it will become HIGH whenever the echo PULSE is High
HC-SR04 Ultrasonic (US) sensor is a 4 pin module, whose pin names are Vcc, Trigger, Echo and Ground respectively. This sensor is a very popular sensor used in many applications where measuring distance or sensing objects are required. The module has two eyes like projects in the front which forms the Ultrasonic transmitter and Receiver. The sensor works with the simple high school formula that
Distance = Speed × Time
The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air and when it gets objected by any material it gets reflected back toward the sensor this reflected wave is observed by the Ultrasonic receiver module as shown in the picture below
Connections:
Ultrasonic Pins:
Vcc = +5V pin of Arduino
GND : GND Pins of Arduino
Echo :Pin 13
Trig : Pin 12
BOLT IOT MODULE :
Pin 1 : Buzzer and LED
Rx - Tx
Tx-Rx (Both of Arduino)
GND = GND of Arduino
VCC = +5 V of Arduino
Working :We have connected both the serial pins of IOT Module and Arduino with each other.Hence the data will be transferred via serial communication. The Ultrasonic Sensor is connected with the Arduino which will measure the distance and transfers it to the bolt Module.Then the code is designed with conditions which will check if the distance is less than 1 m and then will alert it through telegram bot
SOFTWARE SETUP
CONNECTING BOLT TO CLOUD
If you already have an account on the cloud.boltiot.com then skip this step.
To create your new account and link your Bolt device to cloud click here.
HOW TO SETUP TELEGRAM ACCOUNT
Content Credits for this topic -BOLT IOT
Steps to sign-up for/sign-in to Telegram
- Go to the Playstore or App Store on your phone and search for Telegram.
- Download and Install the latest version of Telegram app.
- Signup for a new account or sign in to Telegram by providing your mobile number.
- Telegram will call you OR send you a SMS to verify your mobile number.
- Get your account verified and approve any permissions if required.
- You will be logged in to Telegram and will be shown a screen similar to the one below. (It's okay if it differs from the screenshot below)
- Go to the home screen of the Telegram app.
- Swipe from the left side to reveal the menu.
- Click on "New Channel".
- It will ask you for a Name and Description for your channel. Give a suitable name and description. Adding photo is optional.
- In the next screen set the channel as Public.
- On the same screen, it will ask you to enter a permanent link for your channel. You can use lowercase letters and numbers 0-9 to create the channel link.
- Please note that the channel link name is global and you will be able to create a channel link only if the link name is available. The channel link name is something similar to an email address, i.e. only one unique email ID can exist at one time.
- You can keep the channel link name as temperature_alert_ followed by your email ID. Example, if my email ID is developer@boltiot.com, I can keep the channel link name as temperature_alert_developer_boltiot_com(I have removed the @ and. symbol since it was not allowed and replaced it with an underscore _). This is just a suggestion. You can keep the channel link name as you like as long as it is valid.
- Keep a note of this Channel permanent link name. It will be required later on to send messages to this channel.
- Congratulations! You have created a new channel. You can also view this channel from your app home screen.
- You can click on the channel name at the top to view more details about it.
- Next we will need to create and add a Bot to the channel so that it can post alerts for us in this channel.
Telegram allows us to create a new bot with the help of a bot called as "BotFather". It is a single bot to create and manage other bots.
- On the Home screen of the app, click on the search icon on the top right and type in "botfather".
- In the search results, click on the correct result for "BotFather" as shown below. The correct "BotFather" will have a blue tick mark next to its name. This will take you to a chat window with the "BotFather".
- The chat will have a few items already and will display you a list of commands to get started.
- Since we need to create a new Bot, go ahead and type in "/newbot" in the window.
- It will ask you to type in few more details like Bot name and Bot username.
- When your bot is created successfully, you will be shown a screen similar to the one below and will contain the Bot Token. This token is used to control your Bot as well as send messages on behalf of it. Please keep this token secure as it will allow anyone to access your Bot.
- The telegram_bot_id will be used in the python code to send messages. The python code will be taught in the later lessons.
- Also, please be careful when saving the Bot ID. You may get confused between 0 and O, I and 1 etc. as they are similar looking.
- Congratulations, you have created a new Bot. Now, we will need to add it to the channel we have created previously so that we can send alerts.
- From the App home screen, open the channel we have created earlier.
- In the screen, click on the channel name on the top to open the information for the Channel.
- Click on the Administrators button so that we can add the newly created bot to the channel.
- Search for the bot that we have created using the Bot's username. Once you have found the correct Bot click on it to add it to the channel. Please make sure you have clicked on the Administrators button in the previous step as this will allow our bot to post to the channel.
- You will be asked to confirm the rights for the bot. Press on the tick mark on the top right to continue adding the bot to the channel. Make sure that the bot has the rights to "Post Messages".
- You will now see the newly created Bot in the list of administrators for the channel.
- Now we will code for sending messages to the channel via the Bot.
Output for the telegram BOT
Output for the python terminal
Comments
Please log in or sign up to comment.