Sending an SMS with Temboo



Similar documents
Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 5. The Serial Monitor

Arduino Lesson 1. Blink

Arduino Lesson 17. Sending Movement Detector

Arduino Lesson 16. Stepper Motors

Set up and Blink - Simulink with Arduino

A REST API for Arduino & the CC3000 WiFi Chip

Setup Guide for PrestaShop and BlueSnap

Arduino Lesson 4. Eight LEDs and a Shift Register

Arduino Lesson 14. Servo Motors

Arduino Lesson 9. Sensing Light

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

Google Trusted Stores Setup in Magento

Wireless Security Camera with the Arduino Yun

InsideView Lead Enrich Setup Guide for Marketo

Authorize.net for WordPress

Step 1: Download and install the CudaSign for Salesforce app

Authorize.net for WordPress

Using Microsoft Visual Studio API Reference

QuickBooks Mac 2014 Getting Started Guide

DS1307 Real Time Clock Breakout Board Kit

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter)

IBM/Softlayer Object Storage for Offsite Backup

Using the Push Notifications Extension Part 1: Certificates and Setup

Practice Fusion API Client Installation Guide for Windows

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

BUSINESS ONLINE BANKING QUICK GUIDE For Company System Administrators

Look in the top right of the screen and located the "Create an Account" button.

Internet of Things with the Arduino Yún

Kony MobileFabric Messaging. Demo App QuickStart Guide. (Building a Sample Application

Customer Portal User Guide: Transition to Delegation

Snow Active Directory Discovery

Arduino project. Arduino board. Serial transmission

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

Installation Guide and Machine Setup

Online Statements. About this guide. Important information

Getting Started Guide: Transaction Download for QuickBooks Windows. Information You ll Need to Get Started

2.2" TFT Display. Created by Ladyada. Last updated on :15:09 PM EDT

KM Metering Inc. EKM Dash User Manual. EKM Metering Inc. (831)

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

EasyPush Push Notifications Extension for ios

Your Mission: Use F-Response Cloud Connector to access Google Apps for Business Drive Cloud Storage

INSTALLATION GUIDE. Installing PhoneBurner for Salesforce. PhoneBurner for Salesforce

Using the Jive for ios App

DocuSign Connect for Salesforce Guide

DESKTOP CLIENT CONFIGURATION GUIDE BUSINESS

Business Mobile Banking Features

High Impact & Alpha Five: A Mail Merge Guide.

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

QuickBooks Online Getting Started Guide for Financial Institutions. Financial Institution Support OFX Connectivity Group

Basic Pulse Width Modulation

New Participant Digital Certificate Enrollment Procedure

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

PDF Bookmarks Help Page: When clicking on a Bookmark and Nothing Happens (or sometimes 'File Not Found' Error)

How to Integrate Salesforce with Your Constant Contact Account FOR ENTERPRISE & UNLIMITED EDITIONS

Zoho CRM and Google Apps Synchronization

Setup Guide for Magento and BlueSnap

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

USER GUIDE for Salesforce

Connecting Arduino to Processing a

Getting Started. Getting Started with Time Warner Cable Business Class. Voice Manager. A Guide for Administrators and Users

UCO_SECURE Wireless Connection Guide: Windows 8

C4DI Arduino tutorial 4 Things beginning with the letter i

LiveText for Salesforce Quick Start Guide

ATTENTION: End users should take note that Main Line Health has not verified within a Citrix

Arduino Internet Connectivity: Maintenance Manual Julian Ryan Draft No. 7 April 24, 2015

Creating an itunes App Store account without a credit card

Lizard Standalone Mode Guide Version 1.0:

Introduction Download and Install Mobile Application About Logging In Springboard Navigation List Pages...

Salesforce Opportunities Portlet Documentation v2

Access and Login. Single Sign On Reference. Signoff

Call Center Configuration Quick Reference Guide

ISVforce Guide. Version 35.0, Winter

GadgetTrak Mobile Security Android & BlackBerry Installation & Operation Manual

Internet Access: Wireless WVU.Encrypted Network Connecting a Windows 7 Device

Using ELMS with TurningPoint Cloud

Google Sites: Creating, editing, and sharing a site

Dartmouth College Technical Support Document for Kronos PC version

System Overview and Terms

Microsoft Visual Studio 2010 Instructions For C Programs

How To Use Freedomvoice On A Cell Phone Or Landline Phone On A Pc Or Mac Or Ipad Or Ipa Or Ipo Or Ipod Or Ipode Or Ipro Or Ipor Or Ipore Or Ipoe Or Ipob Or

CAN-Bus Shield Hookup Guide

As your financial institution completes its system conversion, you

How To Install The Snow Active Directory Discovery Service On Windows (Windows) (Windows 7) (Powerbook) (For Windows) (Amd64) (Apple) (Macintosh) (Netbook) And (Windows

Basic Software Setup Guide.

Installing OGDI DataLab version 5 on Azure

The Social Accelerator Setup Guide

Table of Contents. 1. Content Approval...1 EVALUATION COPY

How to connect to NAU s WPA2 Enterprise implementation in a Residence Hall:

Aspect WordPress Theme

How do I Install and Configure MS Remote Desktop for the Haas Terminal Server on my Mac?

WA2087 Programming Java SOAP and REST Web Services - WebSphere 8.0 / RAD 8.0. Student Labs. Web Age Solutions Inc.

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Egnyte Single Sign-On (SSO) Installation for OneLogin

Live Agent for Support Agents

Tiny Arduino Music Visualizer

Transcription:

Sending an SMS with Temboo Created by Vaughn Shinall Last updated on 2015-01-21 01:15:14 PM EST

Guide Contents Guide Contents Overview Get Set Up Generate Your Sketch Upload and Run Push to Send Wiring Your Circuit Adding Code 2 3 4 11 15 17 18 19 Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 2 of 21

Overview This guide will show you the basic framework for programming your Arduino to interact with APIs using the Temboo platform. We'll focus on sending an SMS with Twilio here, but the same basic steps will work for any of the different processes in the Temboo library. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 3 of 21

Get Set Up To build this example project, you'll be using an internet-connected Arduino board that will send a text message. We've chosen to use: An Arduino Uno R3 Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 4 of 21

An Adafruit CC3000 WiFi Shield Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 5 of 21

A USB A - B cable Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 6 of 21

A push button Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 7 of 21

A 10k Ω resistor Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 8 of 21

A half-size breadboard Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 9 of 21

Some wires You'll also need a Temboo account and a Twilio account. To set up your Temboo account (if you don't already have one) you can create one for free here (http://adafru.it/e53). You can create a free Twilio account here (http://adafru.it/e54). Finally, make sure that you have the latest version of Temboo's Arduino library installed; if you don't, you can download it here (http://adafru.it/e55). Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 10 of 21

Generate Your Sketch Now that you're all set up, log in to Temboo and go to the Twilio > SMSMessages > SendSMS (http://adafru.it/e56) Choreo in the Temboo Library. Turn on IoT Mode and make sure that you've added details about the shield that your Arduino board is using to connect to the internet. You can do this by setting IoT Mode to ON in the upper right-hand corner of the window and then selecting Arduino and Adafruit CC3000 WiFi from the dropdown menus that appear, as shown below: Next, fill out the Input fields using the information from your Twilio account, the text of the SMS that you want to send, and the phone number to which you would like to send it. You'll find your Twilio Account SID and Auth Token by going to Twilio (http://adafru.it/e54) and checking your Dashboard, as shown below; note that you need to use the credentials found on the Dashboard, not the test credentials from the Twilio Dev Tools panel: When using a free Twilio account, you'll need to verify the phone numbers to which messages are being sent by going to Twilio and following the instructions under the Numbers > Verified Caller IDs tab, as shown below. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 11 of 21

Once you've filled out all of the input fields on the Temboo SendSMS Choreo page, test the Choreo from your browser by clicking Run at the bottom of the window. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 12 of 21

If you elected to send the SMS to your own phone number, you should receive it (and if you didn't, whomever you chose will instead). You'll also see a JSON that is returned by Twilio appear under Output, indicating that, among other things, your test executed successfully. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 13 of 21

Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 14 of 21

Upload and Run Now that you've tested the Choreo successfully, you can scroll down to find the Co de section of the page. When you're in IoT Mode and you run a Choreo, Temboo automatically generates code that can be used to make the same API call from an Arduino sketch. Copy the code, and paste it into a new sketch in the Arduino IDE. In order to run this sketch on your Arduino, it needs to be configured with an appropriate TembooAccount.h header file that contains your Temboo account information and internet shield setup information. To create the header file, make a new tab in the Arduino IDE, and name it TembooAccount.h. On the Twilio SendSMS Choreo page beneath the sketch code that you previously copied and pasted into the Arduino IDE, you ll find another block of generated code containing #define statements and details about your internet shield. This is your header file. Copy the contents of the header into the TembooAccount.h tab in your Arduino IDE. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 15 of 21

With both files in place, you are ready to start sending SMS from your Arduino. Save and upload the sketch, open the serial monitor, and watch the texts roll in! Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 16 of 21

Push to Send Of course, a device that just sends off messages with no prompting may not be of much use, so let's add a button to the Uno that will trigger an SMS when pushed. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 17 of 21

Wiring Your Circuit The circuit for the push button is fairly straightforward connect one of the button's legs to the 5 volt power supply, and the other to one of the digital pins on your WiFi shield. In our diagram, we've chosen pin 8. Then, connect that same leg that is wired to pin 8 to ground through a pull down resistor. When the button in this circuit is pressed, pin 8 will be connected to power, and will read HIGH. When the button is left open, pin 8 is connected to ground, and will read LOW. Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 18 of 21

Adding Code You've already generated all of the code you need to send an SMS through Twilio using your Arduino, so you only need to add a couple of extra lines to your sketch to trigger those messages with your push button. First, initialize the pin that you will be reading (recall that we chose to use pin 8) by adding the following lines of code to what you already have in void setup(): // Initialize pin pinmode(8, INPUT); Your setup should now look something like this: void setup() { Serial.begin(9600); // For debugging, wait until the serial console is connected. delay(4000); while(!serial); status_t wifistatus = STATUS_DISCONNECTED; while (wifistatus!= STATUS_CONNECTED) { Serial.print("WiFi:"); if (cc3k.begin()) { if (cc3k.connecttoap(wifi_ssid, WPA_PASSWORD, WLAN_SEC_WPA2)) { wifistatus = cc3k.getstatus(); } } if (wifistatus == STATUS_CONNECTED) { Serial.println("OK"); } else { Serial.println("FAIL"); } delay(5000); } // Initialize pin pinmode(8, INPUT); Serial.println("Setup complete.\n"); } Then, add the following two lines of code to void loop() to set the SendSMS Choreo to run only when the button is pressed: Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 19 of 21

int sensorvalue = digitalread(8); if (sensorvalue == HIGH) { You should nest the code that you already have in void loop() within this new conditional, so that it should now look something like this: void loop() { int sensorvalue = digitalread(8); if (sensorvalue == HIGH) { if (numruns <= maxruns) { Serial.println("Running SendSMS - Run #" + String(numRuns++)); TembooChoreo SendSMSChoreo(client); // Invoke the Temboo client SendSMSChoreo.begin(); // Set Temboo account credentials SendSMSChoreo.setAccountName(TEMBOO_ACCOUNT); SendSMSChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); SendSMSChoreo.setAppKey(TEMBOO_APP_KEY); // Set Choreo inputs String AuthTokenValue = "PLACEHOLDER"; SendSMSChoreo.addInput("AuthToken", AuthTokenValue); String BodyValue = "PLACEHOLDER"; SendSMSChoreo.addInput("Body", BodyValue); String ToValue = "PLACEHOLDER"; SendSMSChoreo.addInput("To", ToValue); String AccountSIDValue = "PLACEHOLDER"; SendSMSChoreo.addInput("AccountSID", AccountSIDValue); String FromValue = "PLACEHOLDER"; SendSMSChoreo.addInput("From", FromValue); // Identify the Choreo to run SendSMSChoreo.setChoreo("/Library/Twilio/SMSMessages/SendSMS"); // Run the Choreo; when results are available, print them to serial SendSMSChoreo.run(); while(sendsmschoreo.available()) { char c = SendSMSChoreo.read(); Serial.print(c); } Adafruit Industries https://learn.adafruit.com/sending-an-sms-with-temboo Page 20 of 21

} SendSMSChoreo.close(); Serial.println("\nWaiting...\n"); delay(30000); // wait 30 seconds between SendSMS calls } } Don't forget to add a curly bracket at the end of void loop() to close out the additional conditional! Note that in the code example above, the Choreo inputs have been replaced with placeholders. The code that you generate on the Temboo website will automatically have these input values filled in, so there's no need to worry about replacing them manually. With that, your sketch is once again ready to go you're free to tinker with it as you wish (for example, you might choose to comment out the 30 second delay at the end if you want to send messages more rapidly), but no further alterations are required. Save it, upload it to your Arduino, open the serial monitor, and push the button to dispatch your SMS! Adafruit Industries Last Updated: 2015-01-21 01:15:15 PM EST Page 21 of 21