Another Bolt iot and arduino project
A simple homemade project after completing my course with bolt iot
Intruder alert using a ultrasound sensor
Its system that alerts the user if an intruder tries breach his/her home. The device is placed near the door, while you are going out you should power on the device using a switch, which can be present outside and only known to you or your family members. when an intruder open the door, this motion is determined by HC SR04 ultrosonic distance sensor. With the help of Bolt Iot and arduino the buzzer is made on and alert message is sent to users. Bolt Wi-Fi module communicates with arduino through serial communication. So now the user can complain to local police and necessary bodies
SETTING UP BOLT CLOUDAn IoT system requires a hardware as well as a cloud. We looked at Hardware i.e. the Bolt WiFi module in the previous section. In this section we shall learn about the Bolt cloud.
Bolt cloud is a server which lets you communicate with your Bolt WiFi module over the internet. It offers features like receiving and storing the data collected by Bolt Modules, Storing the data, Analysing it via Data visualisation and Machine Learning as well as it lets your program your Bolt modules. We shall learn about each of these features and how to use them more in detail in the workshop. However, before we get started, let us create an account on Bolt cloud. Follow the steps below:
Registration Process- Step 1: Open www.cloud.boltiot.com on your web browser (Google Chrome recommended)
- Step 2: Click on "SignUp” as shown below
Step 3: Enter your details in the SignUp page shown below. Enter your name, email id (login ID for Bolt cloud), and password in the fields. Do confirm your password by typing it again in the Confirm Password field and then click on the Register button.
Step 4: Verification of your account: If you have entered all the details correctly, you will be successfully registered on Bolt Cloud and you shall see the screen below.
You will be sent a Verification Mail to your mail Id as seen below (Please check your Spam folder if the mail is not found in your Inbox.
Note: If you did not get the Verification mail you can go to cloud.boltiot.com and SignIn and Click on the Resend Email option marked below.
Open the mail and click on the “Click here to verify your E-mail ID” button as shown below.📷
Once you click on the button, your email id will be verified and you will be directed to the following page thus completing the registration process on Bolt Cloud.
- Step 5: You will be redirected to your Bolt Cloud Dashboard, with the Welcome message greeting, where you can click on the Getting Started button to view the guide.
- Step 6: You will be given a basic tour of the Bolt Cloud features on the Dashboard. You can click on the Next & Back button to view the features. You can click the Skip button to skip the tour if you wish to. The tour can be taken anytime by clicking the “Take a Tour” button at the top right corner on your dashboard.
- Step 7: Once the tour is done you shall have the option to add a Bolt device to you dashboard. The process of linking your Bolt device to your Cloud Dashboard will be covered in the next lesson.
Step 1: Search for Bolt IoT in Google PlayStore or Apple AppStore depending on your phone’s OS such as Android or iOS and install the app.
Step 2: Open the app, and enter the email id and password to login to your Bolt Cloud account. Once done, click on the GO button to login.
Step 3: Since you do not have any Bolt devices linked to your Cloud account, you will find the “NO DEVICES CONFIGURED” message on the screen after login. To start the Bolt device setup process, click on the "ADD DEVICE" button which as seen in the screen below
Step 4: The next few screens will guide you with the setup process. First, power on your Bolt Module provided in the kit, using a micro USB type android charging cable. Next, once the Device is powered ON the Blue LED on the ESP8266 Chip will start blinking steadily. When this happens click "READY" button shown in the right most Image below. You can swipe left to get there.
Step 5: At this point the App will Ask you to Turn On your device Location/GPS setting and also to Turn Off your Mobile Data.
Step 6: Once the location is turned ON, the mobile phone will automatically connect to the Bolt Module's Hotspot. This can be verified by checking that LED's blinking rate on the ESP8266 Chip will be faster. At this point the app may tell you to switch of your mobile data if it is On as seen below.
Step 7: Once you have turned Off your Mobile data and your Bolt device is shown in the App as below you can click on "CONTINUE".
Step 8: Next you have to connect the Bolt device to a local Wi-Fi Network which will be displayed by the app for you to select from. Make sure that the Wi-Fi does not have further verification code requirements except the password. Ensure that the Wi-Fi operates at 2.4 GHz and Not 5 GHz. Ensure there are no ASCII characters beyond the allowed range of 0-127 in your SSID or PASSWORD.
Step 9: Enter the correct password for the Wi-Fi selected from the previous screen. You can click on the "eye" symbol to view and verify it. Click Connect once you enter the password. The bolt will restart and connect to the Wi-Fi chosen in step 8. You can verify this by checking that the BLUE LED on the ESP8266 chip becomes stable. You can also verify that the Bolt device is successfully connected to Bolt Cloud by checking if the Cloud LED has come ON.
Step 10: On clicking connect the Next steps will link the Bolt to your account. Click on "SAVE" to link the Device to your account. Finally click on Done and it will take you back to your Home page.
📷📷
Step 11: Verification: You can see that the device now shows in App's home page.The Green / Red dot next to the device name indicates the device status. Green indicates that the device is has a valid connection to Bolt cloud and can be controlled or monitored remotely. Red indicates that the device is currently offline or powered OFF.
Step 12: Now login to your cloud account on your laptop/PC. You should now have the new device added to your dashboard as seen below.
SETTING UP TWILIO ACCOUNTTwilio is a third-party SMS functionality provider. It is a cloud communications platform as a service (PaaS) company. Twilio allows software developers to programmatically make and receive phone calls and also send and receive text messages using its web service APIs.
Step 1 - Open TwilioOpen www.twilio.com on your browser. Click on the “Sign up” button to go to the Signup page.
Fill in the sign up form with your details. You will need to enter your first and last name, email ID and a 14 digit password.
Read and accept the checkbox for Terms of Service and Privacy policy of Twilio and then click on “Start your free trial”.
To start using Twilio’s services, you will need to verify your email address and your mobile number.
You will need to verify your email address first. Twilio will have sent an email to your inbox with a link to verify your email address. Read the email and follow the instructions given in the email to verify your email address.
Once you have verified your email address, you will then need to verify your mobile number. For this, in the next screen, enter your 10-digit mobile number and click on “Verify”. They will send an OTP to this number for verification.
Once you have received the OTP code on your mobile number, enter it on the screen and click on “Submit”.
Now, your account has been verified and you are now one step closer to sending SMSs via Twilio. Now, Twilio will onboard you once your mobile number has been verified.
Step 4 - Onboarding processFor the onboarding process, you will be asked a few questions on what you plan to do with the Twilio account. Since we will be using the Twilio account to send SMSs via Python code, we will choose the options accordingly.
Firstly, choose the option “Yes” when asked if you write code. Since we will be writing code to send SMS, this is applicable for us.
Now, in the next screen, click on Python as we will be writing the code in Python to send the SMS.
Choose the option “Use Twilio in a project” when asked for the question “What is your goal today?”
Select “Send or receive a SMS” when asked, “What do you want to do first?”
When you click on this option, you will then be redirected to the Twilio dashboard.
Step 5 - Get credentialsNow the onboarding process is completed, we now need to get the credentials for sending the SMS in our python code.
On the dashboard, search for the button “Get a trial number” and click on it. This should be highlighted for you if you have just completed the onboarding process. We need a trial number in order to send an SMS from Twilio.
When you click on the button, it will open a popup asking you to choose a number. Once you have finalised the number, click on “Choose this number”.
Now, we have all the credentials required to send an SMS via Twilio. On the dashboard, as highlighted in the picture below, you will need three items.
Your trial number is the “from number” you will be receiving the SMS from.
Your account SID and Auth token are highlighted. In order to view the Auth token, you may need to click on the “Show” button next to it.
SETTING UP VIRTUAL BOX AND UBUNTUPlease follow the steps shown in the video below to install the Ubuntu virtual machine on your local Desktop/Laptop.Also, note that the OS which the computer is running on will NOT be affected in any way.
Minimum SpecificationsFor installing a virtual machine on your Desktop/Laptop, it should meet the minimum specifications mentioned below,
- OS - Windows 7 or Windows 10
- CPU - Dual Core 2Ghz
- RAM - 4GB
- HDD - Should have at least 10GB free space
- High-Speed Internet Access
The installation steps are mentioned in brief as below,
- Download VirtualBox.
- Install VirtualBox.
- Download Ubuntu Server image.
- Install Ubuntu Server image on VirtualBox.
Do note that the setup requires high-speed Internet access.
Watch the below video for more info
The link to the softwares is given below:
VirtualBox - https://www.virtualbox.org/wiki/Downloads
Ubuntu Server ISO link - http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-i386.iso
SETTING UP BOLT LIBRARYBefore you proceed to this step, first ssh(login) to your Ubuntu server and follow the below steps to use Bolt Python library in your code.
Step 1: Update the packages on Ubuntu
Execute the command below so that the packages on Ubuntu are updated to the latest version. If you skip this step, you may encounter an error while installing the Boltiot package.
sudo apt-get -y update
Step 2: Install python3 pip3
pip3 is a package manager for python3 used to install and manage packages and python libraries. It is system independent.
Install pip3 using the following command,
sudo apt install python3-pip
Step 3: Installing boltiot library using pip
Now we will install the boltiot python library on your Ubuntu server.
Type the below command in terminal to install boltiot python library.
sudo pip3 install boltiot
Now we are done with boltiot python library installation. In the next section, we will learn how to use the Bolt python library to check the device status and switch off the device.
TroubleshootingNote - If you are getting Python locale error: unsupported locale setting then run the following commands
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales
After typing the above command, a pop up will open. Select All locales and click enter.
And then another pop will open. Select en_US.UTF-8 and then press enter.
Note: The above settings will stop working after closing the current session.
SETTING UP ARDUINOPlease visit the following website for all details on setting up arduino and arduino ide
https://www.arduino.cc/en/Guide
Visit this website to set up bolt with Arduino
https://docs.boltiot.com/docs/arduino-library
WORKINGThe working principle is very simple. the Arduino continuously check for Serial command received from Bolt. if the command string ON it performs the corresponding functions.
When it receives ON if everything is right it performs analogWrite command. it checks the range of distance from ultrasonic sensor is in limit. if it is less than the limit the led and buzzer will be ON.
HARDWARE SETUPthe HC-SR04 Ultrasonic Sensor is at the center of the vehicle. The distance can be taken and alerts when it reaches below the safe distance.
1. Gather all the components and check if led and Ultrasonic sensor are working fine or not.
2. Connect the cathode of led to GND & anode to 13 pin of Arduino.
3. Connect the small pin of buzzer to GND & other pin to 11 pin of Arduino.
4. Connect the Ultrasonic Sensor pins VCC, GND, Trigpin, Echopin to 5V, GND, 9, 10 respectively to Arduino.
5. Connect the Tx and Rx of the Bolt to the Rx and Tx of Arduino respectively.
6. Finally, connect 5V pin of Bolt to GND of Arduino and GND of Bolt to GND of Arduino.
NOTE:Refer to the Schematics of any guidance
SOME LINKS TO HELP YOU WITH UBUNTU ARDUINO AND PYTHON
Comments