Raspberry Pi + SIM800 for GPRS

raspberrypi3
network

#1

I have tried the following with both a Raspberry Pi 1 and RPi 3, using Resin OS 2.

My goal is to get the Raspberry Pi to use a SIM800 GSM module to get internet for Resin.io to work.

I tried two methods as described below. In both cases I enabled the UART on the RPi’s gpio header, and disabled the Linux console on the UART. The SIM800 module is connected and powered correctly. The hardware setup was proven to work using PPPd under a Raspbian install.

Method 1:
Resin OS 2 makes use of Network Manager, and therefore Modem Manager for PPP connections. I tried configuring modem manager to us the modem on the uart of the RPi. This however seems impossible as the RPi’s UART is blacklisted in Modem Manager. Any udev configs to force modem manager to scan the uart was fruitless.

After this I tried connecting the SIM800 via a USB-uart module to the RPi. In this case the modem was detected by modem manager, but only after a manual scan. This is because the USB-uart is graylisted in modem manager.

There is no way I know of to convince modem manager to automatically use the modem on either the RPi’s uart, or the USB-uart during headless bootup of the RPi.

Method 2:
Then I decided to try the same method I used to get internet under Raspbian, by following this tutorial: https://learn.adafruit.com/fona-tethering-to-raspberry-pi-or-beaglebone-black/setup
After this tutorial, it seems like the /etc/network/interfaces file is ignored by ResinOS, so I added the pppd to systemd to start my gprs connection at startup. This seems to provide an internet connection to ResinOS at startup of the RPi.

However the Pi does not show up on resin.io. After plugging in ethernet, I ssh’d in and saw that the gprs/ppp connection was up. I removed the default route via ethernet, while the default route via the ppp connection was still in place. I was able to ping towards the internet, and resin.io suddenly started seeing the Pi.

It seems that the resin.io service on the Pi is only started when Network Manager says there is an internet connection. The gprs connection that is set up using pppd does not trigger the resin services.

Sy my question is two fold:

  1. How can I convince Modem Manager to use my gsm modem that is connected to the UART?
  2. How should I get the resin services to start after my ppp connection is up?

#3

Hi @jpmeijers,

In our docs, we have a guide for GSM based connections https://docs.resin.io/deployment/network/2.0.0/#cellular-modem-setup. I think you’re missing a configuration for your modem. Please follow the guide in our docs and let us know if you need further support.


#4

Hi @nghiant2710

Your guide is exactly where I started. The problem is you can not specify a specific port for the GSM modem in the /resin-boot/system-connections/my-gprs-connection configuration file. This makes sense because Modem Manager auto detects the port on which a modem is connected.

As I describe in my original post, Modem Manager does not consider a Raspberry Pi’s UART as a valid port to scan during auto detection of modems. This is because the Pi’s SOC’s UART is blacklisted in the Modem Manager code.


#5

Hey @jpmeijers

This issue looks like it could be helpful for your first question.

For your second question, the resin supervisor starts when the device is booted up irrespective of the connection status. I am not sure why the /etc/network/interfaces file changes are ignored, how did you apply them?

Hope that helps
Joe


#7

I think I finally figured it out after reading ModemManager’s source code. It seems like ModemManager goes and look at the physical device at the root of the uart. Therefore not /sys/devices/platform/soc/20201000.uart/ but /sys/devices/platform/soc/.

Therefore this udev rule (I tried multiple including this one before starting this thread) did not work:

ACTION=="add", KERNEL=="20201000.uart", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"

Adding the following udev rule and restarting the Pi allowed ModemManager to detect the modem correctly.

# vi /etc/udev/rules.d/98-modemmanager.rules
ACTION=="add", KERNEL=="soc", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"

ModemManager now sees:

# mmcli -L

Found 1 modems:
	/org/freedesktop/ModemManager1/Modem/0 [SIMCOM_Ltd] SIMCOM_SIM800L

I now added a system-connection file as from here to the boot partition and restarted the Pi. After a few minutes the light on the GSM module starts to flash in the pattern that signals a GPRS connection. I however still do not see the Pi reporting to the resin.io dashboard.

Next step will be to burn a clean resinOS image to the SD card, add the UDEV rule, add the system-connection file, and restart. I’ll report back with my findings.


#8

Hey @jpmeijers, I guess you were saying that you’ll add that udev rule to the host OS? If so, I’d would probably recommend trying the udev rule within the container, see if that would work (ie. connecting to normal network let’s say over ethernet, pulling the application and then disconnecting the network/rebooting). Just thinking, because if that works, you are in a better position. Modifications to the hostOS basically force you not being able to update the hostOS remotely afterwards.

@agherzan, what do you think about this udev rule change, is it something general, that would be beneficial in general?


#9

Hi, in order to see why it is not connectiong to the resin dashboard, could you please check the output of:

journalctl --no-pager -u openvpn-resin

(maybe leave out the private stuff if you want to paste it here :slight_smile: )