PPPOS for ESP32 and Google IoT Cloud Platform

Hello community

I have succeeded create a small esp32 app that connects into the Google Cloud Platform, but I can not find a step by step tutorial about how to use PPPOS.

I have a SIM800L with chip and mobile internet data enabled. The LED network indicator starts blinking 1 time per second, and after 5 seconds, it blinks 1 time every 3 seconds. It means it connected to cellular networks.

But when I connect my ESP32, and the firmware reset the SIM800L, it blinks 2 times per second. I think it means it is using GPRS, but the device doesn’t connect into GCP anymore.

Can someone provide a step by step how to setup PPPOS using ESP32 and latest mongoose-os version?
Does GCP works fine using PPPOS?

1 Like

@Jorge_Jeferson_Ferre do you have teh APN details in the mos.yml file like this

  - ["pppos.enable", true]
  - ["pppos.uart_no",2]

to select what uart and enable pppos ? if htis is what you did and it is not working check this library

I modified it to use the AT command for LTE.

1 Like

Thank @lidraikh for you help here, but it does not work here.

I attached “mos config-get and GetInfo.txt” and “device esp32_AF49AC.log” with more details.

I redo my steps in order to make clear where this went wrong

  1. I followed all the steps in https://mongoose-os.com/docs/mongoose-os/cloud/google.md with success.
  2. I edited the mos.yml and included the following config schema (lines 13-17) following my cellular operator APN data:
    image
  3. I rebuild, flash, and reset the firmware again just to make sure everything is up to date.

And then, it stopped to connect and communicate with GCP.

Also, I notice the SIM800L start blinking faster (3x per second, see the video, and I would like to know why) after the firmware starts to communicates with SIM800L.

The ESP32 and SIM800L communication through UART2 look like ok because it is showing the correct IMEI, SIM module and some other data that would be provided only by the SIM800L module.

I am not sure. My guess is the steps # 3 (to enable PPPOS) disabled some GCP or MQTT configuration I just need to reset again.

In the beginning, the video shows the SIM800L module start blinking 1x second and then 1x every 3 seconds (this is expected behavior). But when I turn on ESP32, it resets SIM800L that start blinking 3x second. By the information I found, it means it is connected to GPRS.

Please, check out the demo video

mos config-get and GetInfo.txt

device esp32_AF49AC.log

1 Like

Are you using M2M chips or GSM?

By default there is a standard command in mongoose PPPoS library that tries to connect, are you obtaining any IP address?

1 Like

No. I am using general GSM chip (pre-paid). I checked in my cellphone and its has enabled mobile data working with no issues.

Yes (I think). Here is the log show PPP works fine and also send and received SNTP data

mgos_deps_init.c:230    init pppos...
mgos_pppos.c:947        PPPoS UART2 (RX:16 TX:17 CTS:14 RTS:15), 115200, fc off, APN 'zap.vivo.com.br'
mgos_pppos.c:112        Trying baud rate 115200 (fc off)...
mgos_net.c:85           PPP: connecting
mgos_net.c:85           PPP: connecting
mgos_pppos.c:613        Connecting (UART2, APN 'zap.vivo.com.br')...
mgos_pppos.c:263        SIM800 R14.18, IMEI: 865--------2875
mgos_pppos.c:333        SIM is ready, IMSI: 724--------6905, ICCID: 8955----------9692
mgos_pppos.c:388        Connected to mobile network (home)
mgos_pppos.c:406        Operator: Vivo
mgos_pppos.c:416        RSSI: -57
mgos_pppos.c:738        Starting PPP, user 'vivo'
mgos_net.c:89           PPP: connected
mgos_net.c:101          PPP: ready, IP 100.115.225.249, GW 192.168.254.254, DNS default
mgos_sntp.c:95          SNTP query to time.google.com
mgos_sntp.c:48          SNTP sent query to 216.239.35.12
mgos_sntp.c:59          SNTP reply from 216.239.35.12: time 1566960249.863272, local 10.660811, delta 1566960239.202461
mgos_sntp.c:78          SNTP close

Is there something else I can check?

1 Like

Seems the device correctly connects. Modem seems to connects and even retreives the epoch from time.google.com. I don’t know how GCP autorizes devices to connect to it’s cloud, but have you confirmed autorization and certificates in GCP?

Yes, for sure! It was working fine before I update the PPPOS configuration in mos.yml
The device sent json data to GCP and received configuration from there as well:

GCP Stackdriver Logging has no error logged there.

I think maybe you are looking for the correct way to comunicate with your module. I’m currently using “AT+” commands to publish and download files from the cloud. For this purpose, I needed to configure the ESP UART, and set it to comunicate with the modem.

I couldn’t use the PPPoS library from mongoose OS, as it doesn’t compile for the ESP8266 my project is using, buy maybe your could try using the AT commands your modem supports.

Struct a variable with all the commands you need to get your project working like: “AT+CPWROFF”, add it’s correct response and use the PPPoS library command to add it:
https://mongoose-os.com/docs/mongoose-os/api/net/pppos.md
*(mgos_pppos_cmd_cb_t)(void *cb_arg, bool ok, struct mg_str data);

call the command when needed in the code with:
mgos_pppos_run_cmds(int if_instance, const struct mgos_pppos_cmd *cmds);

I can’t help you any further since I, myself couldn’t get this library working. But if you play around you’ll definitely get good results, since your device is corretly connected, has an IP and is permited in GCP.

GCP IOT is complex. It requires JWT authentication, HTPPS connection, MQTT protocol. Implement these requirements using AT command would be too much work.

If someone from Mongoose-OS confirm this approach won’t be able, I’ll give up

Hello Mongoose-OS

Can someone please help me here?
Is Google Cloud Platform IoT available through esp32 + PPPoS?

It should be, I mean, with the PPPoS you should be able to connect to the internet just like a regular modem would. I can’t see where you are getting wrong.

Have you performed all of the steps from the oficial mongoose os documentation?

what happens if you try publishing and subing over a topic in GCP?