Soldered MQSensors MicroPython Library

This library drives Soldered's currently-sold MQ-series gas sensor breakouts (each pairs an MQ sensor element with native analog/digital GPIO output; some also have a Qwiic/I2C variant with an onboard ATtiny404). One MQSensor base class handles the shared read/calibration/regression logic; per-gas behavior (Rs/R0 ratio, regression coefficients) is set via constructor args.

GasBreakout (Native)Breakout with Qwiic
MQ7 (CO)CO Sensor MQ7 Breakout 333107 (opens in a new tab)CO Sensor MQ7 Breakout with Qwiic 333121 (opens in a new tab)
MQ8 (Hydrogen)Hydrogen Sensor MQ8 Breakout 333108 (opens in a new tab)—
MQ9 (CO, flammable gases)CO, Flammable Gasses Sensor MQ9 Breakout 333109 (opens in a new tab)—
MQ131 (Ozone)Ozone Sensor MQ131 Breakout 333110 (opens in a new tab)Ozone Sensor MQ131 Breakout with Qwiic 333124 (opens in a new tab)
MQ137 (Ammonia)Ammonia Sensor MQ137 Breakout 333113 (opens in a new tab)Ammonia Sensor MQ137 Breakout with Qwiic 333127 (opens in a new tab)
MQ138 (VOC)VOC Sensor MQ138 Breakout 333114 (opens in a new tab)Benzene, Toluene, Acetone, Formaldehyde Sensor MQ138 Breakout With Qwiic 333128 (opens in a new tab)

MQ2, MQ3, MQ4, MQ5, MQ6, and MQ135 variants exist in this driver's Examples/ for backward compatibility, but those boards are discontinued and no longer sold by Soldered. MQ8 and MQ9 don't have a dedicated Qwiic board, but I2C mode still works through a generic ATtiny404 I2C bridge board.

How to install


After installing the mpremote package (opens in a new tab), install the library on your board using the following command:

  mpremote mip install github:SolderedElectronics/Soldered-MQSensors-MicroPython-Library

Or, if you're running a Windows OS:

  python -m mpremote mip install github:SolderedElectronics/Soldered-MQSensors-MicroPython-Library

Repository Contents

  • MQSensor.py - MicroPython driver class (base class for all MQ variants, Native + Qwiic/I2C)
  • Qwiic.py - shared I2C base class this driver depends on
  • package.json - mip install manifest
  • /Examples - Native and I2C examples per MQ variant (MQ2/3/4/5/6/7/8/9/131/135/137/138), plus calibration and digital-input examples

Hardware design

You can find hardware design for these boards in each MQ variant's own hardware repository.

Documentation

Access library documentation here (opens in a new tab).

About Soldered

Soldered Logo

At Soldered, we design and manufacture a wide selection of electronic products to help you turn your ideas into acts and bring you one step closer to your final project. Our products are intented for makers and crafted in-house by our experienced team in Osijek, Croatia. We believe that sharing is a crucial element for improvement and innovation, and we work hard to stay connected with all our makers regardless of their skill or experience level. Therefore, all our products are open-source. Finally, we always have your back. If you face any problem concerning either your shopping experience or your electronics project, our team will help you deal with it, offering efficient customer service and cost-free technical support anytime. Some of those might be useful for you:

Open-source license

Soldered invests vast amounts of time into hardware & software for these products, which are all open-source. Please support future development by buying one of our products.

Check license details in the LICENSE file. Long story short, use these open-source files for any purpose you want to, as long as you apply the same open-source licence to it and disclose the original source. No warranty - all designs in this repository are distributed in the hope that they will be useful, but without any warranty. They are provided "AS IS", therefore without warranty of any kind, either expressed or implied. The entire quality and performance of what you do with the contents of this repository are your responsibility. In no event, Soldered (TAVU) will be liable for your damages, losses, including any general, special, incidental or consequential damage arising out of the use or inability to use the contents of this repository.

Have fun!

And thank you from your fellow makers at Soldered Electronics.