A modern, Wi-Fi-based SMS alert system that monitors temperature using a DHT11 sensor and sends real-time alerts to your phone - no GSM modules or SIM cards required.
This project creates a temperature monitoring system using a Raspberry Pi that sends SMS alerts when temperature thresholds are exceeded. The system uses the Circuit Digest Cloud API to send messages over Wi-Fi, making it simple and cost-effective compared to traditional GSM-based solutions.
Key Features:
- Real-time temperature monitoring with DHT11 sensor
- Wi-Fi-based SMS alerts (no SIM card needed)
- Visual feedback with LED indicators
- Configurable temperature thresholds
- Anti-spam cooldown mechanism
- Easy setup and deployment
Component | Quantity |
---|---|
Raspberry Pi (any model 3,4,5) | 1 |
DHT11 Temperature Sensor | 1 |
220Ω Resistors (for LEDs) | 1 |
LEDs (Red, Green) | 2 |
Breadboard & Jumper Wires | As needed |
- Install latest Raspberry Pi OS using the official Raspberry Pi Imager
- Connect to internet (Wi-Fi or Ethernet)
- Update system packages:
sudo apt update && sudo apt upgrade -y
Due to PEP 668 restrictions on newer Raspberry Pi OS versions, you have two installation options:
Option 1: Override system packages (quick but not recommended)
sudo pip3 install --break-system-packages Adafruit_DHT requests
Option 2: Virtual environment (recommended)
sudo apt install python3-venv -y
python3 -m venv myenv
source myenv/bin/activate
pip install Adafruit_DHT requests
- Visit Circuit Digest Cloud
- Click "Login" → "Register Now" for new users
- Complete registration with email, username, and password
- Log in with your credentials
- Navigate to "My Account" in the top-right corner
- Complete the captcha verification
- Click "Generate API Key"
- Copy your API key for use in the code
Important: You must verify your mobile number using OTP authentication before receiving SMS alerts. This prevents spam and ensures authorized usage.
- SMS API Keys: 100 requests per key
- Generate new keys when quota is exhausted
- Fair use policy applies
- DHT11 Sensor: GPIO4 (Pin 7)
- Green LED: GPIO23 (Pin 16)
- Red LED: GPIO24 (Pin 18)
- Ground: Connect all ground pins to common ground rail
The system uses template ID 102
for temperature alerts:
Template 102 - Temperature Alert:
The temperature in {#var1#} has reached {#var2#}°C. Please take necessary action.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
Variables:
var1
: Location and timestamp (e.g., "Home at 02:45 PM")var2
: Temperature value (e.g., "34")
Update the following variables in the code:
API_KEY = 'your_api_key_here' # Your Circuit Digest API Key
TEMPLATE_ID = '102' # Temperature alert template
MOBILE_NUMBER = '91xxxxxxxxxx' # Target mobile number with country code
LOCATION = 'Home' # Location label for SMS
TEMP_THRESHOLD = 33 # °C: Trigger SMS if temp exceeds this
READ_INTERVAL = 10 # Seconds between sensor reads
COOLDOWN_TIME = 60 # Seconds to wait after sending SMS
-
Navigate to project directory:
cd /path/to/your/project
-
Activate virtual environment (if using):
source myenv/bin/activate
-
Run the monitoring script:
python3 sms_alert_system.py
-
Monitor output:
Monitoring temperature... (Press Ctrl+C to stop) Temperature: 25C | Humidity: 45% Temperature: 35C | Humidity: 50% [OK] SMS sent: Home at 02:45 PM, Temp = 35C
- Continuously monitors temperature every 10 seconds
- Displays temperature and humidity readings
- Green LED blinks when SMS is sent successfully
- Red LED blinks when SMS sending fails
- SMS sent when temperature exceeds threshold (default: 33°C)
- 60-second cooldown prevents spam alerts
- Visual feedback via LED indicators
- Sensor read failures are logged and retried
- Network connection errors trigger red LED
- Graceful shutdown with Ctrl+C
Problem | Solution |
---|---|
SMS not received | Ensure mobile number is verified in Circuit Digest account |
Library install fails | Use --break-system-packages or create virtual environment |
Network timeout | Check internet connection with ping www.google.com |
GPIO pins don't respond | Verify pin numbers (BCM vs physical numbering) |
Sensor read errors | Normal for DHT11 - system retries automatically |
- Heat the sensor with warm air or hair dryer
- Watch console output for temperature readings
- Verify SMS delivery when threshold is exceeded
- Check LED feedback for success/failure indication
We welcome contributions and would love to see how you use this system! Feel free to:
- Submit bug reports and feature requests
- Share your project implementations
- Suggest new SMS templates
- Improve documentation
Happy Building! 🎉