How to setup from scratch an IoT device under $100 that sends SMS to users

In a recent demo for the VoIP User Conference, John Senay showed an Electric Imp smart device that connects via WiFi to the Internet and sends programmable event triggers to an associated agent in the cloud to Restcomm. The cloud hosted agent for the device is then scripted to execute further intelligent tasks.

The IMP device costs under $100 and is a prime representative of a new generation of affordable IoT devices that are taking over the world faster than Big Data is. IoT devices can be now seen in flying self made drones, home appliances, cars, health monitoring gadgets and even clothes.

In this blog post we will walk through the steps of John’s demo. After reading the article you will be able to build your own IoT device and program it to communicate intelligently with humans.

IoT growth chart

The IMP has a total of eleven pins, with six pins available for GPIO, to provide I2C, SPI and UART signaling.  John Senay showed the actual IDE with its three parts, one frame showed the code run on the IMP card, one frame showed the code for the agent, running in the Electric Cloud and one frame showing the live device log.

Use case:

  • Electric Imp device is connected to a local Wi-Fi network
  • The Imp observes a state change on the switch ( On or Off )
  • The Imp sends a command to the Agent in the Electric Cloud
  • The agent sends a RESTful command  to a Restcomm instance on the Amazon Web Service Cloud
  • Restcomm sends an SMS to specified phone number

diagram

Technical skills required:

  • Knowledge of Restcomm
  • Knowledge of JavaScript
  • Basic electrical engineering knowledge

IoT parts needed:

Step 1 – Setting up the Hardware

  • To get started with the Electric Imp please follow the User Guide and Getting started docsHERE
  • Now let’s build the smart button gadget by following the steps HERE
  • See the complete wired setup on the image below:

 setup

Step 2 – Creating RVD application

  • Go to Restcomm Admin UI
  • Create Voice Application and bound it to registered DID
  • Drag and drop SMS. Enter the message you want Restcomm to send to a specified number in the text are. In our case we will type: “Hello from my agent!, the Cat is out the door!!”.
  • In “To” section specify the phone number to which SMS will be sent
  • In “From” type the DID that is already bound to the application. We are using “12025520044”.
  • Once you are done Save the application

ElectricImpSMS

 

Step 3 – Setting up the Electric Imp Device

  • First we need to setup the example code
  • You are now ready to start writing code for your imp.
  • Once your imp is connected to your WiFi, go to the IDE page
  • Commission your imp as described by the imp team.
    You will notice that the Electric Imp IDE has 3 collapsible windows: Agent, Device, and Logs. Logs provides all the collected and printed information from your device and code, this is an invaluable debugging tool. Agent and Device are where we will be putting our code. The Agent is the server side code, this code runs on Electric Imp’s servers and allows you to execute heavier tasks including HTTP requests. The Device code is the code runs on the physical imp card, an ARM M3 microcontroller, that will be inserted into your device. Electric Imp has created an easy way to pass messages from the device to the agent and vice versa. First we will focus on the Agent code since this is where we will do the communication with Restcomm.
  • Copy the code below into your agent tab in the Electric Imp

 

 

  • Once copied, change where it says FEED_ID_HERE and API_KEY_HERE to your respective Restcomm Acoount  SID and Restcomm Auth Token that you can get from Restcomm Admin UI.
  • Next it is time to setup our device code. This code may need to vary depending on the type of UART device you are trying to interface with. The basic setup provided will work with and FTDI cable or Arduino microcontroller.

 

 

You are now ready to test the device and receive SMS from Restcomm whenever there is a state change.

For more information:

Contact Telestax for help with your IoT and Restcomm projects.