CO сенсор
- Войдите на сайт для отправки комментариев
Втр, 30/09/2014 - 11:05
Пришел вот такой сенсор MQ-7, на плате 4 вывода:питание, выход аналоговый и цифровой.
вот вырезка характеристик датчика:
Electronic Brick - CO (Carbonic Oxide) Sensor (MQ7) can be used to detect Carbon Monoxide, Coal Gas, Liquefied Gas and so on.
Features
- Working Voltage: 5V
- Heating consumption: 0.5 ~ 800 mW
- Operating Temperature: -25 ~ +85 degree centigrade
- Analog output and digital output
- Fast response time
- Adjustable load resistance
- With Makerduino Demo Code
- With Signal Light
- Weight: 6g
Applications
- CO detector
Вот скетч:
01 | /* MQ-7 Carbon Monoxide Sensor Circuit with Arduino */ |
02 |
03 | const int AOUTpin=0; //the AOUT pin of the CO sensor goes into analog pin A0 of the arduino |
04 | const int DOUTpin=8; //the DOUT pin of the CO sensor goes into digital pin D8 of the arduino |
05 | const int ledPin=13; //the anode of the LED connects to digital pin D13 of the arduino |
06 |
07 | int limit; |
08 | int value; |
09 |
10 | void setup () { |
11 | Serial .begin(115200); //sets the baud rate |
12 | pinMode(DOUTpin, INPUT); //sets the pin as an input to the arduino |
13 | pinMode(ledPin, OUTPUT); //sets the pin as an output of the arduino |
14 | } |
15 |
16 | void loop () |
17 | { |
18 | value= analogRead(AOUTpin); //reads the analaog value from the CO sensor's AOUT pin |
19 | limit= digitalRead(DOUTpin); //reads the digital value from the CO sensor's DOUT pin |
20 | Serial .print( "CO value: " ); |
21 | Serial .println(value); //prints the CO value |
22 | Serial .print( "Limit: " ); |
23 | Serial .print(limit); //prints the limit reached as either LOW or HIGH (above or underneath) |
24 | delay(100); |
25 | if (limit == HIGH){ |
26 | digitalWrite(ledPin, HIGH); //if limit has been reached, LED turns on as status indicator |
27 | } |
28 | else { |
29 | digitalWrite(ledPin, LOW); //if threshold not reached, LED remains off |
30 | } |
31 | } |
А зачем тут нужен скетч ,если этот датчик без ардуины может работать ??
А зачем тут нужен скетч ,если этот датчик без ардуины может работать ??
ну скетч и правда подойдет для многих датчиков, просто так удобней использовать датчик, в скетче вывод аналогово сигнала в терминал.Да и раз ардуиновский форум, чего бы здесь не написать про этот датчик и как его использовать.