Arduino WhatsApp Messages - Send WhatsApp Messages Using Pi

Arduino WhatsApp Messages – Send WhatsApp Messages Using Pi

There was a time when SMS was one of the most powerful communication tools but with the arrival of Android phones and social networks, the trend has changed and people have switched to WhatsApp due to simplicity and the cheap messaging service which helps you send multimedia easily. This tutorial will help you send whatsapp messages using arduino or raspberry pi.

People have been using GSM to send the alert message using Arduino but with the change of trend, we should change our approach too. So, in this instructable, we will be going to discuss how to integrate WhatsApp alert messages using Arduino and it will save the money you would have spent on the GSM module.

NOTE: You can use this method for Arduino, Raspberry Pi or you can use it simply with Python on any platform.

Arduino MFRC522 tutorial – Is RFID tag present or removed?

Set Up Twilio Account

We will be using Twilio API for python to send WhatsApp Alert message. In order to get started with Twilio, you will have to follow the following steps,

  • Go to www.twilio.com.
  • Sign up for an account.
  • Verify your number.
  • Then navigate to SMS chatbot.
  • Give your project a name.
  • A flow chart will be opened, but as we are using Twilio API for python we do not need that instead go to programmable SMS.
  • Go to WhatsApp.
  • Activate sandbox by going into the sandbox.
  • Then you will be given a WhatsApp number and a code, you will have to send SMS with that code to the number.
  • Your number will be added and then you will have to go to the console and copy your Account SID and auth token.

Install Twilio Library and Run Basic Code

Now make sure you have python installed in your laptop or Raspberry Pi. Go to terminal or command prompt and write,

pip install twilio  

then paste your account SID and auth token in code and run the program,

# Download the helper library from  https://www.twilio.com/docs/python/install

from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console

account_sid = 'AC1d8ea8f74323a'

auth_token = 'your_auth_token'

client = Client(account_sid, auth_token)

message = client.messages.create( body='Hello there!',from_='whatsapp:+14155238886', to='whatsapp:+15005550006')

print(message.sid)

Make Arduino Connection and Upload the Following Code

Whatsapp message using Arduino and sending lm35 temperature sensor values.
LM35 with Arduino

The image is for Diecimila but you can use arduino UNO , mega or any other . Connections will be same.

int val;
int tempPin = 0;
  
void setup(){
Serial.begin(9600);
}
  
void loop(){
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;if(cel>=22.00)
    {
    Serial.println(cel);
    }
delay(1000);
}

RASPBERRY PI CODE:

get code from here.

Video Tutorial

Conclusion

This way you can send WhatsApp alert using Arduino, You can use the same code to send it from raspberry pi and for pi, we will not need any serial communication. You can follow me if you are interested in similar projects, also don’t forget to check our youtube channel.

if you need any help in this project you can contact us.

Please Subscribe us on youtube: www.youtube.com/c/highvoltages

Facebook: www.facebook.com/highvoltagestech 

Instagram: www.instagram.com/highvoltagestech

4 thoughts on “Arduino WhatsApp Messages – Send WhatsApp Messages Using Pi”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.