Demo Video
Skematik
List Program
Skematik
List Program
/* Universal Gas Sensors using QM-NG1 By :Aan Darmawan date : 31 July 2011 Blog : http://valfa.blogspot.com/2011/08/sensor-gas-universal.html The circuit: * LCD RS pin4 to digital pin 12 * LCD Enable pin6 to digital pin 11 * LCD D4 pin11 to digital pin 5 * LCD D5 pin12 to digital pin 4 * LCD D6 pin13 to digital pin 3 * LCD D7 pin14 to digital pin 2 * LCD R/W pin5 to ground * LCD Vcc pin2 to +5V * LCD Vss pin1 to ground * LCD Vee pin3 to ground * Speaker connected to pin 10 * Sensor Gas Output connected to Analog 0 */ // include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); const int inAnalog=A0; float hasil; void setup() { // Serial.begin(9600); // set up the LCD's number of columns and rows: pinMode(13,OUTPUT); digitalWrite(13,LOW); lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Deteksi Gas...."); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): hasil=analogRead(inAnalog); // Serial.println(hasil,BYTE); hasil=hasil/1024*100; lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(hasil); lcd.print(" % "); if(hasil>=30.00){ digitalWrite(13,HIGH); tone(10,1000); // speaker connect to pin 10 tone 1KHz delay(1000); } else { digitalWrite(13,LOW); noTone(10); // tone at pin 10 off } delay(100); }