Hello, i am currently creating a project that detects LPG gases using MQ5 gas sensor. I had no problems regarding this, but had some issues when trying to combine with the GSM/GPS. I am using a GPS/GPRS/GSM V3.0(DF robot) module. I think my problem is with the GPS/GSM codings. I am suppose to trace an LPG gas and once it is detected, an LED will blink, buzzer will produce sound and send a message to a safety centre(my number). Would love for you all to check it out.
My problem:
- Trying to convert multiple analog readings and converting it to one single digital output. This is what i did;
val = analogRead(sensorValue);
Serial.println(val);
if (val < 350)
{
digitalWrite(sensor1,LOW);
digitalWrite(LED,LOW);
digitalWrite(buzzer,LOW);
delay(500);
}
else
{
if (val >= 350)
{
digitalWrite(sensor1,HIGH); //is this the right way to convert analog readings to a one digital output?
digitalWrite(LED,HIGH);
digitalWrite(buzzer,HIGH);
delay(500);
digitalWrite(LED,LOW);
digitalWrite(buzzer,LOW);
delay(500);
}
2)I do not know how, but i am able to receive the message displayed but I am not able to obtain any lattitude,longitude output.You can see an example of my serial port for the output on the picture below.
3)Usually, when i apply LPG gas on the sensor, it will go as high as 1000+ and returns back to normal range(below 350), and i've noticed on the way down, the program still reads the output and responds, example, when it reaches 1000+ it will send out a message, once it is done, if it is still above(350) it will keep sending out message until it is below 350, how do i send the message just once?
4)Ive attached a buzzer(pin 9) and an LED(pin 11) just for the sake of an alarm, and ive noticed both of them does not go on a loop once the message starts to be sent, how i make it continuosly HIGH(when input is detected) and have the system send out a message also?
TQ,please have a look,i really need the help..
test.txt (12.1 KB)
Edit_Code_GPS_SMS.ino (5.75 KB)