Hello and Welcome to High Voltages.
This Video is going to be interesting. In
this video, I will be telling you how to send
Arduino alerts using WhatsApp.
I will also be telling you how to send WhatsApp
messages using Python from windows or raspberry
pi or any Mac laptop.
So before starting please subscribe my channel
and press the bell icon so you will never
miss a video update from my channel.
Let's get started...
The first thing you have
to do is go to www.twilio.com and sign up
for a new account. You will have to enter your
details,
and then press get started.
then you will have to verify your number.
enter your number, press verify and then you
will get verification code, enter that code.
press submit then this window will be
opened click SMS chatbot.
then give your project
a name and press continue.
Skip this for now.
This will open a flow
like this but as we are using API. we do not
need that. Click on programmable SMS and then go
to WhatsApp.
Activate your sandbox by going into sandbox,
To add your number you will have to send WhatsApp
message to this number containing this code.
you can see the mobile screen on the right
side of the window, you will get a different
code so you will have to use that code.
You will get a message on WhatsApp and your
number will be updated on Twilio website,
you can see that by refreshing the browser,
Then you will have to go in the console and
you will have to copy your Account SID and
auth token as you will be needing this in
python code.
OK, we are here in python compiler (PYCHARM)
and the first thing you will have to do is
to install Twilio library you can do that
by writing pip install Twilio in a terminal.
I already have that library, so it says requirement
already satisfied, This is a simple code that
will help us to send WhatsApp message using
Twilio.
Then you will have to paste your Account SID
and auth token that you have copied earlier.
Then you can run the program and you can see
that we get a message from same number(on
which we have messaged the code).
Now we can modify the code to get values from
Arduino and send a message then.
We will be using LM35 temperature sensor for
this example.
so make the connection as shown in the circuit
diagram.
Now we are in Arduino IDE, Lets write code,
we start by declaring variables and after
that in setup body we define baud rate, in
the loop body, first of all, we read the analog
value,and then we convert that analog value
to millivolt and then we wrote a formula to
convert that millivolt into Celsius and then
we simply print the temperature value, Lets
upload the code and you will start receiving
temperature values in serial monitor.
Let's modify our Arduino code if temperature
will rise above 22-degree centigrade it will
send temperature value serially to the python
script so we can send message of alert! we
are back to python IDLE, to make connection
with Arduino serially the first thing we have
to do is to install pyserial library and for
that, you can write pip install pyserial in
terminal . I already have that library so
it says requirement already satisfied.
Then we will update our code for serial communication
the first thing you have to do is to import
library and after that, you will have to make
serial object and in that, you will have to
define the COM port and baud rate.
please make sure that you have defined the
correct baud rate and correct COM port.
You may have a different COM port.
Now let's update our code, we will change
two things, the first thing we will add is
a line that will read data serially and the
second thing we will change the text of message
you can get the code from description.
Now we will run the program and you can see
the results on mobile screen shown on the
right side of window .
So this is it!
Thank you for watching.
please LIKE, SHARE and SUBSCRIBE.
so I can make more videos for you.
