GSM (Global System for Global Communications) is the communication system most widely used in mobile phones, and its first functionality is voice transmission. However, it also allows data transmission like SMS or Internet, at a very low speed.
GPRS (General Packet Radio Service) is an extension of GSM based on packet transmission that offers a more efficient service for data communications, especially in the case of Internet access.
In this post, you will learn how to send AT commands, specially how to send SMS from your Industrial GPRS Family of the open source PLC Raspberry Pi to your mobile phone, thanks to industrial automation.
In this post, we are going to develop a Node-RED flow to send SMS messages from the GSM module of the Raspberry Pi PLC controller to our mobile phone. The AT commands that we are going to use are the same as we used in
First of all,
SSH is enabled
If you go to minicom using:
sudo minicom -D /dev/ttyS0 -b 115200
and type AT, you receive OK.
And once everything is ready, let's go with the Node-RED application!
So the first thing that we are going to do is to add five inject nodes to set the msg.payload to the String messages like this:
msg.payload += Buffer.from("0D", "hex");
Note that there is the symbol "+=" to append the \n after the AT commands.
Now, we have to add a Ctrl + Z character between the Hello message that we want to send, and the \n. The Ctrl + Z is represented by 1a in hexadecimal. So add the following to a function node and wire it between the inject node and the function node with \n.
msg.payload += Buffer.from("1a", "hex");
Then, look for the serial out node and configure it as you want. We left the default values and configured the following:
Data Bits: 8
Stop Bits: 1
Add a serial in node wired to a debug node, where you will get the responses from the same port.
Finally, click on the buttons of the inject nodes, and see the results!