Hi,
I am trying to wire MQ-7 (http://www.sgbotic.com/products/datasheets/sensors/MQ-7.pdf) with Arduino but it doesn't seem to be working.
MQ-7 requires a pulse of 1.4V for 60 seconds and 5V for 90 seconds.
By calculation the pulsewidth should be 255 for 60 seconds and and 71.4 for 90 seconds.
Here is my code:
int sensorValue;
int pulsewidth;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
}
void loop()
{
pulsewidth=255; //set to 5 V
analogWrite(11, pulsewidth);
delay(60000);
pulsewidth=71.4; //set to 1.4 V
analogWrite(11, pulsewidth);
delay(90000);
sensorValue = analogRead(0); //Serial.println(sensorValue, DEC);
Serial.println(sensorValue);
}
I am using Sparkfun gas sensor breakboard http://www.sparkfun.com/products/8891 where H1 is connected to PWM pin 11.
With this arrangement I am only getting value 0 even though I blow cigarette smoke on the sensor.
I am not sure what is wrong with the circuit.
Thanks for reply.
I am using 10KOhms resistance and have wired like AirQualityMQ135 \ Learning \ Wiring.
This way I am supplying 5V to sensor.
But how can I supply 1.4V for 90 seconds and 5V for 60 secs in the same cycle of measurement?
The 10K resistor in that diagram has nothing to do with the heating element.
This sensor is composed of two parts: a heating element (H-H) and an open collector sensor (B).
The data sheet says you must turn on the heating element with 1.4V for 90s and then 5V for 60s, before you can take a reading. As-is, the heating element, connected to an arduino pin will draw enough current to burn out the I/O pin.
That diagram is suggesting to attach the heating element directly to 5V and skip the 1.4V for 90s / 5V for 60s step all together. Which may work.
The datasheet is pretty hard to understand. It seems to imply you must power up the heater in the cyclic fashion for 2 days before it stabilizes, note. You need an NPN transistor to drive the heater - 150mA load suggests using a good switching transistor with low Vsat and rated at least 300mA (something more like 1A will have better saturation). Drive it with a 220 ohm base resistor from the PWM and it should have enough poke to drive the heater. Connect transistor collector to one heater connection and +5V to the other. Your power supply must be able to supply 200mA (heater plus Arduino).
You must cycle 1.4V and 5V according to the datasheet - analogWrite (pin, 71) and analogWrite (pin, 255) ought to do it.
Its pretty unclear how to interpret the results (whether to read stationary values or the differences across the cycle). A resistor divider using the sensor as one resistor and 10k as the other is the basic measurement circuit.
Don't know if timing is bugging you to, but delay(60000); can be wrong interpreted by the compiler, add UL to say explicitly to the compiler it is a unsigned long (normally numbers are interpreted as an int.