Pages: [1]   Go Down
Author Topic: MQ-7  (Read 2388 times)
0 Members and 1 Guest are viewing this topic.
Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Please help.

Thanks

Z
Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
Anyone to help me?

Thanks.
« Last Edit: January 21, 2012, 11:04:18 am by zeus2kx » Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ding!
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The heater element is 33ohms.  At 5v, thats over 120mA, which is 3x the max an Arduino I/O can handle.  Are you using a transistor?

Both H pins need a connection to work, they are each side of the coil.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for reply.
I am using 10KOhms resistance and have wired like http://wiring.org.co/learning/basics/airqualitymq135.html.
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?

Regards,

Z
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for correction.
« Last Edit: January 23, 2012, 09:29:29 pm by zeus2kx » Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12725
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Mark.
I will follow steps.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

delay(60000UL);

idem for delay(90000); of course

just my 2 cents
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: