How to read data from ThingSpeak and control led using sim800L?

34 views (last 30 days)
Su Kyi
Su Kyi on 15 Dec 2020
Edited: Vinod on 21 Sep 2021
I'm working on SIM800L with arduino and try to read data from ThingSpeak. I can read my channel field last value (1 or 0) using AT+HTTPREAD command. But the content get from sim800L.read() is -1 not one or zero. I want to read 1 or 0 and then turn on/off LED. How to get the data of field from the response of AT+HTTPREAD? Please find the code as follows:
{.....
SIM800L.println("AT+HTTPPARA=\"URL\",\"http://api.thingspeak.com/channels/xxxxxxx/fields/3/last?api_key=xxxxxxxxxxxxxx\"");
delay(1000);
ShowSerialData();
SIM800L.println("AT+HTTPACTION=0");
delay(10000);
ShowSerialData();
SIM800L.println("AT+HTTPREAD");
delay(300);
ShowSerialData();
changeled();
ShowSerialData();
SIM800L.println("");
delay(100);
}
void changeled()
{
String content = "";
Serial.println(SIM800L.read());
content = content + String(SIM800L.read());
Serial.print("Content:");
Serial.println(content);
}
  1 Comment
Severin Baumgartner
Severin Baumgartner on 21 Sep 2021
Hello, I have the same problem. How did you finally solve the problem? I would be very happy about help. I despair: D
greetings from Germany

Sign in to comment.

Answers (1)

Vinod
Vinod on 21 Sep 2021
Edited: Vinod on 21 Sep 2021
Is the SIM card activated? Have you confirmed that you can connect to the internet with the SIM800L module and your SIM card? Does your GSM provider support the use of their SIM card in the SIM800L module? See this video.

Communities

More Answers in the  ThingSpeak Community

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by