How to send text messages with an arduino?

PREPARING THE HARDWARE

For this project, we are going to interface a PIR motion sensor with Arduino UNO then transfer the digital signal to the ESP8266 module. A PIR sensor, also known as Passive Infrared Proximity Sensor, is a digital sensor that gives off a HIGH pulse when it detects motion. The ESP8266 module is configured to send a GET request to IFTTT when the signal is HIGH. The GET request triggers the applet, which then sends an SMS to your device.

In order to do that, we need the following components:

  • Arduino Uno
  • ESP8266-01 WiFi module
  • PIR motion sensor
  • 3 x 1 kΩ resistor
  • 1 x 10 kΩ resistor
  • Jumper wires
  • Breadboard
Figure 2: Connections

If you want to learn more about the Arduino, check out our Ultimate Guide to the Arduino video course. You’ll learn basic to advanced Arduino programming and circuit building techniques that will prepare you to build any project.

SETTING UP IFTTT

First, go to the IFTTT website and create an account.

Once logged in, go to the top right toolbar on your homepage and select create. Logging in will direct you to a page where you can start creating an Applet.

How to Send an Email With ESP8266 and IFTTT - Creating Account
Figure 3: Creating an Applet

Then, set a condition by clicking “+ This”.

Next, search for “webhooks”.

Under webhooks, choose to receive a web request. Click create trigger after naming your event.

Now to set the action, click “+ That”.

This time we search for SMS. Unfortunately, IFTTT discontinued support for direct SMS using webhooks. Right now, the only way we could make this work is by installing the IFTTT app on an android device or using a ClickSend account. In this tutorial, we are using the former.

Figure 8: SMS

Lastly, write the content of the SMS. There are convenient variables you can use to compose your message: EventName which contains the name of the event; OccurredAt which displays the date and time when the event is triggered, and; Value that can include any number you want to send to the IFTTT server.

Figure 9: Writing the SMS

Check whether you have put the correct details.

Figure 10: Review and Finish

The applet is now ready. Now to enable your android device for the SMS notifications, search IFTTT in Google Playstore and install.

Figure 11: Installing IFTTT

After installing, log in with your IFTTT credentials to pair with your account.

ACQUIRING THE KEY

To trigger the Applet recipe, we need the key along with the event name on our HTTP request. To obtain your unique IFTTT key, go to the homepage and search for webhooks on the top-left search bar. You can find webhooks under services.

Figure 12: Checking documentation

Now on the webhooks page, click the Documentation link at the top-right corner of the page.

Finally, a page that contains your personal key, and the complete web request for your event appears. This key is unique to every IFTTT account. By including the event name with it, you can trigger an IFTTT action via webhooks. Now let’s proceed with our code.

Figure 13: Acquiring the key