Introduction: GSM IFTTT Button

We've seen Amazon's Dash button and similar ESP8266 powered WiFi buttons that trigger things when pressed.

The downside to these buttons are that they don't work on the go, and are tied to a single network. If you want to take these outside the range of your WiFi network, they don't work.

Alternatively you could use Bluetooth enabled button like the Flic button that connects to a smart phone. However, this relies on being in within Bluetooth range and a powered phone, so it's not always useful in an emergency or in a situation where it's likely to be used by many different people, like in an outdoor installation.

We're going to create a device can trigger IFTTT by itself by sending an SMS to Twilio that then gets parsed by a PHP script that then triggers IFTTT.

This means it works anywhere where there is a phone signal is available and doesn't need to be paired with any device to work!

Step 1: Parts Needed

Adafruit Fona 808 + GSM Antenna

2G Compatible SIM card

Adafruit Huzzah

Pololu Pushbutton Power Switch LV

3.7v LiPo Battery

Momentary Switch

Cables

Breadboard/s

Soldering Iron and bits
Unfortunately the Fona, Huzzah and the Powerswitch headers come unsoldered, so you'll have to solder them yourself. This tutorial on soldering headers onto the Huzzah was super useful, and can be applied to the others.

Code

Step 2: Create an IFTTT Account

Create an IFTTT account at ifttt.com

Connect the Maker Channel (https://ifttt.com/maker) to your account and make note of the key.

We'll come back to IFTTT later to make a recipe.

Step 3: Upload PHP Script

We are going to receive messages from Twilio and trigger IFTTT events using this PHP script.

Change the $IFTTTkey variable to your maker channel key.

You'll then need to upload it your server.

Step 4: Set Up Twilio

Create an Account

Create an account with Twilio. You'll need to create a trial account.

Create Number

Once your signed in, click the 'Get your first Twilio Phone Number' button to get a phone number we can text. Once you've chosen one, go to manage numbers, and click your number to edit it.

Set Messaging URL

Scroll down to where you can change the Messaging request URL and set it to your PHP file. Now when the number receives an SMS message, it will forward it to our PHP script to handle and then call our IFTTT event.

Step 5: Assemble Device

The headers for the FONA, Huzzah and power switch module don't come pre soldered, so you'll have to do that yourself. Adafruit have a useful guide here [a link to a guide] to help you.

This version of the power switch module has awkward pins in the middle, which make placing it on a breadboard difficult. Either solder a header facing up or solder a wire directly onto it. The newer revised version has a more sensible pin layout though.

FONA (GND) -> Powerswitch (top right)

FONA (Bat) -> Powerswitch (bottom right)

Powerswitch (bottom left) -> Huzzah (VBat)

Powerswitch (top left) -> Huzzah (GND)

Powerswitch (top) -> Button

Powerswitch (top right) -> Button

Huzzah (12) -> FONA (TX)

Huzzah (14) -> FONA (RX)

Huzzah (3V) -> FONA (Vio)

Huzzah (13) -> FONA (Key)

The photos show a wire from the Huzzah GND pin to FONA Key pin but use pin 13 instead.

Huzzah (16) -> Powerswitch (left middle)

Plug in battery

Step 6: Program the Device

First of all, you'll need to set up the Huzzah for use with the Arduino IDE, using this tutorial.

Change the 'twilioNumber' variable at the top to your number from Twilio.

Write that to the Huzzah, and when it's done disconnect it from the computer

Step 7: Create an IFTTT Recipe

IFTTT

A good one to try first would be sending an email when pressed.

The remaining battery percent is value1.

Experiment

Try experimenting with different recipes. If you are feeling adventurous, then try adding sensors and other additional inputs, reading and outputting the message into the SMSPayload.

Location

I'll be writing a follow Instructable soon detailing how you can add location values to your events!

Comments

author
Hamids (author)2016-07-05

thanks for sharing such experience , actually I've tried to perform such task but I don't know why the software serial can't communicate with GSM module whereas can easily communicate with other modules serial interface, I've checked with different voltage divider and GPIOs , but no success , I really appreciated for any hint

author
brandonhawkes (author)Hamids2016-07-06

Hello,

Some pins on the ESP8266 can't support software serial, I used 12 & 14 in my tutorial.

Otherwise try making sure you have the latest version of the Arduino IDE and ESP8266 library installed.

Let me know if that helps you!

author
Hamids (author)brandonhawkes2016-07-07

thanks for tips , mine now work with 15 & 13 NodeMCU pin ,

About This Instructable

3,480views

75favorites

License:

Bio: I'm a Creative Technologist at Redweb.
More by brandonhawkes:GSM IFTTT ButtonAdafruit Huzzah 42 Charlieplex LED grid
Add instructable to: