0

I'm trying to create a datalogger that sends data to a server at a certain time. I use SIM800L and Arduino pro mini.

Wiring:
SIM800L      Arduino mini pro
RST          7
TX           8
RX           9
VCC          power supply (5V 2A reduced to  4.08V)
GND.         GND

My problem arises when I send data. About every third attempt to send results in an error. SIM800L ERROR or Operation not allowed responds to all other commands after this failed attempt. The only option is to restart the entire module to set it up and try again to send the data to the server.

I enclose my pseudocode as I use this library.

SETUP:
AT
AT+CSQ (until is signal)
AT+CREG?
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","internet"
AT+CLTS=1
AT+AT&W

LOOP:
AT+CSCLK=0
ATH
AT+GSMBUSY=1
AT+SAPBR=1,1 // connect

AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://page.com/log.php?data=23456789"
AT+HTTPSSL=0

AT+HTTPACTION=0
// ...waiting for result...
AT+HTTPREAD
AT+HTTPTERM

If success:
AT+SAPBR=0,1
AT+GSMBUSY=0
AT+CSCLK=2

Subsequently, if the server did not return a response of 200 (what it should) then try again, but if the second attempt also encounters an error, the module will restart and "SETUP:" and the connection will be made again.

Sometimes it also happens that the logging succeeds, but nevertheless the module receives bad HTTP code (verified through the server access log).

The signal is sufficient for each attempt (about -83)

You wouldn't know how to solve this problem without having to reboot the model (as it takes a lot of time and consumes a lot of power)?

Thank you for any suggestion!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.