I added just this sensor to my mix, to detect the location. But,
- It takes a long time to start detecting.
- When it starts detecting (LED on the sensor board blinks) it only returns -1.
This is my whole code :
#define SENSOR_PIN 9
#define GPS_RX 6
#define GPS_TX 7
#include <SoftwareSerial.h>
SoftwareSerial gpsSensor(GPS_RX, GPS_TX);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSensor.begin(9600);
Serial.println("Welcome to home AQI station!");
Serial.println("============================");
Serial.println("GPS Module may take a while to detect your location. Please be patient");
Serial.println("============================");
}
void loop() {
// put your main code here, to run repeatedly:
int aqi = analogRead(SENSOR_PIN);
Serial.print("Air Quality Index: ");
Serial.print(aqi, DEC);
Serial.print(" PPM");
if(aqi < 500){
Serial.println(", Fresh Air");
} else if(aqi > 500 && aqi <= 1000){
Serial.println(", Poor Air");
} else if(aqi > 1000){
Serial.println(", Very Poor");
}
Serial.print("Location: ");
Serial.println(gpsSensor.read());
delay(30000);
}
I don’t have any idea why!
P.S : Sorry if I don’t show schematics. I do not have access to a schematics software. But I made the circuit using attached image.