Sorry, you need to enable JavaScript to visit this website.

You are here

Use SMS to control your IoT device

In this blog, we look at how to use SMS commands from the Telstra Messaging API to control your IoT device remotely. 

 

Three elements that make up the IoT ecosystem

Developing with the Internet of Things is fun. It’s challenging. It’s frustrating at times. But it’s also an opportunity to change the world with code. And you don’t need five years R&D experience or an engineering degree to do it. In this blog, I’ll go through some quick weekend hackathon projects you can put together to bring your IoT idea to life.

Consider that the Internet of Things is made up of 3 key elements:

  • devices
  • network
  • applications

The importance of network connectivity 

Network connectivity is a critical element of the IoT ecosystem, enabling you to send sensor data reliably and efficiently between devices and applications. Then there’s the messaging alerts for real-time emergency notifications and communication that the network can also provide.

Here’s a couple of projects that harness TelstraDev’s network capabilities for IoT prototypes that address some key local and global issues. If you want to see more detail on each one, check out the GitHub repos.

How to control your IoT device with SMS and the Telstra Messaging API

Some IoT devices can actuate (i.e action on received data) based on specific inputs. For example, streetlights that turn on depending on the time of day, or when someone walks past and triggers a people counter.

In this quick prototype, I set up an Arduino MKR NB 1500 with Telstra LTE-M connectivity, so that when I send “ON” in a text message to my virtual mobile number, it turns the LED on the Arduino board on. Sending “OFF” in an SMS turns it off.

The fun part, was that I also had the virtual mobile number that controlled my mate Steve’s Arduino device, so we could send messages across Australia to control each other’s IoT device lights. Awesome potential here, but also very real security and control considerations.

We used Node-RED, a programming tool for wiring together hardware devices, APIs and online services. It was quick and easy to set up the Watson IoT and Messaging API nodes, and you can copy the whole flow directly from our GitHub repo. Just add in your own user credentials.

In Node-RED, we set up a http endpoint (we call that a NotifyURL) that any SMS can come to. Using Telstra Messaging API, we then created a virtual mobile number (called a Subscription in Messaging V2) that can receive SMS. Now the Node-RED http endpoint can show any inbound messages to the your new Virtual Number.

Any SMS command from your Telstra Mobile (connected to 4G or 5G) to that Virtual Number, where a function in Node-RED validates the message payload input and decides if it should trigger 1 of 3 possible device events:

  1. light ON if it sees "ON"
  2. light OFF if it sees "OFF"
  3. or do nothing if you send anything else

The message to change the state of the LED is published to your IoT broker, where the Arduino is listening. The sketch running on your Arduino knows what to do when it sees ON or OFF, and voila!

For more details, see the GitHub ReadMe or recorded tutorial of this prototype, which includes an introduction to IoT brokers and the open source low-code software we used to put this together in just a few hours.

GitHub Repo + ReadMe: https://github.com/MichelleHowie/TelstraDevArduinoNodeRedBlink

Telstra Messaging API Free Trial

This demo uses Telstra’s Messaging API. You can explore your own SMS and MMS use cases with our Messaing API free trial today.

Check out part 2 of this series to learn how to request Environmental Sensor Data via SMS from your remote IoT device.

Related Blogs

anonymous's picture

By Michelle Howie

20/12/21

  • Telstra Messaging API
  • REST API

Good APIs start with the docs

With our new docs experience, it's easier than ever to get started with Telstra APIs. ...
anonymous's picture

By Daniel Simpson

17/12/21

  • azure
  • microsoft

A code-first approach to digital twins

Find out how to use code-first digital twins with the Telstra Digital Twins library.   ...
anonymous's picture

By Michelle Howie

25/10/21

  • iot
  • arduino

AgTech and sustainable agribusiness

Our GovHack 2021 challege explored how AgTech can improve sustainable agribusiness.  ...
anonymous's picture

By Quinn Tran

25/9/21

  • iot
  • microsoft

Creative projects with Microsoft Azure

Get your creative juices flowing with the latest in computer vision innovation.   ...
anonymous's picture

By Michelle Howie

15/7/21

  • arduino
  • iot

Trigger an SMS alert when a device is dropped

Learn how Arduino can be used to trigger an SMS alert when a device has been dropped.  Autom...
anonymous's picture

By Michelle Howie

15/7/21

  • arduino
  • iot

Get environmental sensor data via SMS

Learn how to set up on-demand SMS updates for your IoT devices.  Potential use cases If y...
anonymous's picture

By Michelle Howie

2/7/21

  • iot
  • arduino

Changes to our IoT Developer Kit offer

The IoT Marketplace and Developer Kit trial were retired in July 2021.    Where we...
anonymous's picture

By Tim McMahon

2/6/21

  • Telstra Messaging API
  • bushfire

Air quality SMS alerts during bushfire season

I woke up one morning in January 2020 to discover that the air quality in Melbourne had dropped...
anonymous's picture

By Alan Quayle

18/5/21

  • iot
  • REST API

Unlocking the IoT: Telstra Track and Monitor API

As Australia’s longest serving telco, Telstra is expanding their developer program to provide...
anonymous's picture

By Sri Amirthalingam

31/3/21

  • iot
  • regional

Your regional mobile coverage questions answered

When developing an IoT solution for your business, coverage and access to a reliable network is crit...
anonymous's picture

By Michelle Howie

23/12/20

  • TDev
  • documentation

TelstraDev End of Year Wrap: 2020

We made it! Welcome to the end of 2020, may it soon be just a distant memory. Though it wasn’t...
iot home garden project with arduino and azure
anonymous's picture

By keith coutlemanis

10/11/20

  • arduino
  • azure

Azure IoT garden project with Arduino

In this blog, I'll showcase some of the interesting things you can do with the Internet of Thing...