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

You are here

Ask for Environmental Sensor Data via SMS

BY Michelle Telstra 08 April 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.

Here is the low-code flow in Node-Red 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 was updated with the latest sensor reading every minute. When an SMS was sent to our virtual mobile number (from Telstra’s Messaging API free trial), it is forwarded to the http endpoint here 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.

A similar flow could be used to get on-demand readings from any other critical system you want to check in one, like

 

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

Originally presented 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.