Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Use Twilio's Programmable SMS as an interface to your Arduino. The body of the text message hits the sample Node.JS code which sends a Programmable Wireless Command to an Arduino device asking for its current battery level and then returns the results to the original sender.

Notifications You must be signed in to change notification settings

twilio/wireless-commands-arduino-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Send Commands to an Arduino device

Use Twilio's Programmable SMS as an interface to your Arduino. The body of the text message hits the sample Node.JS code which sends a Programmable Wireless Command to an Ardunio device asking for its current battery level and then returns the results to the original sender.

How's it work?

The Command resource enables you to exchange simple machine-to-machine messages with SMS-capable Devices. For example, you could use a Command to tell an idle device to enable its data capabilities and establish an IP session. In this sample, we'll send a message to an Android device asking it to return its battery level.

Commands can be sent and received using the SMS text mode or binary (PDU) mode. Text mode Commands have a maximum length of 100 single-byte characters. Binary mode Commands have a maximum length of 140 bytes. To process a Command when it reaches your Arduino, you will interface with the modem directly. From the perspective of the Arduino, a Command is delivered as a regular SMS message.

Requirements

Setup instructions

Server

  1. Clone or download this repository
  2. Open config.js with your favorite text editor
  3. Update all values with the {{ YOUR_X_HERE }} convention
  4. See table below
  5. Upload code to server

Values to update in config.js

Key Description
accountSid Consider this your account username. It’s used to authenticate - get it here.
authToken Consider this your account password. It’s used to authenticate - get it here.
phoneNumber Used for bidirectional communication with the Arduino device - get one here.
simUniqueName This is the unique name of your SIM resource - get it here.

For the Programmable Wireless SIM

  1. Navigate to the Programmable Wireless SIMs
  2. Select your newly created SIM
  3. Enter the Callback URL that points to the code you uploaded to your server.
  4. Click Save

For the Arduino

  1. Open Arduino IDE
  2. Go to File > Open in the Menu
  3. Navigate to your local copy of the arduino folder from this repository
  4. Select wireless-sms-template.ino
  5. Select your Arduino board under Tools in the Menu
  6. Select the correct Port under Tools in the Menu
  7. Press the Right Arrow Button in Arduino IDE to upload the code
  8. Select Serial Monitor under Tools in the Menu
  9. Send a SMS with the text: battery level
  10. Wait for response

That’s it! Happy Hacking!

Resources

About

Use Twilio's Programmable SMS as an interface to your Arduino. The body of the text message hits the sample Node.JS code which sends a Programmable Wireless Command to an Arduino device asking for its current battery level and then returns the results to the original sender.

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages