//SENDER // It is a helmet that contains a sensor for gases, vital signs in the body, GPS , and a
temperature that transmits data via Lora connecting to arduino nano.
//RECEIVER// arduino nano contains Lora to receive data from sender.
I'm having trouble locating. The location does not appear correctly
also the ID it does not appear correctly it should be W001 but it shown sometimes W262, W81
This is the code below for sender and receiver.
// SENDER
//lora
#include
#include
#define ss 10
#define rst 9
#define dio0 8
//hart
#include
SoftwareSerial a(6,7); //rx-tx
float BPM,SpO2;
//gps
#include "TinyGPS++.h"
#include "SoftwareSerial.h"
SoftwareSerial gpsSerial(2, 3); //arduino 2=GpsTX, 3=GpsRX
TinyGPSPlus gps; //This is the GPS object that will pretty much do all the grunt work
with the NMEA data
float Latitude = 01, Longitude = 01;
float Latitude1;
float Longitude1;
float Latitude2;
float Longitude2;
//temp
#include
#include
#define DHTPIN A4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
float temp;
float pro;
float O2;
byte sos;
int ID=1;
int SOS = A3;
byte localAddress = 0xBB;
byte destination = 0xFF;
int E = 0;
int o2 = A1;
int buzzer = 5;
int Vibrationpin = A0;
unsigned long send_delay = 0;
String saved_Latitude = "", saved_Longitude = "";
#include
void setup() {
Serial.begin(9600);
gpsSerial.begin(9600);
a.begin(115200);
delay(100);
Serial.println("BPM Sender");
pinMode(buzzer, OUTPUT);
pinMode(sos, INPUT_PULLUP);
Serial.println("LoRa Sender");
LoRa.setPins(ss, rst, dio0);
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1)
;
}
Serial.println("LoRa Initializing OK!");
dht.begin();
digitalWrite(buzzer, 1);
delay(250);
digitalWrite(buzzer, 0);
delay(250);
digitalWrite(buzzer, 1);
delay(250);
digitalWrite(buzzer, 0);
delay(250);
}
void loop() {
read_from_a();
temp = dht.readTemperature();
while (gpsSerial.available()) //While there are characters to come from the GPS
{
gps.encode(gpsSerial.read()); //This feeds the serial NMEA data into the library one char at a
time
}
if (gps.location.isUpdated()) //This will pretty much be fired all the time anyway but will at
least reduce it to only after a package of NMEA data comes in
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
Latitude = gps.location.lat();
Longitude = gps.location.lng();
/*
Serial.print("Latitude: ");
Serial.print(Latitude);
Serial.print(" Longitude: ");
Serial.println(Longitude);
*/
write_to_memory_lat(String(Latitude, 6));
write_to_memory_lon(String(Longitude, 6));
} else {
//saved_Latitude = read_from_memory_lat();
//saved_Longitude=read_from_memory_lon();
Latitude = read_from_memory_lat();
Longitude = read_from_memory_lon();
Serial.print("saved_Latitude: ");
Serial.print(Latitude, 6);
Serial.print(" saved_Longitude: ");
Serial.println(Longitude, 6);
}
//////////////////////////////////////////////////////////////////////////
if (millis() - send_delay > 2000) {
// send packet
if (isnan(temp)) {
Serial.pr.
Historical philosophical, theoretical, and legal foundations of special and i...
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
1. //SENDER // It is a helmet that contains a sensor for gases, vital signs in the body, GPS , and a
temperature that transmits data via Lora connecting to arduino nano.
//RECEIVER// arduino nano contains Lora to receive data from sender.
I'm having trouble locating. The location does not appear correctly
also the ID it does not appear correctly it should be W001 but it shown sometimes W262, W81
This is the code below for sender and receiver.
// SENDER
//lora
#include
#include
#define ss 10
#define rst 9
#define dio0 8
//hart
#include
SoftwareSerial a(6,7); //rx-tx
float BPM,SpO2;
//gps
#include "TinyGPS++.h"
#include "SoftwareSerial.h"
SoftwareSerial gpsSerial(2, 3); //arduino 2=GpsTX, 3=GpsRX
TinyGPSPlus gps; //This is the GPS object that will pretty much do all the grunt work
with the NMEA data
float Latitude = 01, Longitude = 01;
float Latitude1;
float Longitude1;
float Latitude2;
float Longitude2;
//temp
#include
#include
#define DHTPIN A4
#define DHTTYPE DHT11
2. DHT dht(DHTPIN, DHTTYPE);
float temp;
float pro;
float O2;
byte sos;
int ID=1;
int SOS = A3;
byte localAddress = 0xBB;
byte destination = 0xFF;
int E = 0;
int o2 = A1;
int buzzer = 5;
int Vibrationpin = A0;
unsigned long send_delay = 0;
String saved_Latitude = "", saved_Longitude = "";
#include
void setup() {
Serial.begin(9600);
gpsSerial.begin(9600);
a.begin(115200);
delay(100);
Serial.println("BPM Sender");
pinMode(buzzer, OUTPUT);
pinMode(sos, INPUT_PULLUP);
Serial.println("LoRa Sender");
LoRa.setPins(ss, rst, dio0);
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1)
;
}
Serial.println("LoRa Initializing OK!");
dht.begin();
digitalWrite(buzzer, 1);
3. delay(250);
digitalWrite(buzzer, 0);
delay(250);
digitalWrite(buzzer, 1);
delay(250);
digitalWrite(buzzer, 0);
delay(250);
}
void loop() {
read_from_a();
temp = dht.readTemperature();
while (gpsSerial.available()) //While there are characters to come from the GPS
{
gps.encode(gpsSerial.read()); //This feeds the serial NMEA data into the library one char at a
time
}
if (gps.location.isUpdated()) //This will pretty much be fired all the time anyway but will at
least reduce it to only after a package of NMEA data comes in
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
Latitude = gps.location.lat();
Longitude = gps.location.lng();
/*
Serial.print("Latitude: ");
Serial.print(Latitude);
Serial.print(" Longitude: ");
Serial.println(Longitude);
*/
write_to_memory_lat(String(Latitude, 6));
write_to_memory_lon(String(Longitude, 6));
} else {
//saved_Latitude = read_from_memory_lat();
//saved_Longitude=read_from_memory_lon();
Latitude = read_from_memory_lat();
Longitude = read_from_memory_lon();
Serial.print("saved_Latitude: ");
4. Serial.print(Latitude, 6);
Serial.print(" saved_Longitude: ");
Serial.println(Longitude, 6);
}
//////////////////////////////////////////////////////////////////////////
if (millis() - send_delay > 2000) {
// send packet
if (isnan(temp)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
//temp=33;
pro = 48;
int MQ=analogRead(A7);
MQ= map(MQ,0,900,100,0);
O2 =MQ;
if ((digitalRead(SOS) == LOW) && (E < 5)) {
E++; Serial.println("SOS.................!");
digitalWrite(buzzer, 1);
delay(200);
digitalWrite(buzzer, 0);
} else {
E = 0;
delay(1500);
{
sos = 0;
}
}
if (E >= 5) {
sos = 5;
digitalWrite(buzzer, 1);
delay(2000);
digitalWrite(buzzer, 0);