How to send and receive SMS with Raspberry Pi automation
SMS between GSM module and mobile phone, working with SIM7600E 4G HAT module and a Raspberry Pi Board
19 May, 2021 by
How to send and receive SMS with Raspberry Pi automation
Boot & Work Corp. S.L., Fernandez Queralt Martinez

INTRODUCTION

In this post, you will know more about SIM7600E-H 4G HAT for Raspberry Pi, LTE Cat-4 4G / 3G / 2G, GNSS, for Europe, Southeast Asia, West Asia and Africa, and you are going to test it.

For the testing it, you are going to send SMS from your Toucherry Pi 10" Panel PC monitoring for industrial automation with the SIM7600E 4G Hat module, to your mobile phone. 

RELATED LINKS

How to

Connect Raspberry PLC to Wi-Fi

Read 

Raspberry PLC

Family products

See 

How to

Program Raspberry PLC Interrupt inputs with Python

Read 

Basics about

Raspberry Pi PLC Analog Outputs

Read 

Touchberry Pi

Family products

See 

How to

Find your perfect industrial PLC

Read 


CONNECTIONS


In this case, you can see a Raspberry Pi 4 connected to the SIM7600E-H 4G Hat module through the USB port as shown:

Raspberry Pi 4 connected to the SIM7600E-H 4G Hat module

SIM7600E-H 4G HAT


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.

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.

The SIM7600E-H 4G HAT is multi-band LTE-TDD/LTE-FDD/HSPA+ and GSM/GPRS/EDGE module solution in a SMT type which supports LTE CAT1 up to 10Mbps for downlink data transfer. It has strong extension capability with rich interfaces including UART, USB2.0, I2C, GPIO etc. With abundant application capability like TCP/UDP/FTP/FTPS/HTTP/HTTPS/DNS, the module provides much flexibility and ease of integration for customer's application, such as open source projects.


SENDING SMS


The AT+CMGF command is used to instruct the GSM / GPRS modem to operate in SMS text mode. So, insert your SIM Card and to the SIM7600X board and let's start!

First, ensure that the hardware is right connected. So, connect open up a terminal window and type "sudo raspi-config" > Go to Interface Options > Serial Port > Reject the login shell to be accessible over serial > Accept the serial port hardware to be enabled.

Now, open the Serial Port by installing the screen tool:

sudo apt update
sudo apt install screen
screen /dev/ttyUSB2 115200 (you can use USB0, USB1 or USB2)



Once in the Serial Port, let's send some AT commands:

AT                              The device recognizes the SIM7600E module
OK                              Response  
AT+CFUN=1             Set phone functionality
OK                              Response  
AT+CMGF=1            Set the GSM modem in SMS Text Mode
OK                             Response  
AT+CMGS="+34666XXXX66"    <--    Add a phone number
> Type here your text message   <-- (Do not finish it with an Enter, but with Ctrl + Z)
OK                             Response
  

 Know more about AT commands  here >>


Receiving SMS

The AT + CMGL command lists messages received on the GSM / GPRS modem. It can be used to get all received messages, all unread messages or all read messages.

Finally, let's set the GSM modem to Text Mode SMS and read all received messaged:

AT+CMGF=1                    Set the GSM modem in SMS Text Mode
OK                                 Response  
AT+CMGL="ALL"           <-- List all received messages
+ CMGL: 0, "REC READ", "+346XXXXXXX6", "", "21/05/21,12:32:09+08"
HIGH Temperature
OK                                     Response


Want to know more and learn how to work with the GPRS on Raspberry Pi?

Read the following post.

How to send and receive SMS with Raspberry Pi automation
Boot & Work Corp. S.L., Fernandez Queralt Martinez
19 May, 2021
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

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!