Upgrade your safety measures with highly accurate and reliable ethanol gas detection solution
A
A
Hardware Overview
How does it work?
Alcohol 2 Click is based on the 3SP-Ethanol-1000 from SPEC Sensors, which can sense ethanol concentration up to 1000ppm. The sensor has a very short response time; however, the longer it is exposed to a particular gas, the more accurate data it can provide. This is especially true when calibration is performed. The sensor is sensitive to small dust particles, condensed water, and other impurities, which might prevent gas from reaching the sensor. It is advised to protect the sensor when used in critical applications. In ideal conditions, the lifetime of this sensor is indefinite, but in real-life applications, the expected operating life is more than five years (10 years at 23 ± 3 ˚C; 40 ± 10 %RH). Although very reliable and accurate, this sensor is great for building relative gas sensing applications. For example, it can detect increased levels of ethanol gas. However, when developing applications for the absolute gas concentration, the sensor must be calibrated, and the measurement data needs to be compensated. Factors such as humidity and temperature can affect measurements; the sensor reaction curve to a specific measured gas (ethanol in this case) is not completely linear, and other gases might affect the measurement (cross-sensitivity to other gases). For this reason, a range of calibration routines must be done in the working environment conditions to calculate the absolute
gas concentration. Alcohol 2 click uses the LMP91000, a configurable AFE potentiostat IC for low-power chemical sensing applications, from Texas Instruments. It provides the complete sensor solution, generating the output voltage proportional to the sensor current. A trans-impedance amplifier (TIA) with a programmable gain is used to convert the current through the sensor, covering the range from 5μA to 750 μA, depending on the used sensor. The voltage between the referent electrode (RE) and the working electrode (WE) is held constant, with the bias set by the variable bias circuitry. This type of sensor performs best when a fixed bias voltage is applied. The sensor manufacturer recommends a +100mV fixed bias for the sensor on this Click board™. The bias voltage and the TIA gain can be set via the I2C registers. In addition, an embedded thermal sensor in the AFE IC can be used for the result compensation if needed. It is available via the VOUT pin as the analog voltage value with respect to GND. The Click board™ has two additional ICs onboard. The first is the MCP3221, a 12-bit successive approximation register A/D converter from Microchip. The second IC is the OPA344, a single-supply, rail-to-rail operational amplifier from Texas Instruments. It is possible to use the onboard switch, labeled as AN SEL, to select the IC to which the VOUT pin from the
LMP91000 AFE is routed. If the switch is in the ADC position, the VOUT pin will be routed to the input of the MCP3221 ADC. This allows the voltage value at the VOUT pin to be read via the I2C interface as digital information. When the switch is in the AN position, it will route the VOUT pin of the LMP91000 AFE IC to the input of the OPA344. The output of the OPA344 op-amp has a stable unity gain, acting as a buffer so that the voltage at the VOUT pin of the AFE can be sampled by the host MCU via the AN pin of the mikroBUS™. The RST pin on the mikroBUS™ is routed to the MEMB pin of the LMP91000, and it is used to enable the I2C interface section, thus making it possible to use more than one chip on the same I2C bus. When driven to a LOW logic level, the I2C communication is enabled, and the host device (host MCU) can issue a START condition. The RST pin should stay at LOW during the communication. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Clicker 2 for STM32 is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit ARM Cortex-M4 microcontroller, the STM32F407VGT6 from STMicroelectronics, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a JTAG programmer connector, and two 26-pin headers for interfacing with external electronics. Its compact design with clear and easily recognizable silkscreen markings allows you to build gadgets with unique functionalities and features quickly. Each part of the Clicker 2 for
STM32 development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 2 for STM32 programming method, using a USB HID mikroBootloader, an external mikroProg connector for STM32 programmer, or through an external ST-LINK V2 programmer, the Clicker 2 board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Mini-B cable, where onboard voltage regulators provide the appropriate voltage levels to each component on the board or using a Li-Polymer battery via an onboard battery
connector. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several user-configurable buttons and LED indicators. Clicker 2 for STM32 is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
ARM Cortex-M4
MCU Memory (KB)
10
Silicon Vendor
STMicroelectronics
Pin count
100
RAM (Bytes)
100
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for Alcohol 2 Click driver.
Key functions:
alcohol2_write_byte
- This function writes one byte to the registeralcohol2_read_byte
- This function reads one byte from the registeralcohol2_read_alcohol
- This function reads Alcohol data.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Alcohol2 Click example
*
* # Description
* The demo application gets Alcohol data and logs data to USBUART.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes device configuration.
*
* ## Application Task
* Gets Alcohol (C2H5OH) data and logs data to USBUART every 500ms.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "alcohol2.h"
// ------------------------------------------------------------------ VARIABLES
static alcohol2_t alcohol2;
static log_t logger;
static float alcohol_value;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
alcohol2_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
alcohol2_cfg_setup( &cfg );
ALCOHOL2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
alcohol2_init( &alcohol2, &cfg );
alcohol2_write_byte( &alcohol2, ALCOHOL2_MODECN_REG, ALCOHOL2_DEEP_SLEEP_MODE );
alcohol2_write_byte( &alcohol2, ALCOHOL2_LOCK_REG, ALCOHOL2_WRITE_MODE );
alcohol2_write_byte( &alcohol2, ALCOHOL2_TIACN_REG, ALCOHOL2_EXT_TIA_RES | ALCOHOL2_100_OHM_LOAD_RES );
alcohol2_write_byte( &alcohol2, ALCOHOL2_REFCN_REG, ALCOHOL2_VREF_INT | ALCOHOL2_50_PERCENTS_INT_ZERO | ALCOHOL2_BIAS_POL_NEGATIVE | ALCOHOL2_0_PERCENTS_BIAS );
log_printf( &logger, "Alcohol 2 is initialized\r\n" );
Delay_ms( 300 );
}
void application_task ( void )
{
alcohol_value = alcohol2_read_alcohol( &alcohol2 );
log_printf( &logger, "Alcohol value : %f \r\n", alcohol_value );
Delay_ms( 500 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END