Xiao ESP32C3 A9G GSM, Connecting to blynk.cloud:80 and 8080

My Libraries are at latest version even the boards are already updated.
I am using A9G GSM and GPRS module and Xiao ESP32C3.
I wanted to connect to blynk without using wifi so I used this code below.
I selected A7 as my modem.

/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  ESP32, Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build mobile and web interfaces for any
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: https://www.blynk.io
    Sketch generator:           https://examples.blynk.cc
    Blynk community:            https://community.blynk.cc
    Follow us:                  https://www.fb.com/blynkapp
                                https://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  Attention! Please check out TinyGSM guide:
    https://tiny.cc/tinygsm-readme

  Change GPRS apm, user, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!

 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "*****"
#define BLYNK_TEMPLATE_NAME "*****"
#define BLYNK_AUTH_TOKEN "*****"


// Select your modem:
//#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE

// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30

#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>

// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "gomo.ph";
char user[] = "";
char pass[] = "";

// Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial1

// or Software Serial on Uno, Nano
//#include <SoftwareSerial.h>
//SoftwareSerial SerialAT(2, 3); // RX, TX

TinyGsm modem(SerialAT);

void setup()
{
  // Debug console
  Serial.begin(9600);

  delay(10);

  // Set GSM module baud rate
  SerialAT.begin(9600, SERIAL_8N1, D5, D6);
  delay(3000);

  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
//  modem.restart();
  modem.init();

  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");

  Blynk.begin(BLYNK_AUTH_TOKEN, modem, apn, user, pass);
}

void loop()
{
  Blynk.run();
}

But the output is like this

Please help me thank you!

When you post serial output to the forum please copy the text from your serial monitor and paste it between triple backticks, the same way you do for code.

I have no idea whether TinyGSM supports your modem, but I didn’t think that the Serial1 pins were available on the Xiao ESP32C3.
How have you connected your modem to the ESP32C3 ?

Pete.

I just connected it Tx to Rx and Rx to Tx. No other connection since my goal is only to connect it to blynk

Rx & Tx are the serial connection, which you are using for debugging. The software is trying to talk to the modem on Serial1, which is different.

Pete.

Then how should I connect it then? That’s the only way I know how to connect any gsm module into microcontroller. Thank you!

Or is there a way to use blynk without using the library? Just using only AT commands like http post and get?

You should read this if you want to learn more…

Personally, I think you’ve chosen the wrong type of board, and as I said before, I’m not sure about the type of GSM modem either.

Pete.

1 Like