Comments on: ESP32: Send Messages to WhatsApp using SIM Card – LILYGO T-SIM7000G https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 10 Mar 2025 15:22:53 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Dualvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015342 Mon, 10 Mar 2025 15:22:53 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015342 Palo, try my email dualcoforado@uol.com.br.

]]>
By: Eduardo https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015339 Mon, 10 Mar 2025 15:20:42 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015339 Paolo, try here: github.com/dualvim/ESP32_TSIM70XX_WhatsApp

]]>
By: Paolo https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015329 Mon, 10 Mar 2025 14:38:38 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015329 In reply to DuAlvim.

Ciao DuAlvim perchè è stato rimosso , sono disperato e aspetto una speranza per risolvere il problema. Potresti gentilemente ripubblicare il codice che risolve il problema e chiedere gentilmente a Rui e Sara di farlo pubblicare. Grazie.

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015148 Mon, 10 Mar 2025 01:08:45 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015148 /*
* –> Sketch_Paolo.ino
* Thanks Dualvim for your availability.
* I am in Italy my telephone company is ‘coopvoce’.
* I am using a LILYGO A7670G card that seems perfectly compatible. I attach some excerpts of the source.
* Thanks again for your help.
*/

/*
** –> CoopVoce Parameters: https://apn.how/it/web-coopvoce/asus-zenfone-4
** – apn[]: “internet.coopvoce.it”
** – gprsUser[]: “” // Should be none
** – gprsPass[]: “” // Should be none
**
** –> GSM_PIN:
** – Look for the default pin in the verse of the card which came with your GSM chip.
** – I tryed “0000” or “”. It didn’t work with my chip
**
** –> Selected board: ‘Esp32 Wrover Module’
**
** –> Github TSIM 7600X: https://github.com/Xinyuan-LilyGO/T-SIM7600X
** –> https://github.com/Xinyuan-LilyGO/T-SIM7600X/blob/master/examples/ATdebug/ATdebug.ino
*/

// Select your modem
// #define TINY_GSM_MODEM_SIM7000SSL // –> Probably the problem is here
#define TINY_GSM_MODEM_SIM7600 // –> Use this and check the pinout below
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb

//#define TINY_GSM_MODEM_SIM7600 // suggerimento Dualvim

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial
#define SerialAT Serial1

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <UrlEncode.h>

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
// #define LOGGING // <- Logging is for the HTTP library

// Add a reception delay, if needed.
// This may be needed for a fast processor at a slow baud rate.
// #define TINY_GSM_YIELD() { delay(2); }

// set GSM PIN, if any
// #define GSM_PIN “0000” // –> You put this
#define GSM_PIN “8486” // Vivo’s (BR) default PIN

// flag to force SSL client authentication, if needed
// #define TINY_GSM_SSL_CLIENT_AUTHENTICATION

// Set your APN Details / GPRS credentials
//const char apn[] = “internet.coopvoce.it”;
//const char gprsUser[] = “”;
//const char gprsPass[] = “”;
// Vivo – BR
const char apn[] = “zap.vivo.com.br”;
const char gprsUser[] = “vivo”;
const char gprsPass[] = “vivo”;

// Server details
const char server[] = “api.callmebot.com”;
//const int port = 443;
const int port = 80;

// The phone number should be in international format (including the + sign)
//String phone_number = “+34684723962”;
//String phone_number = “+393286673687”; // –> Your cell phene
String phone_number = “+5527997824908”;

//String api_key = “1536749”; // –> Don’t show this
String api_key = “”;

TinyGsm modem(SerialAT);

TinyGsmClient client(modem); // –> Also, I changed here
HttpClient http(client, server, port);

// LilyGo T-SIM7670 Pinout: https://randomnerdtutorials.com/lilygo-ttgo-t-a7670g-a7670e-a7670sa-esp32/
#define UART_BAUD 115200
#define PIN_DTR 25
#define PIN_TX 26
#define PIN_RX 27
// The modem boot pin needs to follow the startup sequence.
#define PWR_PIN 4
#define BAT_ADC 35
// The modem power switch must be set to HIGH for the modem to supply power.
#define LED_PIN 12
#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13

void modemPowerOn(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1000);
digitalWrite(PWR_PIN, HIGH);
}

void modemPowerOff(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1500);
digitalWrite(PWR_PIN, HIGH);
}

void modemRestart(){
modemPowerOff();
delay(1000);
modemPowerOn();
}

void setup() {
// Set Serial Monitor baud rate
SerialMon.begin(115200);
delay(10);

// Set LED OFF
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);

modemPowerOn();

SerialMon.println("Wait…");

// Set GSM module baud rate and Pins
SerialAT.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);
delay(6000);

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

String modemInfo = modem.getModemInfo();
SerialMon.print("Modem Info: ");
SerialMon.println(modemInfo);

// Unlock your SIM card with a PIN if needed
if (GSM_PIN && modem.getSimStatus() != 3) {
modem.simUnlock(GSM_PIN);
}

Serial.println("Make sure your LTE antenna has been connected to the SIM interface on the board.");
delay(10000);

}

void loop() {
modem.gprsConnect(apn, gprsUser, gprsPass);

SerialMon.print("Waiting for network…");
if (!modem.waitForNetwork()) {
SerialMon.println(" fail");
delay(10000);
return;
}
SerialMon.println(" success");

if (modem.isNetworkConnected()) {
SerialMon.println("Network connected");
}

String message = "Hello from ESP32!";
String url_callmebot = "/whatsapp.php?phone=" + phone_number + "&apikey=" + api_key + "&text=" + urlEncode(message);

SerialMon.print(F("Performing HTTPS GET request… "));
http.connectionKeepAlive(); // Currently, this is needed for HTTPS

int err = http.get(url_callmebot);
if (err != 0) {
SerialMon.println(F("failed to connect"));
delay(10000);
return;
}

int status = http.responseStatusCode();
SerialMon.print(F("Response status code: "));
SerialMon.println(status);
if (!status) {
delay(10000);
return;
}

SerialMon.println(F("Response Headers:"));
while (http.headerAvailable()) {
String headerName = http.readHeaderName();
String headerValue = http.readHeaderValue();
SerialMon.println(" " + headerName + " : " + headerValue);
}

int length = http.contentLength();
if (length >= 0) {
SerialMon.print(F("Content length is: "));
SerialMon.println(length);
}
if (http.isResponseChunked()) {
SerialMon.println(F("The response is chunked"));
}

String body = http.responseBody();
SerialMon.println(F("Response:"));
SerialMon.println(body);

SerialMon.print(F("Body length is: "));
SerialMon.println(body.length());

// Shutdown
http.stop();
SerialMon.println(F("Server disconnected"));

modem.gprsDisconnect();
SerialMon.println(F("GPRS disconnected"));

// Do nothing forevermore
while (true) {
delay(1000);
}

}

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015142 Mon, 10 Mar 2025 00:39:12 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015142 In reply to Paolo.

I posted here the code fixing the problem, but it have been removed.

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015081 Sun, 09 Mar 2025 19:00:09 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015081 In reply to Paolo.

Hi Paolo,
I Looked the code and I heve some hints to help you:
1 – A good post posted on this site, which uses the LiliGo 7670 is: https://randomnerdtutorials.com/lilygo-ttgo-t-a7670g-a7670e-a7670sa-esp32/

2 – Site with full documentation of the LiliyGo 7600X (7670 includsed): https://github.com/Xinyuan-LilyGO/T-SIM7600X/tree/master

3 – A good example to test is: https://github.com/Xinyuan-LilyGO/T-SIM7600X/blob/master/examples/ATdebug/ATdebug.ino

4 – Also, change the line ‘TinyGsmClientSecure client(modem);’ for ‘TinyGsmClient client(modem);’.

4 – The code below worked here, despite the fact I’m using a LilyGo7608 here.
That’s it. the problem was just on some details. I belive that it will work for you, just don’t forget to change the parameters from my phone operator for your phone operator.

”’
/*
** –> CoopVoce Parameters: https://apn.how/it/web-coopvoce/asus-zenfone-4
** – apn[]: “internet.coopvoce.it”
** – gprsUser[]: “” // Should be none
** – gprsPass[]: “” // Should be none
**
** –> GSM_PIN:
** – Look for the default pin in the verse of the card which came with your GSM chip.
** – I tryed “0000” or “”. It didn’t work with my chip
**
** –> Selected board: ‘Esp32 Wrover Module’
**
** –> Github TSIM 7600X: https://github.com/Xinyuan-LilyGO/T-SIM7600X
** –> https://github.com/Xinyuan-LilyGO/T-SIM7600X/blob/master/examples/ATdebug/ATdebug.ino
*/

// Select your modem
// #define TINY_GSM_MODEM_SIM7000SSL // –> Probably the problem is here
#define TINY_GSM_MODEM_SIM7600 // –> Use this and check the pinout below
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb

//#define TINY_GSM_MODEM_SIM7600 // suggerimento Dualvim

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial
#define SerialAT Serial1

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <UrlEncode.h>

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
// #define LOGGING // <- Logging is for the HTTP library

// Add a reception delay, if needed.
// This may be needed for a fast processor at a slow baud rate.
// #define TINY_GSM_YIELD() { delay(2); }

// set GSM PIN, if any
// #define GSM_PIN “0000” // –> You put this
#define GSM_PIN “8486” // Vivo’s (BR) default PIN

// flag to force SSL client authentication, if needed
// #define TINY_GSM_SSL_CLIENT_AUTHENTICATION

// Set your APN Details / GPRS credentials
//const char apn[] = “internet.coopvoce.it”;
//const char gprsUser[] = “”;
//const char gprsPass[] = “”;
// Vivo – BR
const char apn[] = “zap.vivo.com.br”;
const char gprsUser[] = “vivo”;
const char gprsPass[] = “vivo”;

// Server details
const char server[] = “api.callmebot.com”;
//const int port = 443;
const int port = 80;

// The phone number should be in international format (including the + sign)
//String phone_number = “+34684723962”;
//String phone_number = “+393286673687”; // –> Your cell phene
String phone_number = “+5527997824908”;

//String api_key = “1536749”; // –> Don’t show this
String api_key = “”;

TinyGsm modem(SerialAT);

TinyGsmClient client(modem); // –> Also, I changed here
HttpClient http(client, server, port);

// LilyGo T-SIM7670 Pinout: https://randomnerdtutorials.com/lilygo-ttgo-t-a7670g-a7670e-a7670sa-esp32/
#define UART_BAUD 115200
#define PIN_DTR 25
#define PIN_TX 26
#define PIN_RX 27
// The modem boot pin needs to follow the startup sequence.
#define PWR_PIN 4
#define BAT_ADC 35
// The modem power switch must be set to HIGH for the modem to supply power.
#define LED_PIN 12
#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13

void modemPowerOn(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1000);
digitalWrite(PWR_PIN, HIGH);
}

void modemPowerOff(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1500);
digitalWrite(PWR_PIN, HIGH);
}

void modemRestart(){
modemPowerOff();
delay(1000);
modemPowerOn();
}

void setup() {
// Set Serial Monitor baud rate
SerialMon.begin(115200);
delay(10);

// Set LED OFF
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);

modemPowerOn();

SerialMon.println("Wait…");

// Set GSM module baud rate and Pins
SerialAT.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);
delay(6000);

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

String modemInfo = modem.getModemInfo();
SerialMon.print("Modem Info: ");
SerialMon.println(modemInfo);

// Unlock your SIM card with a PIN if needed
if (GSM_PIN && modem.getSimStatus() != 3) {
modem.simUnlock(GSM_PIN);
}

Serial.println("Make sure your LTE antenna has been connected to the SIM interface on the board.");
delay(10000);

}

void loop() {
modem.gprsConnect(apn, gprsUser, gprsPass);

SerialMon.print("Waiting for network…");
if (!modem.waitForNetwork()) {
SerialMon.println(" fail");
delay(10000);
return;
}
SerialMon.println(" success");

if (modem.isNetworkConnected()) {
SerialMon.println("Network connected");
}

String message = "Hello from ESP32!";
String url_callmebot = "/whatsapp.php?phone=" + phone_number + "&apikey=" + api_key + "&text=" + urlEncode(message);

SerialMon.print(F("Performing HTTPS GET request… "));
http.connectionKeepAlive(); // Currently, this is needed for HTTPS

int err = http.get(url_callmebot);
if (err != 0) {
SerialMon.println(F("failed to connect"));
delay(10000);
return;
}

int status = http.responseStatusCode();
SerialMon.print(F("Response status code: "));
SerialMon.println(status);
if (!status) {
delay(10000);
return;
}

SerialMon.println(F("Response Headers:"));
while (http.headerAvailable()) {
String headerName = http.readHeaderName();
String headerValue = http.readHeaderValue();
SerialMon.println(" " + headerName + " : " + headerValue);
}

int length = http.contentLength();
if (length >= 0) {
SerialMon.print(F("Content length is: "));
SerialMon.println(length);
}
if (http.isResponseChunked()) {
SerialMon.println(F("The response is chunked"));
}

String body = http.responseBody();
SerialMon.println(F("Response:"));
SerialMon.println(body);

SerialMon.print(F("Body length is: "));
SerialMon.println(body.length());

// Shutdown
http.stop();
SerialMon.println(F("Server disconnected"));

modem.gprsDisconnect();
SerialMon.println(F("GPRS disconnected"));

// Do nothing forevermore
while (true) {
delay(1000);
}

}
”’

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015058 Sun, 09 Mar 2025 17:25:02 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015058 In reply to DuAlvim.

Sorry, I said that I’m using the LilyGo 7670. No I’m Using the Lilygo A7608. Maybe the problem you’re facing is just a slight detail.

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1015055 Sun, 09 Mar 2025 17:17:40 +0000 https://randomnerdtutorials.com/?p=147991#comment-1015055 In reply to Paolo.

Ok Paolo,
I’m going to check your code right now. I’m copying it now and I’ll try to reply this today. One point at your side is that I’m using the same board that you’re using.

]]>
By: Paolo https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1014986 Sun, 09 Mar 2025 11:26:39 +0000 https://randomnerdtutorials.com/?p=147991#comment-1014986 In reply to DuAlvim.

Thanks Dualvim for your availability. I am in Italy my telephone company is coopvoce. I am using a LILYGO A7670G card that seems perfectly compatible. I attach some excerpts of the source.
Thanks again for your help.
// Select your modem
#define TINY_GSM_MODEM_SIM7000SSL
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb

//#define TINY_GSM_MODEM_SIM7600 // suggerimento Dualvim

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial
#define SerialAT Serial1

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <UrlEncode.h>

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
// #define LOGGING // <- Logging is for the HTTP library

// Add a reception delay, if needed.
// This may be needed for a fast processor at a slow baud rate.
// #define TINY_GSM_YIELD() { delay(2); }

// set GSM PIN, if any
#define GSM_PIN “0000”

// flag to force SSL client authentication, if needed
// #define TINY_GSM_SSL_CLIENT_AUTHENTICATION

// Set your APN Details / GPRS credentials
const char apn[] = “internet.coopvoce.it”;
const char gprsUser[] = “”;
const char gprsPass[] = “”;

// Server details
const char server[] = “api.callmebot.com”;
const int port = 443;
//const int port = 80;

// The phone number should be in international format (including the + sign)
//String phone_number = “+34684723962”;
String phone_number = “+393286673687”;
String api_key = “1536749”;

TinyGsm modem(SerialAT);

TinyGsmClientSecure client(modem);
HttpClient http(client, server, port);

// LilyGO T-SIM7000G Pinout
#define UART_BAUD 115200
#define PIN_DTR 25
#define PIN_TX 27
#define PIN_RX 26
#define PWR_PIN 4

#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13
#define LED_PIN 12

void modemPowerOn(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1000);
digitalWrite(PWR_PIN, HIGH);
}

void modemPowerOff(){
pinMode(PWR_PIN, OUTPUT);
digitalWrite(PWR_PIN, LOW);
delay(1500);
digitalWrite(PWR_PIN, HIGH);
}

void modemRestart(){
modemPowerOff();
delay(1000);
modemPowerOn();
}

void setup() {
// Set Serial Monitor baud rate
SerialMon.begin(115200);
delay(10);

// Set LED OFF
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);

modemPowerOn();

SerialMon.println(“Wait…”);

// Set GSM module baud rate and Pins
SerialAT.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);
delay(6000);

// Restart takes quite some time
// To skip it, call init() instead of restart()
SerialMon.println(“Initializing modem…”);
modem.restart();
// modem.init();

String modemInfo = modem.getModemInfo();
SerialMon.print(“Modem Info: “);
SerialMon.println(modemInfo);

// Unlock your SIM card with a PIN if needed
if (GSM_PIN && modem.getSimStatus() != 3) {
modem.simUnlock(GSM_PIN);
}

Serial.println(“Make sure your LTE antenna has been connected to the SIM interface on the board.”);
delay(10000);
}

void loop() {
modem.gprsConnect(apn, gprsUser, gprsPass);

SerialMon.print(“Waiting for network…”);
if (!modem.waitForNetwork()) {
SerialMon.println(” fail”);
delay(10000);
return;
}
SerialMon.println(” success”);

if (modem.isNetworkConnected()) {
SerialMon.println(“Network connected”);
}

String message = “Hello from ESP32!”;
String url_callmebot = “/whatsapp.php?phone=” + phone_number + “&apikey=” + api_key + “&text=” + urlEncode(message);

SerialMon.print(F(“Performing HTTPS GET request… “));
http.connectionKeepAlive(); // Currently, this is needed for HTTPS

int err = http.get(url_callmebot);
if (err != 0) {
SerialMon.println(F(“failed to connect”));
delay(10000);
return;
}

int status = http.responseStatusCode();
SerialMon.print(F(“Response status code: “));
SerialMon.println(status);
if (!status) {
delay(10000);
return;
}

SerialMon.println(F(“Response Headers:”));
while (http.headerAvailable()) {
String headerName = http.readHeaderName();
String headerValue = http.readHeaderValue();
SerialMon.println(” ” + headerName + ” : ” + headerValue);
}

int length = http.contentLength();
if (length >= 0) {
SerialMon.print(F(“Content length is: “));
SerialMon.println(length);
}
if (http.isResponseChunked()) {
SerialMon.println(F(“The response is chunked”));
}

String body = http.responseBody();
SerialMon.println(F(“Response:”));
SerialMon.println(body);

SerialMon.print(F(“Body length is: “));
SerialMon.println(body.length());

// Shutdown
http.stop();
SerialMon.println(F(“Server disconnected”));

modem.gprsDisconnect();
SerialMon.println(F(“GPRS disconnected”));

// Do nothing forevermore
while (true) {
delay(1000);
}
}

]]>
By: DuAlvim https://randomnerdtutorials.com/esp32-send-messages-whatsapp-sim7000g/#comment-1014661 Sat, 08 Mar 2025 14:37:35 +0000 https://randomnerdtutorials.com/?p=147991#comment-1014661 In reply to Paolo.

Can you show the code Paolo? Most of the times these errors come from little details. Also, tell some details about the board and the cell phone company which you want to connect. I don’t know if I can help, but I can try.

]]>