GSM/PPPOS working example/library

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
nedoskiv
Posts: 8
Joined: Fri Jan 18, 2019 10:48 am

GSM/PPPOS working example/library

Post by nedoskiv » Sat Apr 20, 2019 3:17 pm

Hello,

I wanted to use a GSM modem (SIM800L) for example to connect my ESP32 board (as long as read it merget with main)
So far I have read that network.PPP is added, but never see anyone post a working example to run it.
Loboris ESP32 have implemented GSP support and it is working. Examples that he post are actually working, but his port looks abandoned (also have some differences) that make me not use it for a projects.
So is there someone who wanna work with me to write a library that gonna make internet works from GSM modem using PPPOS?

nedoskiv
Posts: 8
Joined: Fri Jan 18, 2019 10:48 am

Re: GSM/PPPOS working example/library

Post by nedoskiv » Sat Apr 20, 2019 6:29 pm

Here is how it worked for me (very basic example):

Code: Select all

import machine
import time
gsm = machine.UART(1,tx=22, rx=21, timeout=1000,  baudrate=9600)
time.sleep(1)
gsm.write("at\r\n")
print(gsm.readline())
print(gsm.readline())
time.sleep(1)
gsm.write("AT+CPIN?\r\n")
print(gsm.readline())
print(gsm.readline())
time.sleep(1)
#gsm.write("ate0\r\n")
#print(gsm.readline())
#print(gsm.readline())
#time.sleep(1)
gsm.write("AT+CREG?\r\n")
print(gsm.readline())
print(gsm.readline())
time.sleep(1)
gsm.write("AT+CNMI=0,0,0,0,0\r\n")
print(gsm.readline())
print(gsm.readline())
time.sleep(1)
gsm.write('AT+CGDCONT=1,"IP","globul"\r\n')
print(gsm.readline())
print(gsm.readline())
time.sleep(1)
gsm.write('AT+CGDATA="PPP",1\r\n')
time.sleep(1)
print(gsm.readline())
print(gsm.readline())

time.sleep(5)

import network
 
ppp=network.PPP(gsm)
ppp.active(True)
time.sleep(15)

print(ppp.ifconfig())
Output:

Code: Select all

MicroPython v1.10-290-g8402c26cf on 2019-04-20; ESP32 module with ESP32
Type "help()" for more information.
>>> exec(open('./gsm.py').read(),globals())
[0;32mI (3090) uart: ALREADY NULL[0m
b'at\r\r\n'
b'OK\r\n'
b'AT+CPIN?\r\r\n'
b'+CPIN: READY\r\n'
b'\r\n'
b'OK\r\n'
b'AT+CREG?\r\r\n'
b'+CREG: 0,1\r\n'
b'\r\n'
b'OK\r\n'
b'AT+CNMI=0,0,0,0,0\r\r\n'
b'OK\r\n'
('10.164.62.94', '192.168.254.254', '255.255.255.255', '0.0.0.0')
>>> 
Also noticed some problems during tests and fire up an issue at Github:
https://github.com/micropython/micropython/issues/4708

bruno963852
Posts: 2
Joined: Thu May 30, 2019 3:21 pm

Re: GSM/PPPOS working example/library

Post by bruno963852 » Thu May 30, 2019 3:23 pm

How do you set the apn, user, and password?

Post Reply