0
\$\begingroup\$

I am having a bit of uncertainty here updating data on thingspeak using their generated API or may be because of the "AT+CIPSEND" command. Below are steps I followed for the 1st trial:

AT+RST


OK
B1���:6�;�;!G��R��A#�
[System Ready, Vendor:www.ai-thinker.com]
AT+CWMODE?

+CWMODE:1

OK
AT+CIPMUX=1


OK
AT+CIPSTART=0,"TCP","api.thingspeak.com",80


OK
Linked
AT+CIPSEND=0,85

> GET https://api.thingspeak.com/update?api_key=1VMOGPWM9SGJXI5C&field1=77


OK
Unlink

I have been following Kevin Darrah's tutorial Here. When tried the above, the data field does not update.So, 1st trial failed!!!.

But, when I did the below by changing the length of bytes assigned to CIPSEND command with 76, surprisingly the data was updated on thingspeak.

AT+RST


 OK
 �6B�=Cl��1�� �A#�+�A��
 [System Ready, Vendor:www.ai-thinker.com]
 AT+CWMODE?

+CWMODE:1

OK
AT+CIPMUX=1


OK
AT+CIPSTART=4,"TCP","api.thingspeak.com",80


OK
Linked
AT+CIPSEND=4,76

> GET https://api.thingspeak.com/update?api_key=U6PE1HI433A8XPQY&field1=77


SEND OK

+IPD,4,1:1
OK

OK
Unlink

So, the 2nd trial worked!!!.

Again, I did a third trial and this time I changed the length of bytes assigned to the CIPSEND command to 100 as shown below:

 AT+CIPSTART=4,"TCP","api.thingspeak.com",80


 OK
 Linked
 AT+CIPSEND=4,100

> GET https://api.thingspeak.com/update?api_key=U6PE1HI433A8XPQY&field1=46


OK
Unlink

The only difference between the 3 trials is the length of bytes to send, assigned using "AT+CIPSEND". And the data is posted to thingspeak successfully only when the length of bytes is assigned as 76, but did not work when assigned with 85 and 100.I am using Arduino IDE's serial monitor to send these commands with NL&CR enabled.My question is,

Why is it working when CIPSEND is assigned with value of 76 and not for 85 and 100

\$\endgroup\$
0
\$\begingroup\$

Apparently the length of your data:

GET https://api.thingspeak.com/update?api_key=U6PE1HI433A8XPQY&field1=46

is 72 characters, plus \r\n\r\n makes exactly 76 characters. I guess if you specify a longer length in CIPSEND it is expecting more data, and you are being disconnected due to a timeout or something.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.