Smoke Sensor =================== .. figure:: /_static/products/ledong-module/static/images/smoke_sensor.png :width: 55% :align: center Overview -------------------- Based on the MQ-2 gas sensor, used for detecting smoke, liquefied gas, methane, butane, and other gas concentrations in the atmosphere. The higher the gas concentration, the greater the AO output. Technical Specifications ------------------------ Operating voltage: VCC 3.3V -5V Module dimensions: 24*48mm Mounting: 2 plastic building block compatible through-holes Data type: Analog sampling value Pin Definition ------------------- ======= ==================== Pin Definition ======= ==================== GND Ground VCC Power AO A nalog sampling value NC Not connected ======= ==================== Example Code ------------------- **Special reminder: After powering on, the sensor needs to preheat for about 20 seconds for stable measurement data. Sensor heating is normal because it contains an internal heating wire.** **The mPython Board OLED display shows the real-time smoke analog value measured by the sensor. When the measured value exceeds 2000, the mPython Board RGB LED lights up.** .. code-block:: python from mpython import * from bluebit import GasSensor gasSensor_0 = GasSensor(0) import time while True: oled.fill(0) oled.DispChar(str(str('Smoke analog: ') + str(gasSensor_0.get_raw_val())), 0, 0, 1) oled.show() if gasSensor_0.get_raw_val() > 2000: rgb.fill((int(255), int(0), int(0))) rgb.write() time.sleep_ms(1) time.sleep(1) else: rgb.fill( (0, 0, 0) ) rgb.write() time.sleep_ms(1) .. figure:: /_static/products/ledong-module/static/examples/smoke_sensor.png :width: 100% :align: center