Go Down

Topic: How to set limit for mq7 (Read 174 times) previous topic - next topic


How to set limit for mq7 to trigger an alarm
i have set the alarm but just need to set the limt to trigger the alarm

 :)  >:(  :(  :o  :smiley-confuse:


Well if you've worked out how to read the sensor all you need to do is pick a value above which the alarm triggers.

Post the code you have so far with the sensor being read and the alarm being set.



 heres my code

const int AOUTpin=0;//the AOUT pin of the CO sensor goes into analog pin A0 of the arduino
const int DOUTpin=7;//the DOUT pin of the CO sensor goes into digital pin D8 of the arduino
const int ledPin=13;//the anode of the LED connects to digital pin D13 of the arduino

int limit;
int value;

void setup() {
Serial.begin(115200);//sets the baud rate
pinMode(DOUTpin, INPUT);//sets the pin as an input to the arduino
pinMode(ledPin, OUTPUT);//sets the pin as an output of the arduino

void loop()

value= analogRead(AOUTpin);//reads the analaog value from the CO sensor's AOUT pin
limit= digitalRead(DOUTpin);//reads the digital value from the CO sensor's DOUT pin
Serial.print("CO value: ");
Serial.println(value);//prints the CO value
Serial.print("Limit: ");
Serial.println( HIGH );//prints the limit reached as either LOW or HIGH (above or underneath)
if (limit == LOW){
digitalWrite(ledPin, HIGH);//if limit has been reached, LED turns on as status indicator
digitalWrite(ledPin,LOW);//if threshold not reached, LED remains off

how can you do it on the sensor itseelf

Go Up