Node-RED Tutorial: How to send AT commands with Raspberry PLC
Send and receive SMS using Raspberry based PLC
5 July, 2021 by
Node-RED Tutorial: How to send AT commands with Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

Odoo image and text block


GSM (Global System for Global Communications) is the communication system most widely used in mobile phones, and its first functionality is the 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 blog, you will learn how to send AT commands, specially how to send SMS from your Industrial GPRS family PLC Raspberry to your mobile phone.


How to connect 
Raspberry PLC to Wi-Fi

Read >>


Basics about Raspberry Pi PLC
analog outputs

Read >>

How to find your
perfect industrial PLC

Read >>

How to program Raspberry PLC 
interrupt inputs with Python

Read >>

Raspberry PLC
family products

Read >>

TouchBerry Pi
family products

Read >>


 Raspberry PLC with GPRS

 Ethernet cable



In this blog, we are going to develop a Node-RED flow to send SMS messages from the GSM module of Raspberry PLC to our mobile phone. The AT commands that we are going to use are the same as we used in this blog.

First of all, check the following from your Raspberry PLC: 

  SSH is enabled

  Node-RED is installed in your Raspberry PLC

  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!

Sending SMS

Go to your favourite browser, type the IP address from your Raspberry PLC and start your App.
As we mentioned before, we are going to send the following to our /dev/ttyS0 port to get the response. 

Odoo image and text block

So the first thing that we are going to do it to add five inject nodes to set the msg.payload to the String messages like this:

Odoo image and text block

As we can see in the picture above, after every message we must add an Enter character (\n), and also a Ctrl + Z right between the "Hello" message and \n.
So we are going to wire these five inject nodes to a function node, where we will add those characters in hexadecimal.
To add the \n after the AT commands, add the \n parsed in hexadecimal to a function node as shown:

msg.payload += Buffer.from("0D", "hex");
return msg;

Note that there the symbol is += to append the \n after the AT commands.

Odoo image and text block

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 the the function node with \n.

msg.payload += Buffer.from("1a", "hex");
return msg;

Odoo image and text block

Then, look for the serial out node and configure it as you want. We left the default values and configured the following:

Baudrate: 115200
Data Bits: 8
Parity: None
Stop Bits: 1

Add a serial in node wired to a debug node, where you will get the responses from the same port.

Odoo image and text block

Finally, click on the buttons of the inject nodes, and see the results!

Odoo image and text block
Odoo image and text block

 Now, would you like to know how to work with GPRS module?Know how >>

Node-RED Tutorial: How to send AT commands with Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
5 July, 2021
Share this post

Looking for your ideal PLC?

Take a look at this product comparison with other industrial controllers Arduino-based.

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>

Do you want more information?

Just fill the form!

Tell me more!