Sending real-time alerts from your electronics projects has become an essential part of modern IoT systems. Whether it’s monitoring distance, detecting motion, or tracking environmental data, getting instant updates on your phone makes projects far more useful.
In this project we Send WhatsApp Messages using Arduino, without using a GSM module or complex APIs. Instead of dealing with SIM cards or expensive integrations, this method uses CircuitDigest Cloud WhatsApp API, allowing your Arduino to send messages over WiFi using a simple HTTPS request.
What This Project Does
The idea is simple. The Arduino reads data from a sensor, checks a condition, and sends that data to the cloud. The cloud then converts it into a proper WhatsApp message and delivers it instantly.
To demonstrate this, we use an HC-SR04 ultrasonic sensor. When an object comes closer than a defined distance (for example, 20 cm), the Arduino sends the distance value to the cloud, which then triggers a WhatsApp alert.
This setup creates a real-time proximity alert system that can be used for safety, automation, or monitoring applications.
Components Required
The hardware setup is minimal and beginner-friendly:
- Arduino UNO R4 WiFi
- HC-SR04 Ultrasonic Sensor
- Breadboard
- Jumper Wires
- USB Cable
The UNO R4 WiFi is important here because it has built-in WiFi capability, allowing direct internet communication.
How the System Works
The workflow is straightforward and happens in a loop.
First, the Arduino connects to your local WiFi network. Once connected, it continuously reads distance values from the ultrasonic sensor.
When the measured distance crosses a predefined limit, the Arduino prepares a small JSON payload. This payload includes details like your phone number, template ID, and sensor value.
The Arduino then sends this data securely to the cloud using an HTTPS POST request.
From there, CircuitDigest Cloud takes over. It verifies your API key, formats the message using a pre-approved WhatsApp template, and sends it to your registered phone number.
The key advantage here is that Arduino doesn’t directly talk to WhatsApp. The cloud handles all the complex parts like authentication, formatting, and delivery.
Circuit Connections
The wiring is very simple and requires only four connections:
- VCC → 5V
- GND → GND
- TRIG → Digital Pin 9
- ECHO → Digital Pin 10
Once connected, the ultrasonic sensor can measure distances from about 2 cm up to 4 meters.
Arduino Code Overview
The code handles three main tasks: WiFi connection, sensor reading, and API communication.
First, the Arduino connects to WiFi using your network credentials. Then, it continuously triggers the ultrasonic sensor and calculates distance based on the echo time.
If the distance goes below the threshold, the code checks a cooldown timer to avoid sending too many messages. If allowed, it sends a request to the cloud API.
The payload includes dynamic values like the measured distance, which gets inserted into a WhatsApp message template automatically.
Testing the System
Once the code is uploaded, open the Serial Monitor to verify WiFi connection and sensor readings.
Place an object close to the sensor. When the distance drops below the set limit, a WhatsApp message will be sent instantly to your phone.
The message typically includes:
- Device name
- Event type (e.g., intrusion detected)
- Measured distance
- Location
The cooldown feature ensures that repeated alerts are not sent continuously.
Real-World Applications
This project can be extended into many practical use cases:
- Intrusion detection systems
- Smart parking alerts
- Industrial safety monitoring
- Home automation notifications
- Distance-based automation triggers
Since it uses WiFi instead of GSM, it’s cost-effective and easy to scale.
Conclusion
This Send WhatsApp Messages using Arduino is a great example of how IoT projects can be made smarter with cloud integration. By offloading complex messaging tasks to the cloud, the Arduino only focuses on collecting and sending data.
The result is a simple, reliable, and efficient system that delivers real-time alerts directly to your phone. With just a few components and minimal setup, you can add instant WhatsApp notifications to almost any Arduino project.
Robotics Projects |Arduino Projects | Raspberry Pi Projects|
ESP32 Projects | AI Projects | IoT Projects | Drone projects