Go Down

Topic: MQ7 sensor + Arduino Uno (Read 1 time) previous topic - next topic

cms10

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.

Photo:

https://www.dropbox.com/s/jye7cq2z78auxtt/20140502_151308.jpg

Results file:
MQ7_RESULT_3.txt

Arduino code:
Code: [Select]

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);
}


robtillaart

at first sight the code looks OK

you are heating them up at the same time,.
Can the Arduino deliver enough power (or does the Arduino switch a separate power supply e.g. wit a transistor?
Rob Tillaart

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

cms10

Thanks for your reply.

Power delivered by Arduino may not be enough for cleaning time (60 seconds with 5V), because I measured and sometimes not reached 5V only getting ~4.7V. Relatively to 1.5V, the Arduino provide this power correctly, i've tested for this case.

But if the Arduino does not provide 5V for cleaning time, how can I improve it with another alternative circuit that respects the times (60 seconds - 5V ; 90 seconds - 1.5V)?

Go Up