loRa(LOng Range)Alert System(IoT Projects Arduino)
The IoT Projects Arduino LoRa (Long Range) Alert System is a wireless communication system designed to facilitate long-distance, low-power data transmission. In this project, two LoRa modules are employed in distinct locations, with one module acting as a transmitter and the other as a receiver. The system is engineered to send alerts or messages across large distances with minimal power consumption, making it ideal for remote monitoring and alerting applications. This IoT Projects Arduino documentation provides a comprehensive overview of the system's use, importance, operational principles, components, pin configurations, libraries used, working mechanism, main loop, notification function, and testing procedures.
Project : 49
Introduction
The IoT Projects Arduino LoRa (Long Range) Alert System is a wireless communication system designed to facilitate long-distance, low-power data transmission. In this project, two LoRa modules are employed in distinct locations, with one module acting as a transmitter and the other as a receiver. The system is engineered to send alerts or messages across large distances with minimal power consumption, making it ideal for remote monitoring and alerting applications. This IoT Projects Arduino documentation provides a comprehensive overview of the system's use, importance, operational principles, components, pin configurations, libraries used, working mechanism, main loop, notification function, and testing procedures.
Uses
· Remote
Monitoring: Ideal for
monitoring environmental conditions or equipment in remote or
difficult-to-access locations.
· Emergency Alerts: Useful for sending emergency notifications over long distances, especially in areas with limited communication infrastructure.
· Industrial Applications: Facilitates remote status updates and alerts for machinery or processes in industrial settings.
· Agricultural Monitoring: Can be used to monitor soil moisture levels, weather conditions, and other agricultural parameters.
Importance
· Long-Distance
Communication: LoRa
technology provides effective communication over several kilometers, even in challenging terrains or remote
areas.
· Low Power Consumption: The system operates efficiently on battery power, making it suitable for applications where frequent recharging or replacement of batteries is impractical.
· Reliability: Offers reliable data transmission with minimal data loss, ensuring that alerts and messages are delivered accurately.
· Scalability: Can be easily scaled to include multiple transmitters and receivers, accommodating a wide range of monitoring and alerting needs.
Principle
The LoRa Alert System operates on the principle of low-power, wide-area network communication.IoT Projects Arduino It uses LoRa modulation to transmit data over long distances with minimal energy consumption. The system is based on two key principles:
LoRa Modulation: Utilizes Chirp Spread Spectrum (CSS) modulation, which spreads the signal across a wide bandwidth to achieve long-range communication.
2. LoRaWAN Protocol: Employs the LoRaWAN protocol for network communication, including data encryption and adaptive data rates to optimize performance.
Components Required
1. LoRa Transmitter Module: e.g., HopeRF RFM95W or Semtech SX1278.
2. LoRa Receiver Module: e.g., HopeRF RFM95W or Semtech SX1278.
3. Microcontroller: e.g., Arduino Uno, ESP32, or STM32.
4. Power Supply: Battery or power adapter to power the microcontrollers and LoRa modules.
5. Connecting Wires: For interfacing the LoRa modules with the microcontrollers.
6. Breadboard (optional): For prototyping and connecting components.
7. LCD(optional): For showing Message to the peoples.
LoRa Module Pin Configuration:
Microcontroller Pin Connections:
Pin |
Description |
Connection |
VCC |
Power Supply |
3.3V |
GND |
Ground |
Ground |
SCK |
Serial Clock |
Microcontroller (SPI) SCK |
MISO |
Master In Slave
Out |
Microcontroller
(SPI) MISO |
MOSI |
Master Out Slave
In |
Microcontroller (SPI) MOSI |
NSS |
Slave Select |
Microcontroller (SPI) SS |
RST |
Reset |
Microcontroller
(Digital Pin) |
DIO0 |
Digital I/O 0 |
Microcontroller (Digital Pin) |
DIO1 |
Digital I/O 1 |
Microcontroller (Digital Pin) |
DIO2 |
Digital I/O 2 |
Microcontroller (Digital Pin) |
· NSS (Slave Select): Connect to a digital pin on the microcontroller for chip selection.
· RST (Reset): Connect to a digital pin on the microcontroller for resetting the LoRa module.
· DIO0, DIO1, DIO2: Connect to digital pins on the microcontroller for interrupt handling.
Library Used
·
LoRa Library: For LoRa communication.
o Installation: Can be installed via the Arduino Library Manager or downloaded from the Github.
o Usage: Includes functions for sending and receiving LoRa messages.
Working IoT Projects Arduino
Transmitter Side:
1. Initialization:
o Configure the LoRa module with the appropriate frequency and settings using the LoRa library.
o Initialize the microcontroller and set up communication pins.
2. Data Collection:
o
Gather data from sensors (if applicable) or prepare the alert message if sensors
data is more than the
threshold.
3. Transmission:
o
Use the LoRa library to send the message via the LoRa module.
Receiver Side:
1.
Initialization:
o
Set up the LoRa module to receive
mode.
o
Initialize the microcontroller and configure communication pins.
2. Reception:
o
Continuously listen for incoming messages
using the LoRa library.
o
Process the received
message and take appropriate actions.
o
Verify the received signal using some validation to ensure that the
signal is from the trusted
source.
o If the signal is verified as trusted, take the appropriate action as per the signal command.
Code :
Transmitter Main Loop (Arduino):
#include <SPI.h>
#include
<LoRa.h>
int dangerCounter = 0;
int safeCounter = 0;
const int buttonPin = 3; //
Define the button pin void setup()
{
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(9600);
while
(!Serial);
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while(1);
}
Serial.println("LoRa Sender");
}
void loop() {
int buttonState = digitalRead(buttonPin);
Serial.print("Button state: ");
Serial.println(buttonState);
if(buttonState == 0){
Serial.print("Sending danger packet: ");
Serial.println(dangerCounter);
// send packet LoRa.beginPacket(); LoRa.print("Danger");
LoRa.endPacket(true)
; dangerCounter++;
}
else{
Serial.print("Sending Safe packet: ");
Serial.println(safeCounter);
// send packet LoRa.beginPacket(); LoRa.print("SAFE");
LoRa.endPacket(true); safeCounter++;
}
delay(1000);
}
Receiver Main Loop (Arduino Example):
#include <SPI.h>
#include <LoRa.h>
#include <LiquidCrystal_I2C.h> // Library for LCD
LiquidCrystal_I2C lcd(0x27,
16, 2); // I2C address
0x27,
16 column and 2 rows const int buzzer = 4; const int button = 3;
String signal = "";
int countSafe = 0;
lcd.clear();
String welcomemsg1 = " WELCOME ";
for(int i = 0; i < welcomemsg1.length(); i++){
lcd.setCursor(i, 0);
lcd.print(welcomemsg1[i]);
delay(100);
}
String welcomemsg2 = "PRE-ALERT SYSTEM!!!";
for(int i = 0; i < 16; i++){
lcd.setCursor(i, 1);
lcd.print(welcomemsg2[i]);
delay(100);
}
delay(2000);
}
void dangerAlert(){
lcd.clear();
int delayTime = 0;
while(digitalRead(button) == 1){
lcd.clear();
delay(500);
lcd.setCursor(0, 0);
lcd.print("EMERGENCY ALERT!");
lcd.setCursor(0,1);
lcd.print("-MOVE TO SAFETY-");
digitalWrite(buzzer, HIGH);
delay(500);
delayTime += 1000;
if(delayTime == 30000){
lcd.clear();
break;
}
};
}
void safeAlert(){
countSafe++;
lcd.setCursor(0, 0);
lcd.print(" STAY INFORMED ");
lcd.setCursor(0, 1);
lcd.print("STAY SAFE ");
digitalWrite(buzzer, LOW);
delay(300);
}
void setup() {
pinMode(buzzer, OUTPUT);
pinMode(button, INPUT_PULLUP);
lcd.init();
lcd.backlight();
Serial.begin(9600);
while
(!Serial);
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
Serial.println("LoRa Receiver");
LoRa.setPins(10,9,2);
welcomeMsg();
}
void loop()
{ signal="";
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet Serial.print("Received packet:");
// read packet
while (LoRa.available()) {
signal += (char)LoRa.read();
}
Serial.println(signal);
// print RSSI of packet Serial.print("with RSSI: "); Serial.println(LoRa.packetRssi());
Serial.println();
if(signal.equals("Danger")){
dangerAlert();
}
else if(signal.equals("SAFE")){
safeAlert();
}
else{
welcomeMsg();
}
}
}
Alert Function
Receiver Alert Function:
The
Alert function can be implemented to alert the user when a message is received. For instance, you might use the following
code snippet to print a Alert message.If the
signal of high risk is received from the transmitter than the receiver
will recognize and show danger
message in LCD display and also enable sirens according to this project. (Modification can be done)
Code:
void dangerAlert(){
lcd.clear();
int delayTime = 0;
while(digitalRead(button) == 1){
lcd.clear();
delay(500);
lcd.setCursor(0, 0);
lcd.print("EMERGENCY ALERT!");
lcd.setCursor(0,1);
lcd.print("-MOVE TO SAFETY-");
digitalWrite(buzzer, HIGH);
delay(500);
delayTime += 1000;
if(delayTime == 30000){
lcd.clear();
break;
}
}
}
Testing
1. Initial Setup:
o Verify that both LoRa modules are correctly connected and powered.
o Upload the transmitter and receiver code to the respective microcontrollers.
2. Test Transmission:
o Power on the transmitter and receiver units.
o
Check the serial monitor of the receiver to see if it receives the
message from the transmitter.
o Ensure that the message is received correctly and the notification function is triggered.
3.
Range Testing:
o Test the system over different distances to ensure reliable communication within the expected range.
4.
Error Handling:
o
Simulate different conditions to test the system’s robustness, such as interference or module malfunctions.
Conclusion:
The LoRa Alert System
represents a significant advancement in low-power, wide-area communication technology, offering a robust solution
for real- time alerting and monitoring in diverse applications. By leveraging the LoRa (Long Range) protocol, this system
ensures reliable data transmission over extended
distances with minimal energy consumption, making it ideal for remote or
off-grid environments.
The key benefits of the LoRa
Alert System include its high scalability, long battery life, and exceptional range, which collectively contribute to enhanced
operational efficiency and reduced maintenance costs. The system’s
versatility allows for seamless
integration with existing infrastructure and the customization of alert parameters to meet
specific needs.
As the deployment of IoT (Internet of Things) devices
continues to grow, the LoRa Alert System stands out as a
crucial tool for timely and effective communication, whether
in industrial settings, environmental monitoring, or public safety applications. Its ability to deliver accurate, real-time alerts with
minimal interference is crucial for ensuring prompt responses and
informed decision-making.
In summary, the LoRa Alert
System is poised to make a significant impact
by improving alert mechanisms, enhancing safety, and optimizing resource management. Its innovative use of LoRa technology underscores a commitment to leveraging cutting-edge solutions to meet the evolving
demands of modern
communication and monitoring.
Team Name:
1) Nikki Gyawali
2)Binisha Regmi
3)Sujal Pandey
4)Diya Shrestha
5)Manisha Magar
6)Sijan Thapa
College Name : Nepathya College