How does it work?
Methane Click is based on the MQ-4 methane (CH4) sensor from Zhengzhou Winsen Electronics Technology, which detects methane’s presence and concentration in the air. The gas sensing layer on the MQ-4 sensor unit is made of Tin dioxide (SnO2), which has lower conductivity in clean air. The conductivity increases as the levels of methane rise. It has a high sensitivity to methane in a wide range suitable for detecting it in concentrations from 200 to 10.000ppm.
Besides a binary indication of the presence of methane, the MQ-4 also provides an analog representation of its concentration in the air sent directly to an analog pin of the mikroBUS™ socket labeled OUT. The analog output voltage the sensor provides varies in proportion to the methane concentration; the higher the methane concentration in the air, the higher the output voltage. Methane Click has a small potentiometer that allows you to adjust the load resistance of the sensor circuit, to calibrate the sensor for the environment in which you’ll be using it. For precise calibration, the sensor must preheat (once powered up, it takes 24h to reach the right temperature).
This Click board™ can be operated only with a 5V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Gas
Applications
Can be used as a domestic gas leakage alarm, industrial flammable gas alarm, and portable gas detector
On-board modules
MQ-4 – methane sensor from Zhengzhou Winsen Electronics Technology
Key Features
Low power consumption, high sensitivity to methane in wide range, fast response, stable and long life, simple drive circuit, sensitivity adjustment, and more
Interface
Analog
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
5V
Pinout diagram
This table shows how the pinout on Methane Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
P1 | – | Populated | Calibration Potentiometer |
Methane Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 5 | – | V |
Detection Range | 200 | – | 10.000 | ppm |
Software Support
We provide a library for the Methane Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Methane Click driver.
Key functions
-
methane_read_an_pin_value
Methane read AN pin value function. -
methane_read_an_pin_voltage
Methane read AN pin voltage level function.
Example Description
The demo application shows the reading of the adc values given by the sensors.
void application_task ( void ) {
uint16_t methane_an_value = 0;
if ( methane_read_an_pin_value ( &methane, &methane_an_value ) != ADC_ERROR ) {
log_printf( &logger, " ADC Value : %urn", methane_an_value );
}
float methane_an_voltage = 0;
if ( methane_read_an_pin_voltage ( &methane, &methane_an_voltage ) != ADC_ERROR ) {
log_printf( &logger, " AN Voltage : %.3f[V]rnn", methane_an_voltage );
}
Delay_ms( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Methane
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.