Sponsored by: DigitSpace
Product used: SIM800L Module Replace SIM900A GSM GPRS 5V Serial with Antenna
Hello there, this is my third tutorial concerning SIM800L EVB version, make sure to take a look at previous ones, to not make this one long:
Send SMS/Text From Arduino Using SIM800L GSM/GPRS Module
LASER Tripwire GSM Alarm with Phone Number Dialing
So here in this tutorial, I'm going to use the same module "SIM800L EVB version" with Arduino Uno board, and I took for example "DHT11" and "MLX90614 contactless thermal sensor".
And the idea is that I'm going to ask the Arduino via SMS to send me either the DHT values or the MLX values via SMS too, the project is relatively easy, the tricky part was to detect a substring withing the SMS content to be able to decide wheter the user asks for DHT values or MLX values.
HALT !!!
The Sim card used shouldn't be locked with a pin code otherwise use the AT commands to do it, and make sure you have enough credit to be able to send SMS... depends on your network provider.
This is the module I'm using:
And as said before the module works with AT commands, we saw some of them on the previous tutorials.
And for the power I'm using A Lithium Battery with A Buck converter:
So the test #1 consist of just reading a SMS sent from the phone, and display it on the serial monitor.
WiringThe wiring 1 can be found below, it's the basic wiring of the module, it's practical for all kind of tests.
LibrariesNo special libraries are required here just the default SoftwareSerial.
CodeCode 1 can be found below.
The code is really easy first in the "Setup()" we just send some "AT commands" to make the module on the receiving text mode and set the way those SMS received should be handled.
And on the loop there is a classic communication function that permits the communication between the Arduino IDE Serial Monitor and Sim800L "send/receive" between them
The functions used can be found in the code, but if you want to check them closely here's the document:
https://www.elecrow.com/wiki/images/2/20/SIM800_Series_AT_Command_Manual_V1.09.pdf
ResultOn the test#2 we will add DHT11 sensor and MLX90614 contactless thermal sensor... I used these two just as an example you can use whatever you want.
And in the code I integrated a part where I read the SMS received and check for the keywords "DHT" or "MLX"... and here of course you can replace it by your own or make a whole command i.e:"Send DHT data".... to sum up with just look for a substring within a string :D
WiringThe wiring 2 can be found below, we have just add the DHT11 and MLX90614
LibrariesTwo libraries should be add (Because of the modules) depending on what you are using.
https://github.com/adafruit/DHT-sensor-library
https://github.com/adafruit/Adafruit-MLX90614-Library
CodeCode 2 can be found below.
So in this code we:
- Set the module to receiving SMS mode
- Set the way to handle the SMS
- If something is received -> Transmit to Arduino
- Arduino will check for the "Keywords" (DHT or MLX)
- If one of them is found -> check which one
- Make the reading
- Send the Data to the programmed phone number
The use of the serial monitor is optional, the device can work without it, here used just to troubleshoot in case of a problem or to check the state.
The method we used is just to look for a specified keyword within the message, doesn't care what's being sent with it
You can improve the way to detect the keywords in the SMS sent, it will be useful to do other projects that will be more interesting.
You can do multiple readings before sending the SMS to be more precise.
Send error SMS in case the sensor is not working properly.
Check the code and if you have a better method for this share it with us, Thanks.
That's all folks.
Comments
Please log in or sign up to comment.