MQ-3 alcohol sensor

dear experts
i have purchased alcohol sensor from the sparfun.com and according to data sheet i have connected 10k ohm resistor accross it and switche on for one whole day and night after that i try to write code and when alchol is not detected 200 value shows in the lcd i it should have shown value o how to solve this problem any idea ?
here is the code
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int ledPin = 13;
int sensorPin = A0;
int value = 0;

const int threshold = 350;

void setup()
{

Serial.begin(9600);
lcd.begin(16,2);

}

void loop()
{
int Value = analogRead(sensorPin);
value = analogRead(0);

if (Value > threshold)
{
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin,LOW);
}

lcd.print("alcohollevel:");
lcd.println(value);
Serial.println(value,DEC);

if (Value > threshold)
{
lcd.print("alert");
Serial.print ("alert");
}
else {
lcd.print("normal");
Serial.print("normal");

}

delay(1000);
lcd.clear();

}

Have you wired it up correctly? You say i have connected 10k ohm resistor accross it but 10K resistor should not be connected across device but is to ground.

Your reading the pin twice

int Value = analogRead(sensorPin);
value = analogRead(0);

You don't need the second one. The device really needs calibrating using known alcohol concentrations.

if i remove second line value is displayed always zero what is the problem then .

yes 10k is connected to the ground and when the alcohol is present value varies from 200 to 1024 but when alcohol is not present shows value 200 my wiring is correct

Your confusing 'Value' with 'value'. C++ is case sensitive so these are totally separate variables.
Get rid of this line as it's not needed

int value = 0;

Correct case of these two lines so they say Value and not value

    lcd.println(value);
    Serial.println(value,DEC);

santoshaxl:
if i remove second line value is displayed always zero what is the problem then .

Value is not value

(edit: whops, it seems I was late :stuck_out_tongue: )

oh yes that was my mistake i will check now :slight_smile: