Connecting the Raspberry PLC to internet using SIM7600G-H Dongle

Learn how to connect the Raspberry PLC to internet without the need of WiFi connection
20 de enero de 2023 por
Connecting the Raspberry PLC to internet using SIM7600G-H Dongle
Boot & Work Corp. S.L., Bernat Brunet Pedra

Introduction

Have you ever wanted to connect your Raspberry PLC to the internet without the need of WiFi or Ethernet connection? The SIM7600 device helps us do that task, by just connecting a SIM card inside it and making some specific configurations.

In this post you will learn how to configure both SIM7600 and Raspberry PLC to access the internet only using the SIM7600 module and, of course, a SIM card.


Requirements

  • Raspberry PLC
  • SIM7600 4G USB Dongle
  • SIM card with internet provider


Preparations

The first thing to do is to plug-in the SIM7600 module into one of the 4 USB ports of the Raspberry PLC. By checking the connected devices with

$ ls /dev/tty*

the devices /dev/ttyUSB[0..X] should appear. In this post /dev/ttyUSB2 will be used, as this port corresponds to the SIM7600.

In some occasions, the ttyUSB* ports do not appear when listing the directory, so to fix that use the following commands:

$ sudo modprobe ftdi_sio
$ sudo sh -c "echo XXXX YYYY > /sys/bus/usb-serial/drivers/ftdi_sio/new/id"

To see what XXXX and YYYY parameters are, check

$ lsusb

command where you should find a line such as:

Bus 001 Device 008: ID 1e0e:9018 Qualcomm / Option SimTech, Incorporated

so XXXX is 1e0e and YYYY is 9018 in our case. Now it is time to communicate with the SIM7600 using minicom.


SIM7600 configuration

To install and open minicom use this commands:

$ sudo apt install minicom
$ sudo minicom -D /dev/ttyUSB2

In the minicom screen, type Ctrl+A and then E to enable local echo so you can see what you are actually writing.

  1. By typing AT, communication between the PC and SIM7600 is checked. The returned string should be "OK".
  2. You can use AT+CSQ to see the signal quality of the SIM7600. The returned string should be like so: "+CSQ: 20,01".
  3. Now type AT+CUSBPIDSWITCH=9018,1,1. The returned string should be "OK".
  4. To exit minicom, use Ctrl+A and then X.

For more AT commands, look at this PDF file.

Note: For SSH connections with the Raspberry PLC, you may not be able to type Ctrl+A E or Ctrl+A X correctly, so use Ctrl+Majus+A instead of Ctrl+A.


PC configuration

Now let's see if the SIM7600 configuration has been done correctly with

$ ip a show usb0


If usb0 is not defined, search for an interface with a similar name with 

$ ip a

In the image above, the interface usb0 has an IP address, but yours should not have one yet. To get one, type

$ sudo dhclient -v usb0

By using again the first command, you should see that now the interface has an IP address too. The last step is to add the proper route for the usb0 interface so the SIM7600 can access the internet. To do it, type this command:

$ sudo route add -net 0.0.0.0 usb0

The default route should have been added here:


Finally, it is time to test the internet connection. With the ping command, we are able to check if we can access the internet like so:

$ ping -c3 -I usb0 8.8.8.8


And there it is! As the message describes, we have been able to connect to Google's official DNS service successfully using the usb0 interface, which is the SIM7600 module.

Your Dynamic Snippet will be displayed here... This message is displayed because you did not provided both a filter and a template to use.


Buscar en nuestro blog

Connecting the Raspberry PLC to internet using SIM7600G-H Dongle
Boot & Work Corp. S.L., Bernat Brunet Pedra 20 de enero de 2023
Compartir

¿Estás buscando tu Controlador Lógico Programable ideal?

Echa un vistazo a esta comparativa de producto de varios controladores industriales basados en Arduino.

Comparamos entradas, salidas, comunicaciones y otras especificaciones con las de los equipos de otras marcas destacadas.


Industrial PLC comparison >>>