Page 2 of 2

Re: UART with GSM SIM800L

Posted: Tue Feb 18, 2020 3:26 pm
by headshaker
sarusso wrote:
Thu Feb 13, 2020 3:02 pm
To anyone still interested in using the SIM800L from MicroPython, here is a pure-MicroPython driver ready to use. You can use it as-is or just see how to do things in the right way. Happy coding! :)

https://github.com/pythings/Drivers/blo ... SIM800L.py
Could you please give the wiring you use? I'm trying to make it with a board like this but with no luck:

Image

Re: UART with GSM SIM800L

Posted: Tue Feb 18, 2020 3:57 pm
by sarusso
Provided that I am not an hardware expert, there is the wiring schematic on the GitHub page of the board I am using: https://github.com/Xinyuan-LilyGO/TTGO-T-Call (I attach a screenshot just in case).

When I started working on SIM800L wiring a few weeks ago, I noticed a lot of confusion online in respect to TX and RX - keep in mind that RX for the SIM800L it TX for the esp32 and vice-versa. I was doing that wrong in the beginning.
T-Call pinout from GitHub.jpg
T-Call pinout from GitHub.jpg (207.86 KiB) Viewed 41904 times

Re: UART with GSM SIM800L

Posted: Sat Feb 22, 2020 1:09 pm
by headshaker
Thanks!

I've managed how to do it:

SIM800L EVB 5V - to external 5V 2A power source +
SIM800L EVB GND - to external 5V 2A power source -
SIM800L EVB VDD - to ESP32 3.3V + Pin
SIM800L EVB TXD - to ESP32 RX Pin
SIM800L EVB RXD - to ESP32 TX Pin
SIM800L EVB GND - to ESP32 GND Pin
SIM800L EVB RST - to ESP32 23 Pin (any pin, we use it for power on/of SIM800L)

Now the only problem is in PPPoS

Re: UART with GSM SIM800L

Posted: Wed Feb 26, 2020 1:46 pm
by sarusso
headshaker wrote:
Sat Feb 22, 2020 1:09 pm
Now the only problem is in PPPoS
There is this PR from the hiveeyes.org community:

https://github.com/pythings/Drivers/pull/5

..but I have not gave it a try yet.

Re: UART with GSM SIM800L

Posted: Fri Feb 05, 2021 11:37 am
by JingaWorks
sarusso wrote:
Tue Feb 18, 2020 2:50 pm

You can then change the pins on which the SIM800L is connected at line 412 and the APN at line 428 of SIM800L.py (with respect to commit 865216c on the repo I linked) and put the driver on the board. Note that you need to manually change the pins and the the APN in the driver code only to make the "example_usage" function to work, when you use the driver in the "proper" way, which is to instantiate a Modem class from your scripts, the pins and the APN are parametrised (as you can see from the "example_usage" function at line 403 itself)
Hi Sarusso.
Just a newbie question.
I am new to micropython, I have some basic experience with arduino.
I just got my esp32 nodemcu and sim800l module and want to play with it, using micropython.
I found this thread and your sim800L.py.
Looks nice easy to use and understand, but as a newbie I don't understand the pins hookup

I understand where to connect:
MODEM_RST_PIN
MODEM_TX_PIN
MODEM_RX_PIN

I don't really know how/where to connect:
MODEM_PWKEY_PIN
MODEM_POWER_ON_PIN

Does MODEM_PWKEY_PIN connect to DTR on my module?

MODEM_PWKEY_PIN_OBJ.value(0)
It's set low, to wake up the module, right?

MODEM_POWER_ON_PIN is the Vcc on the module?
MODEM_POWER_ON_PIN_OBJ.value(1) ?
Is this supposed to power the sim800l module?

My module requires around 4V and it's powered with external source and Step Down LM2569 Module. In this case, what pins should I connect.

Tomorrow I get the step down  module.

#MODEM_POWER_ON_PIN_OBJ.value(1)
In this case, can I comment out this line?
Or even better, remove the whole parameter?

Thank you for providing this driver.

Re: UART with GSM SIM800L

Posted: Mon Mar 01, 2021 12:09 am
by sarusso
Hi JingaWorks,

the pins:

MODEM_RST_PIN
MODEM_PWKEY_PIN
MODEM_POWER_ON_PIN

are for automatically powering on and resetting the modem which is required for some boards.

If you have the modem always on, you can just leave them set to None!

Re: UART with GSM SIM800L

Posted: Fri Mar 19, 2021 6:46 am
by naveennain
Gabi wrote:
Sun Sep 11, 2016 12:49 pm
Sorry for the double post :?

So, I tested what you suggested Roberthh and it did not work at first.

Then I try to switch the TXD and RXD pins...and it worked...now, I know what you think but I checked again and my pins were correctly linked to the RXD and TXD of the board, at least the pins wrote as TXD and RXD.

So, it seems that the pin of the board are switched...

Then I test with a baudrate of 9600 and be sending a CR message before the ATI command at it worked!

I tried again with 115200 and without the CR message at first, it do not work but with it, it is working correctly (I think I should add some delay before reading the UART after the command):

Code: Select all

>>> from machine import UART, Pin
>>> 
>>> TERMINATION_CHAR = '\x1a'
>>> 
>>> TXD_PIN = 'GP16'
>>> RXD_PIN = 'GP17'
>>> RST_PIN = 'GP22'
>>> #TXD = Pin(TXD_PIN, mode=Pin.OUT)
>>> #RXD = Pin(RXD_PIN)
>>> RST = Pin(RST_PIN, mode=Pin.OUT)
>>> RST.value(0)
>>> uart = UART(1, baudrate=115200, pins=(TXD_PIN, RXD_PIN))
>>> RST.value(1)
>>> uart.write('\r\n')
2
>>> uart.write('ATI\r\n')
5
>>> uart.any()
0
>>> uart.readall()
b'ATI\r\r\nSIM800 R14.18\r\n\r\nOK\r\n'
>>> 
Here

Code: Select all

uart.any()
return 0 that is why I think adding delay would be better and I think that with the delay I can maybe avoid sending the first CR message.

Anyway, I'll continue and I'll let you know my feedback :)

Thakn you!


It will showing a error
Traceback (most recent call last):
File "<stdin>", line 11, in <module>
TypeError: extra keyword arguments given

Re: UART with GSM SIM800L

Posted: Mon Mar 22, 2021 8:06 pm
by Eckaard
sarusso wrote:
Thu Feb 13, 2020 3:02 pm
To anyone still interested in using the SIM800L from MicroPython, here is a pure-MicroPython driver ready to use. You can use it as-is or just see how to do things in the right way. Happy coding! :)

https://github.com/pythings/Drivers/blo ... SIM800L.py
Good day,

With regards to Sarusso's driver; how would one go about doing a http post request which requires an Authorization Token. I've tried multiple AT commands such as AT+HTTPPARA="USERDATA","Authorization: Token xyz123", however, keep on getting a 606 response.

Previously i have used urequest which worked perfectly with the following header:

Code: Select all

headers = {
             'Accept': 'text/plain',
             'Authorization': 'Token xyz123',
             'Content-type': 'application/octet-stream'
         }