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

You are here

Ask for Environmental Sensor Data via SMS

BY Michelle Howie 15 July 2021

If you have an environmental sensor set up in your home, office, farm etc and want to check the temperature, you don’t want to have to physically go out and do a sensor reading every time. There are already handy dashboards you can connect your device to (like the Arduino Cloud or Telstra IoT Platform), but if you are in a rush you can now ask the device to update you via SMS on demand!

We could potentially set this up to automate updates every hour, minute, week, or when a threshold is exceeded (like in the next example) but this project focuses on on-demand data. 

 

This project follows on from part 1: Control your IoT device remotely with SMS commands where we set up an Arduino board connected to Telstra's NB-IoT network, that flashes it's LED light on or off based on an SMS command.

I tweaked it slightly, to be able to SEND SMS commands as well as receive them, so we can get information off the device with remote sensors.

 

This is the overall flow that handles inbound messages requesting specific sensor info, and used the most up to date sensor readings from our Arduino ENV Shield via an IoT broker to send the response:

Our Arduino device is subscribed to an IoT broker that updates the latest sensor reading every minute. When an SMS is sent to our virtual mobile number (from Telstra’s Messaging API free trial), it is forwarded to the http endpoint here in Node-Red where we match the text payload to some expected keywords (i.e temp, humidity, UV) and create a reply message payload based on what data has been asked for.

Ask your device for the “temp” and it will send you back the last known temperature reading in Celsius.

 

We are able to map this process pretty easily using the low-code flow in Node-Red:

This code is all available in my GitHub repo for you to use, just replace your own credientials!

 

A similar flow could be used to get on-demand readings from any other critical system you want to check in on, like the water level of a drinking trough on your remote farm, or the location of your package travelling across Australia! Pretty handy to be able to poll for that data, rather than wait for an automatical alert (we'll get to those in part 3!)

 

To see more detail or try this out yourself, check out my GitHub for the source code and detailed instructions.  

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

 

This tutorial was originally presented in a workshop at Call For Code with DeveloperSteve Coochin, June 2020: https://video.ibm.com/channel/23832688/video/cfc2020-telstradev-iotworkshop

 

To see how SMS alerts can be triggered by sensor input from your IoT device in emergencies, head to part 3 of this series.

Related Blogs

anonymous's picture

By Michelle Howie

15/7/21

  • arduino
  • iot

Real Time SMS alerts for dropped devices

  So in part 1 and part 2 of this workshop series, we’ve gone through how we can poll...
anonymous's picture

By Michelle Howie

15/7/21

  • arduino
  • iot

Control your IoT Device remotely with SMS commands

Developing with the Internet of Things is fun. It’s challenging. It’s frustrating at tim...
anonymous's picture

By Michelle Howie

2/7/21

  • iot
  • arduino

Changes to our IoT Developer Kit Offer

As developers ourselves, we understand that focus is a key to success. We’ve spoken to IoT dev...
anonymous's picture

By Tim McMahon

2/6/21

  • messagingAPI
  • airquality

SMS alerts for hazardous air quality during bushfire season

I woke up one morning in January 2020 and discovered that the air quality in Melbourne had drop...
anonymous's picture

By Alan Quayle

18/5/21

  • iot
  • API

Unlocking the Internet of Things with Telco APIs: Telstra’s...

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...
iot home garden project with arduino and azure
anonymous's picture

By keith coutlemanis

10/11/20

  • arduino
  • azure

Azure Internet of Things Garden Project with Arduino

I want to showcase a project I have been working on to reflect the interesting things you can do wit...
anonymous's picture

By Trent Steenholdt

10/11/20

  • iot
  • DIY

Home IoT Project using Azure

In this blog series, I’m going to write about how Internet of Things (IoT) enabled my gate,...
anonymous's picture

By DIYODE Magazine

9/11/20

  • arduino
  • iot

Hands On: Long Range IoT Arduino MKR NB 1500 over the...

We put the Arduino MKR NB 1500 to the test using the Telstra network and show you how to g...
anonymous's picture

By Michelle Howie

20/10/20

  • hackathon
  • iot

Data Driven IoT Insights for sustainable communities:...

In the second TelstraDev challenge for GovHack 2020 (part 1 on Communication APIs here), we asked:...
anonymous's picture

By Michelle Howie

20/10/20

  • hackathon
  • messagingAPI

Connecting our community in an emergency with mobile...

What do you get when you give 700 Hackers, Hustlers and Hipsters across Australia and New Zealand, a...
anonymous's picture

By Michelle Howie

1/9/20

  • iot
  • developer

Wireless Application Developers Guidelines for IoT

Are you developing with the cellular IoT network? There's loads of benefits like reducing payloa...