Page 1 of 1

GSM/PPPOS working example/library

Posted: Sat Apr 20, 2019 3:17 pm
by nedoskiv
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?

Re: GSM/PPPOS working example/library

Posted: Sat Apr 20, 2019 6:29 pm
by nedoskiv
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

Re: GSM/PPPOS working example/library

Posted: Thu May 30, 2019 3:23 pm
by bruno963852
How do you set the apn, user, and password?