Pages: [1]   Go Down
Author Topic: Problem with connecting and reading value from MQ - 4 to arduino  (Read 726 times)
0 Members and 1 Guest are viewing this topic.
Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got a  MQ - 4 sensor and breakout board,
the data sheet of the breakout board is like that:
GND -------------- gnd of arduino
B1 ---------------- ???????
H1----------------????????
A1 ----------------?????????
Please if you know which pin i should connect them please replay
i searched internet and read the datasheet but i couldn't get any information for that pins.
and i got this code online for reading value:
Code:
int sensorValue;

void setup()
{
  Serial.begin(9600);      // sets the serial port to 9600
}

void loop()
{
  sensorValue = analogRead(0);       // read analog input pin 0
  Serial.println(sensorValue, DEC);  // prints the value read
  delay(100);                        // wait 100ms for next reading
}
best regards
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is basic information for the MQ sensors : http://playground.arduino.cc/Main/MQGasSensors

Can you check the breakout board ? Perhaps you can figure out if the heater is also connected to ground and both the 'A' pins are connected together, and both the 'B' pins are connected together.
Logged

Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used this breakout board
https://www.sparkfun.com/products/8891
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice, SparkFun provides the schematics and a link to a example.
It seems that the A2 and B2 are not connected at all. That's no problem.

The heater uses 5V.
Connect the GND to GND, and H1 (the heater) to 5V. The sensor will get warm if the heater is on.
Perhaps you need a seperate adapter of 5V for the sensor. If you use the USB bus to power the Arduino, the voltage and current might be too low. Also the voltage regulator for 5V on the Arduino board might get too hot if you use the 5V from the Arduino board.

Connect A1 to +5V.
Connect B1 to an analog input of the Arduino.
Use 10k (or a variable resistor) from B1 to GND, that is the load resistor.

If you let gas flow near the sensor, the values read by the Arduino should get up a lot.
After the burn-in time, you can select a better load resistor.

Don't forget to read this page also: https://www.sparkfun.com/products/9404
« Last Edit: February 05, 2013, 08:42:50 am by Krodal » Logged

Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for replay smiley
Logged

Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

but what about H1??
Logged

Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i found the solution tnx, now it is working
Logged

Pages: [1]   Go Up
Jump to: