utilizing twilio and thingspeak api in iot …...utilizing twilio and thingspeak api in iot...

4
Utilizing Twilio and ThingSpeak API in IoT Applications Revolution11 recently developed a solution that allows their clients to send small audio/video and other files in addition to a text message via Twilio. They used an HTTPS request and the Insert From URL script step in FileMaker. With the increasing integration of web services and APIs, solutions like this can be further automated from the integration of embedded sensors. For this project, we needed a device that detected motion and sent a text message notifying us of the motion. Using Revolution11’s Twilio Blog Post as an example, we integrated Twilio and ThingSpeak API’s with a Wi-Fi enabled microcontroller and a Passive Infrared Sensor to detect motion. 11 Revolution Twilio is a cloud communications platform that can send and receive global SMS, MMS, and IP messages from any app, with a simple and powerful API. ThingSpeak is an open data platform and API for the Internet of Things (IoT) that enables you to collect, store, analyze, visualize, and act on data from sensors or actuators, such as Arduino, NodeMCU, Raspberry Pi, and other hardware. For example, with ThingSpeak you can create sensor-logging applications, location-tracking applications, and a social network of things with status updates, so you could have your home thermostat control itself based on your current location. Hardware Summary • NodeMCU ESP-12E. The NodeMCU is an open source IoT platform that uses Lua scripting language as well as the Arduino IDE. • PIR Motion Sensor: Pyroelectric (“Passive”) Infrared Sensor Soſtware Summary For this project, we wrote a sketch, the name the program’s code is written to and uploaded onto Arduino boards. The Arduino Sketch was uploaded onto the NodeMCU which uses Twilio and Thingspeak APIs to send notifications by text message when motion was detected. rapidsystemsengineering.com

Upload: others

Post on 13-Jun-2020

28 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Utilizing Twilio and ThingSpeak API in IoT …...Utilizing Twilio and ThingSpeak API in IoT Applications Revolution11 recently developed a solution that allows their clients to send

Utilizing Twilio and ThingSpeak API in IoT Applications

Revolution11 recently developed a solution that allows their clients to send small audio/video and other files in addition to a text message via Twilio. They used an HTTPS request and the Insert From URL script step in FileMaker. With the increasing integration of web services and APIs, solutions like this can be further automated from the integration of embedded sensors. For this project, we needed a device that detected motion and sent a text message notifying us of the motion. Using Revolution11’s Twilio Blog Post as an example, we integrated Twilio and ThingSpeak API’s with a Wi-Fi enabled microcontroller and a Passive Infrared Sensor to detect motion.

11Revolution

Twilio is a cloud communications platform that can send and receive global SMS, MMS, and IP messages from any app, with a simple and powerful API.

ThingSpeak is an open data platform and API for the Internet of Things (IoT) that enables you to collect, store, analyze, visualize, and act on data from sensors or actuators, such as Arduino, NodeMCU, Raspberry Pi, and other hardware. For example, with ThingSpeak you can create sensor-logging applications, location-tracking applications, and a social network of things with status updates, so you could have your home thermostat control itself based on your current location.

Hardware Summary• NodeMCU ESP-12E. The NodeMCU is an open source IoT platform that uses Lua scripting language as well as the Arduino IDE. • PIR Motion Sensor: Pyroelectric (“Passive”) Infrared Sensor Software SummaryFor this project, we wrote a sketch, the name the program’s code is written to and uploaded onto Arduino boards. The Arduino Sketch was uploaded onto the NodeMCU which uses Twilio and Thingspeak APIs to send notifications by text message when motion was detected.

rapidsystemsengineering.com

Page 2: Utilizing Twilio and ThingSpeak API in IoT …...Utilizing Twilio and ThingSpeak API in IoT Applications Revolution11 recently developed a solution that allows their clients to send

Steps:

1

2

3

Register for a Twilio account (twilio.com) and get your API Credentials. These will include an [AccountSID] and [AuthToken]

Register for a free ThingSpeak (thingspeak.com) account. We will set create HTTP request with the ThingHTTP app. The ThingHTTP app is meant to simplify device communication with web services and APIs and embedded sensors.

• Sign into ThingSpeak • Click Apps• Select ThingHTTP• Click Create New Request• Enter a Name for your new request: Twilio Test• Enter the Twilio Rest API URL: https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages,json• Enter your AccountSid under HTTP Auth Username• Enter your Auth Token under HTTP Auth Password• Select POST method• Enter Content Type: application/x-www-form-urlencoded• Under Body enter the required parameters of From, To, and Url: To=+{phonenumber}&From=+{TwilioVerified_Number}&Body={Message}• Click Save ThingHTTP and you’ll be given an API Key used in the HTTP request

Set up ThingSpeak ThingHTTP Request:

You can now send your ThingHTTP request and view the response using the following URL:

GET https://api.thingspeak.com/apps/thinghttp/send_request?api_key=thisisyourkey

rapidsystemsengineering.com

Page 3: Utilizing Twilio and ThingSpeak API in IoT …...Utilizing Twilio and ThingSpeak API in IoT Applications Revolution11 recently developed a solution that allows their clients to send

The PIR_Twilio (download the Sketch)

rapidsystemsengineering.com

Page 4: Utilizing Twilio and ThingSpeak API in IoT …...Utilizing Twilio and ThingSpeak API in IoT Applications Revolution11 recently developed a solution that allows their clients to send

1.707.515.0807 • [email protected] Questions?

The Hardware:

When a motion is detected a text message is sent!

NodeMCU ESP-12E

PIR Motion Sensor

rapidsystemsengineering.com