HTTP server response error [SOLVED]

Hi, this is my first post, I’ve been playing around with the Blynk platform any trying features with the GSM module I’ve been using, and it works really well and there’s a lot that I like.

However I seem to have a problem when it comes to integrating it into my project.
A little background info… I’m using an arduino board with a SIM800L GSM module to send data to a client server through using HTTP. I’m using the “TinyGSMClient” and “ArduinoHTTPClient” to handle most of the work, and all is fine as is. Now when I add the Blynk code, which I’m doing to add smartphone control, I get an HTTP timed out error code -3. This happens whether I trigger the data send with the button on the device or through the Blynk app. Although the data seems to still send to the server that I’m posting to, but my arduino program freezes after the -3 error code. Also, I’m using the Blynk Cloud server and library version 0.6.1.

I can’t post all my code since it’s way too long but hopefully my setup gives more insight as that may be what’s causing my problems

#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
#include <ArduinoHttpClient.h>
TinyGsmClient client(modem);       // Creates GSM Client using my SIM800L modem
HttpClient http(client, server, port);  // my server client that I'm sending data to
void setup() {
Blynk.begin(auth, modem, auth, user, pass);
// In the main loop I do a http get call that publishes data successfully without the blynk code 
// but generates the above described error when the blybk code is added 

Your void loop would probably provide more insight into the issue.


Thanks for the quick reply, my loop function might be a bit too vague but here it is:

void loop() 
  // Keep updating the Tickers
  digitalWrite(ProfilePin, HIGH);
  digitalWrite(ProfilePin, LOW);

I’m using the Ticker library to set a couple functions on timed execution, none of the GSM communications though. The code may be more convoluted that needs to be but I’m trying to find a good program flow with a menu system and different processes.
To elaborate a bit more, I have this code here that runs in the data publishing function:

  SerialMon.print(F("Performing HTTP GET request... "));
  int err = http.get(resource);
  if (err != 0) {
    SerialMon.println(F("failed to connect"));

  int status = http.responseStatusCode();
  if (!status) {

where resource is a char array that contains data which is added to the http client server url.
Interestingly that “failed to connect” is never run which I guess explains why the data still publishes. The -3 timeout code is reported by that http.responseStatusCode(); function but I have no idea why I would suddenly not be able to get a response. The only thing that I can think of is that my connection to the Blynk server is somehow interfering? In which case I should maybe sever the blynk server connection before running this section of code? but then again I also don’t know how to do that and I have looked through the documentation and library, maybe I’m missing something?

you have a big problem because void loop must be like this :

void loop()

and delay are not allowed , it blocks running code and you’ll get timeout or heartbeat issues, or WDT reset.

Read this:



Ok so after being stuck for a while with this I’ve finally fixed my problem. I’m no longer using the above function that has the delays. I should mention that I did reduce my loop to what you suggested and that introduced a few problems probably blocking code like you said and certain things causing timeouts or maybe it was the concatenated timers. Anyways I went back to my sort of bloated loop and put the function on it’s own timer. What actually got my data publishing to work was using the webhook widget which I wasn’t very familiar with when I started this thread and now everything is running fine. Probably not optimally but it works. Thanks for the suggestion and I appreciate the help.

Read through, very useful, thanks.