Skip to content

Carbon Monoxide Detector (Testing)

ThatOneRoadie edited this page Feb 21, 2018 · 11 revisions

Notes for I2C Carbon Monoxide (MQ9 Gas) sensor and alarm.

Note from ForeFlight Dev team: ForeFlight currently does not process the GDL90 Maintenance Required flag in any way, so no tripping a CO alarm in ForeFlight. It'll have to be all local.

CO Sensor used: ADC121C_MQ9 from ControlEverything: https://store.ncd.io/product/mq-9-carbon-monoxide-combustible-gas-sensor-adc121c-12-bit-adc-i2c-mini-module/

Sensor as-assembled:

Fresh air is approx. 390 PPM. To calibrate, set sensor in fresh air and burn in (power on) for 48 hours continuous. Then, turn small brass screw on blue box (Variable resistor) near sensor while reading PPM Value. Once value is approx. 385-395 ppm consistently, sensor is calibrated.

Address 0x50 data 0x00 2 bytes, 12 bits for ppm.

Testing code is at This github to be PR'd when working

Alarm Circuit:

Stealing GPIO 2 and 3, and the nearby ground (Pins 13/15 and 14) for this

Using a SPDT Switch as a "Silence alarm Switch" GPIO 2 as a "CO ALARM" output (Normally low). GPIO 3 as a "Silence Warning" output (Normally High).

Invert states when alarm is asserted (Pull alarm high and silence low).

Basic Diagram for wiring of 3.3v LED and Active Buzzer:

This allows for a warning buzzer if Switch is still in silent when alarm is low and silence warning is high.