Cellular / modem comunnications port

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Cellular / modem comunnications port

Post by kindmartin » Mon Jul 18, 2022 12:25 pm

Hi all, I asked this question on /librarys forum part long time ago without response. viewtopic.php?f=15&t=10001

After searching for a lib supporting cellular modem modules in latest micropython (now 1.19) and Im not finding anything but that old loboris ESP32 port freeze at 2018 that easily permit data connections from ESP32. A pity that the port didn't integrate into the main mpy branch.

Any hint for modules like sim800 or sim7600 or quectel ones? I need to connect a mqtt or blynk app in cases wifi access is not available.



M

p_j
Posts: 102
Joined: Mon Aug 23, 2021 1:08 pm
Location: Sydney

Re: Cellular / modem comunnications port

Post by p_j » Thu Jul 28, 2022 2:00 pm

I have discovered that the easiest way to use modems with micropython is to use PPP. This provides a seamless network connection so you can use all the standard libraries like ntp, requests etc.. without dealing with the raw AT commands.

The trick to getting ppp working is to first put the modem in ppp mode, you shouldn't need a library for this. I use the SARA modems and all that I need to do is:

1. Wait for the modem to connect to a nework
2. Activate a GPRS connection "AT+UPSDA=0,3 " This will be different for the SIMCOM modems.
3. Create a ppp connection in micropython

Code: Select all

import network

qw = network.PPP(self.uart)
qw.active(True)

time.sleep(0.5)

qw.connect(authmode=qw.AUTH_PAP, username="", password="")

count = 0
while qw.isconnected == False:
    time.sleep(1)
    count += 1
    if count > 5:
        raise
    logger.debug(f'PPP connected')
I have some SIM7600 modules here that I will be using in a project soon. If I get some working code written I will share it here.

kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Re: Cellular / modem comunnications port

Post by kindmartin » Sat Jul 30, 2022 2:56 am

Thanks P_J. I will try that network.PPP and comment also over here. I have also SIM7600 SA also with PCIE for those Lilygo ttgo-PCIe ESP32 board. I will be trying first Quectel BG600 LTE/GPRS small factor with a ESP 32 s3 board as is what I chose for my project, if any is also aiming this modules.

kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Re: Cellular / modem comunnications port

Post by kindmartin » Sat Jul 30, 2022 3:10 am


Post Reply