Blynk C Programming for Cellular Modules With OpenCPU

Hey Fellow Blynk’ers

I have reviewed the various communities and forums around C Program examples and all seems to point to C++, Python and NodeJS, I have reviewed a few cellular modules available in the market place and having spent some time working on the OpenCPU (application runs on the module - Like Python on the ESP32) the integration and device cost is quote competitive as a finished product.

So my request is simple, anyone with example c code for Blynk would be great and am happy to share the library once tested and cleaned up. I will be working with NB-IoT modules for now.

Any code that you have will help, thanks in advance

Ok, so no takers here yet…

Any input on here is appreciated, I have reviewed the ‘TinyGSM’ files online and have found some info and found the following sequence (SIM800):

  • Initialise the module → Check SIM Pin and APN and and and…

This is where I seem to be missing something

  • Configure DNS Server Address = “”,“” (is this correct?)
  • Open the Connection = “TCP”,“”,8442
    → found the “ny3” at the bottom of my web portal dashboard so used that server
    → 8442 is the default Port (according to SIM800 TinyGSM)
    → 8443 is secure Port (according to SIM800 TinyGSM)
    → “” found IP Address:, anyone know if this is static or dynamic?

When I try these settings, I get a “Socket connection failed(code 566)” response, tried both default and secure ports, when I use the domain name.

When I try connect with the IP address, I get an “Open URC” and then 15mS later the “closed” URC is issued, so the connection is closed from the server side.

Here is my AT command log with time stamp, any comments welcome:




[2021-12-13_14:50:07:120]+CPIN: READY


[2021-12-13_14:50:09:457]+CEREG: 0,5


[2021-12-13_14:50:13:116]+CFUN: 1


[2021-12-13_14:50:14:219]+COPS: 0,2,“65501”,9


[2021-12-13_14:50:18:939]+CGATT: 1



[2021-12-13_14:50:34:711]+CSCON: 1
[2021-12-13_14:50:34:928]+QIOPEN: 0,566


[2021-12-13_14:50:40:596]CLOSE OK

[2021-12-13_14:50:45:124]+QIOPEN: 1,0
[2021-12-13_14:50:45:625]+QIURC: “closed”,1

As you discovered with your other testing, the port is 443…

Blynk has a number of servers around the world, and your account/project only lives on one of them. In your case that’s the New York server.

Using the url obviously leaves you at the mercies of the DNS service that you happen to be using at the time, but Blynk instituted some clever processing to automatically re-route your connection to the correct server. However, this doesn’t work with HTTP(S) API calls, so you need to specify the correct server when making these calls.
Personally, I’d stick with url as it’s not beyond the realms of possibility that the IP address may change in future.


So discovered that on NB-IoT the connection is disconnected by the server side… not sure why

When I use LTE Cat1/2G I get a connect OK.

Any ideas on how to send the data packet?

I get the following "hex’ values back, which is 7 characters as opposed to 5.
15 03 01 00 02 02 46

These are the special characters:
Which equate to in hex: 1D 00 01 00 (MSG_HW_LOGIN NUL ID NUL)

Below AT Log

[2021-12-13_18:05:31:165]+QIACT: 1,1,1,“”




[2021-12-13_18:05:39:018]+QIOPEN: 0,0

[2021-12-13_18:05:41:864]> 5Ut4chLSRJ0Y8OUOmCcEW2inXYlEIYDO
[2021-12-13_18:05:44:021]SEND OK
[2021-12-13_18:05:44:305]+QIURC: “recv”,0,7

[2021-12-13_18:05:44:305]+QIURC: “closed”,0