0

I created a device that monitors air quality. The measured data is then sent to a web server using an ESP32 (programmed in C++ with Arduino framework) and SIM800C module, which stores them in an SQLite database.

So, the device is constantly turned on (except the time when the battery is recharged), and in code is used deep sleep to maximise the runtime. Also, all modules, including mentioned SIM800C are put into sleep mode.

The problem is that after three days of the whole device being constantly powered on, SIM800C starts having problems with opening HTTP communication. Those issues started showing up after one or two months of using the module.

I am pretty sure the problem is in the module since replacing it with a brand-new one solved the issue. Probably it is because those modules are not the original ones — they are bought from Aliexpress.


Commands I am using for communicating with the module with responses:

// Disable echoing of commands
> ATE0
< (nothing because the module was sleeping)

// Put module to normal mode
> AT+CSCLK=0
< OK

// Configure bearer profile
> AT+SAPBR=3,1,Contype,GPRS
< OK

> AT+SAPBR=3,1,APN,internet
< OK

// Configure GPRS context
> AT+SAPBR=1,1
< OK

> AT+SAPBR=2,1
< +SAPBR: 1,1,"***.***.***.***"

// Configure HTTP connection
> AT+HTTPINIT
< ERROR (here lies the problem)

> AT+HTTPPARA=CID,1
< OK

> AT+HTTPPARA=URL,http://example.com/post.php
< OK

> AT+HTTPPARA=CONTENT,application/json
< OK

// Upload 18 bytes of data (the value is dynamically changed based on the data in code) and wait for 10000 ms
> AT+HTTPDATA=18,10000
< DOWNLOAD

> {"example":"JSON"}
< OK

// Send an HTTP POST request
> AT+HTTPACTION=1
< OK

// Terminate HTTP connection
> AT+HTTPTERM
< ERROR (HTTP was not started, so it can not be terminated)

// Close GPRS context
> AT+SAPBR=0,1
< +HTTPACTION: 1,601,0 (the correct response should be "OK")

// Put module to sleep mode
> AT+CSCLK=2
< OK

Do you have any idea what could cause those problems?

BelKed
  • 1
  • 2
  • 1
    "The funny thing is that a friend has the same device with the same code which works for him without any problems." -- This is usually the hallmark of faulty hardware. For example a loose wire or a bad solder joint. – Brick Dec 08 '22 at 18:43
  • @Brick – That's a good idea! I've set up another device, so hopefully, we'll see if that's the case. – BelKed Dec 09 '22 at 14:54
  • Further investigation has shown that when is the device outdoors (maybe it has a good signal there) works like a charm until the battery runs out. A friend has that device also outside (but it was connected with a cable), so that is probably the case. I will continue investigating what is the cause of the problem... – BelKed Dec 12 '22 at 18:42
  • No idea, what's going on, but now the device has been successfully running for about three and a half days... And I haven't changed anything. – BelKed Dec 16 '22 at 19:16
  • I've updated the question with recent discoveries... – BelKed Feb 25 '23 at 16:41

0 Answers0