Continue to Site

# Trouble with getting data from MQ135

#### hello0123

##### New Member
I currently do a project on gas detection using MQ135 and Atmega16. I am having trouble when working through the sensor MQ135 with Atmega16. As a matter of fact the LCD only shows 0 MMP so I guess the problem either in the way of setting the output of MQ135 to Atmega16 or my code on CodevisionAVR. Can anyone show me how to tackle with this problem ?

#### Attachments

• 1675619534961.png
48.9 KB · Views: 34
• 1675619735272.png
182.4 KB · Views: 34
• 1675619749933.png
143.4 KB · Views: 36

#### Reloadron

##### Well-Known Member
Most Helpful Member
I am seeing Earth Ground and Analog / Digital ground symbols, why? This is your sensor data sheet. Normally these sensors require at least a 24 hour burn in period. The MQ135 reacts to about a half dozen gas types so exactly what are you looking to measure? Your RV2 sense resistor at 1 K ohm is pretty low. Read the data sheet. Your Vcc should be 5.0 Volts. The MQ135 is far from an accurate gas detector. When properly setup it can tell you if there is gas or not. Don't expect concentrations of gas expressed in accurate PPM.

When posting code use code tags not a screen shot. I can't scroll a screen shot or image. I also suggest you give this a read, while not your uC it should help you with configuration.

### Interfacing of MQ135 Gas Sensor with Arduino​

Use of code tags example.

Code:
int sensorValue;
int digitalValue;

void setup()
{
Serial.begin(9600); // sets the serial port to 9600
pinMode(13, OUTPUT);
pinMode(2, INPUT);
}

void loop()
{
sensorValue = analogRead(0); // read analog input pin 0
digitalValue = digitalRead(2);
if (sensorValue > 400)
{
digitalWrite(13, HIGH);
}
else
digitalWrite(13, LOW);
Serial.println(sensorValue, DEC); // prints the value read
Serial.println(digitalValue, DEC);
delay(1000); // wait 100ms for next reading
}

Ron

Replies
0
Views
496
Replies
0
Views
309
Replies
0
Views
527
Replies
0
Views
414
Replies
12
Views
1K