Yarana Iot Guru
Published © MIT

4G LTE Module Mastery: Sending Messages

Learn to send SMS & data using 4G LTE modules with Arduino/ESP32. Master LTE messaging for IoT projects — YaranaIoT Guru guide

BeginnerFull instructions provided8 hours34
4G LTE Module Mastery: Sending Messages

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

📄 Arduino Example Code — Sending SMS

C/C++
#include <TinyGsmClient.h>
#include <SoftwareSerial.h>

// Define SoftwareSerial for LTE Module
#define MODEM_RX 10
#define MODEM_TX 9
SoftwareSerial SerialAT(MODEM_RX, MODEM_TX);

// Your SIM PIN (if required)
#define SIM_PIN ""

// Your recipient number
#define PHONE_NUMBER "+911234567890"

// TinyGSM modem object
#include <TinyGsmClient.h>
TinyGsm modem(SerialAT);

void setup() {
  // Start serial communication
  Serial.begin(115200);
  delay(10);

  // Start communication with LTE module
  SerialAT.begin(9600);
  delay(3000);

  Serial.println("Initializing LTE Module...");
  modem.restart();
  Serial.println("LTE Module Ready");

  if (SIM_PIN && SIM_PIN[0] != '\0') {
    modem.simUnlock(SIM_PIN);
  }

  Serial.println("Sending SMS...");
  bool sent = modem.sendSMS(PHONE_NUMBER, "Hello from YaranaIoT Guru LTE Module!");
  if (sent) {
    Serial.println("SMS sent successfully!");
  } else {
    Serial.println("SMS sending failed.");
  }
}

void loop() {
  // Nothing here
}

Credits

Yarana Iot Guru
28 projects • 0 followers
Yarana Iot Guru Yarana IoT Guru: Arduino, ESP32, GSM, NodeMCU & more. Projects, Tutorials & App Development. Innovate with us!
Thanks to YaranaIoT Guru.

Comments