iot 5
iot 5
Practical - 5
Aim: To Send an SMS Using an ESP8266/NodeMCU
How It Works:
Before creating an API key, understand the predefined SMS template system.
Each template has a unique template ID, template name, and customizable variables (e.g.,
#var#).
In this example, we will use Template ID: 104 for a battery low alert SMS.
The message format includes placeholders (#var#), where values like "GPS TRACKER" and
"20" will be inserted dynamically.
Code :
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>
void sendSMS() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(client, apiUrl);
http.addHeader("Authorization", apiKey);
http.addHeader("Content-Type", "application/json");
// Check response
if (httpResponseCode == 200) {
Serial.println(http.getString());
} else {
Serial.println(httpResponseCode);
} else {
void setup() {
Serial.begin(9600);
WiFi.begin(ssid,password);
Serial.print("Connecting to wifi");
while(WiFi.status() != WL_CONNECTED){
delay(500);
Serial.print(".");
Serial.println("\nConnected!");
sendSMS();
void loop() {
}
Name: Prem Kumar Das En.No.:12202110501075
IOT ARCHITECTURE & PROTOCOLS (202046714)
G..H PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY
Conclusion:
1. The ESP8266 successfully sends an SMS using Circuit Digest Cloud without a
GSM module.
2. This method is simple and effective for IoT applications like sensor alerts,
home automation, or emergency notifications.
3. The Circuit Digest API acts as an intermediary, enabling the ESP8266 to send
SMS over the internet.