Arduino Whatsapp Messages - Send Whatsapp Messages Using Pi or Arduino

by AsimZ in Circuits > Arduino

15507 Views, 7 Favorites, 0 Comments

Arduino Whatsapp Messages - Send Whatsapp Messages Using Pi or Arduino

Arduino Whatsapp Messages - Send Whatsapp Messages using Pi or Arduino

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.

originally posted at https://highvoltages.co/tutorial/arduino-tutorial/arduino-whatsapp-messages-send-whatsapp-messages-using-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 GSM module.

NOTE: You can use this method for Arduino, raspberry pi or you can use it simply with python on any platform.

Setup 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,

  1. Go to www.twilio.com .
  2. Sign up for an account.
  3. Verify your number.
  4. Then navigate to SMS chatbot.
  5. Give your project a name.
  6. 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.
  7. Go to WhatsApp.
  8. Activate sandbox by going into the sandbox.
  9. Then you will be given a WhatsApp number and a code, you will have to send SMS with that code to the number.
  10. 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 = 'AC1d8ea8f74325f727ccbd85a78e20e23a'

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)

Arduino Connection

cct.gif

Make Arduino connection and upload the following code,

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); }

Video Tutorial

Follow Us on Social Media