||Using the MQ Library
|Document Number & Revision
||401 - 0003 - 1.0
||March 17, 2019
||Original Document, no ammendments
The MQ sensor range
What you need:
- Latest version of MikroC for PIC installed
- The MQ LIbrary ZIP file
- A Devboard that suports a Clickboard
- One or more MQ Sensor
: Provided the MQ Sensor is tied to circuitry similar to that found on a ClickBoard, any MQ sensor properly supported can be used.
MQ Sensors are fairly well know in DIY and open source circles as an inexpensive way to measure the presence of chemicles in our ambient environment. The sensors
have found there way into the heart of many projects and are available as modularised breakout boards from many suppliers.
The Sensor to choose . . .
Depending on your application, the following sensors are available.
||Methane, Butane, LPG, smoke
||Alcohol, Ethanol, smoke
||Methane, CNG Gas
||Natural gas, LPG
||LPG, butane gas
||Air Quality (Benzene, Alcohol, smoke)
How the library helps
If you are using a clik board, then the code is supplied from Mikro in separate projects. If then you need to use more than one sensor, you would have to 1) combine the code or 2) reflash the device
with the different projects if you were just testing. What the library very simply does is combine all the samples into a single library, and you select in software which sensor is in the respective slots.
The MQ Sensor library project takes the following libraries AirQuality click, CO Click, LPG Click, Alcohol Click, and combines them into a single project. We claim no ownership of the code, as we have used the existing code provided by Mikroe.
By default, the EasyPIC v7 will need an LCD and atleast one of the Mikroe Click boards inserted into slot 1. The code preseumes 5Vdc, but you can change this to 3v3 if required. You will need a a MikroC for PIC license to be able to compile the code if you make any changes.
To change the device, you then send a value over the comport to the PCB and it changes the device that it is reading.
Get The Library
The library is freely available from the folloing location:
MQ Sensor Library©
|Libstock Library: Download Here
Mikroe supplies Click Boards, which support the MQ Sensor range. The library combines multiple code samples into a single library making coding easier.
Once the device (PIC18F45K22)* has been flashed, the user communicates using the USART to change device selection for the appropriate Click board.
* : The library has been tested with a PIC18F45K22. Deviations will require testing or additional device configuration.