The use of the ESP8266 in the world of IoT

User avatar
By pete_l
#13965 My intended use for an ESP8266 is in a battery and/or solar powered proximity detector. Briefly, it is designed to report "hits" from a PIR to show when there is a person (or animal) in the vicinity. It will be powered from an internal battery that is charged from a small solar panel.

I have the prototype Arduino and ESP8266 working. To conserve power I am asserting /CH_PD until a PIR event is detected. The 8266 is then enabled and should report the event to a server.

What I find is that the 8266 takes about 6 seconds to reacquire the AP it was previously connected to and then to establish a TCP connection and send its payload. Now I know that with the v0.94 I have on the 8266 it "remembers" the AP and IP address, so I was expecting the device to be ready to send (after re-enabling it) in a very short time - not the 6 seconds it takes.

Any ideas or suggestions from people who've got the device to work faster would be very welcome. Here's a log of the events and times I get. The first number (XXXXXmS) is the elapsed time the Arduino has been running from the millis() function. The next number in brackets is the time period since the last debug() call was made. "resp" is the number of characters read from the 8266 after sending it a command.

Code: Select all*** Debug buffer 658 chars. 0 overflows

36199mS (30187)  *** Wake 8266

 resp= -1

36558mS (358) join_ap After CIPMUX  resp= 20
AT+CIPMUX=0

OK

39716mS (3156) join_ap() after CWJAP resp= 32
AT+CWJAP="cueva-net",""

OK

42633mS (2916) connect_tcp() resp= 45
AT+CIPSTART="TCP","corv",80
CONNECT

OK
42679mS get_status:
42680mS 0,"TCP","192.168.1.40",80,0

42681mS (47) TCP Connected?  resp= 71
AT+CIPSTATUS
STATUS:3
+CIPSTATUS:0,"TCP","192.168.1.40",80,0

OK

42716mS (35) Command length resp= 19
AT+CIPSEND=102
>
GET 8266-data.php?id=8266&loop=0&apms=3156&tcpms=84&temp=20.0&humid=40.0&light=565&prox=0 HTTP/1.0busy s...

SEND OK

+IPD,242:HTTP/1.0 200 OK
X-Powered