Hi,
I've bought MQ7 sensors, and Arduinos. I've connected the sensors to Arduino respecting the circuit specifications present in the them datasheet. Like specified in the same datasheet I've programmed the Arduino to send to sensor's heating pin 5V for 60 seconds and 1.5V for 90 seconds alternately, and I kept them working for more than 48 hours as advised on them datasheet.
So, I that the results obtained by Arduino are misfits. I added to this post the Arduino code and the data obtained as well as a photo of Arduino and sensors.
There are three MQ7 sensors connected to the same Arduino and the labels "valor_co_1", "valor_co_2" and "valor_co_3" in results file corresponds to each MQ7 sensor value, obtaned by Arduino.
Problem:
- Have I problems in Arduino code?
- How can I get minimally realiable results?
Can you help me? If you need more info, tell me.
Results file:
MQ7_RESULT_3.txt
Arduino code:
int ANALOG_HIGH_V = 255;
int ANALOG_LOW_V = 80;
int coPin_1 = 0;
int coPin_2 = 1;
int coPin_3 = 2;
int coHeaterPin_1 = 3;
int coHeaterPin_2 = 5;
int coHeaterPin_3 = 6;
int coValue_1;
int coValue_2;
int coValue_3;
int coMaxVoltage = 1;
int coCicles = 0;
void changeHeater(int v){
analogWrite(coHeaterPin_1, v);
analogWrite(coHeaterPin_2, v);
analogWrite(coHeaterPin_3, v);
}
void refreshCOValues(){
coValue_1 = analogRead(coPin_1);
coValue_2 = analogRead(coPin_2);
coValue_3 = analogRead(coPin_3);
Serial.print("valor_co_1 : ");
Serial.print(coValue_1);
Serial.println();
Serial.print("valor_co_2 : ");
Serial.print(coValue_2);
Serial.println();
Serial.print("valor_co_3 : ");
Serial.print(coValue_3);
Serial.println();
}
void setup(){
Serial.begin(9600);
pinMode(coPin_1, INPUT);
pinMode(coPin_2, INPUT);
pinMode(coPin_3, INPUT);
pinMode(coHeaterPin_1, OUTPUT);
pinMode(coHeaterPin_2, OUTPUT);
pinMode(coHeaterPin_3, OUTPUT);
changeHeater(ANALOG_HIGH_V);
coMaxVoltage = 1;
}
void loop(){
if(coMaxVoltage == 1){
if(coCicles == 60){
coCicles = 0;
coMaxVoltage = 0;
changeHeater(ANALOG_LOW_V);
Serial.print("Atingiu 60s, inicia 1.4");
Serial.println();
}
}else{
if(coCicles == 90){
coCicles = 0;
coMaxVoltage = 1;
changeHeater(ANALOG_HIGH_V);
Serial.print("Atingiu 90s, inicia 5");
Serial.println();
}
}
refreshCOValues();
coCicles++;
delay(1000);
}