The Click board™ contains the required resistances used to form a voltage divider with the sensor, as well as the accurate SAR type ADC with 12-bit resolution which allows the voltage to be converted, using 5V from the mikroBUS™ rail as a voltage reference. Featuring the MiCS-5524, a robust and reliable gas sensor which requires a minimal number of additional components, the MCP3221, an accurate 12-bit ADC by Microchip, proven in many Click board™ designs so far, Alcohol 3 click represents an ideal solution for a rapid development of all kinds of breathalyzer applications, gas leakage applications, fire detection applications, CO detectors, and similar reducing gasses detecting applications.
How does it work?
Alcohol 3 click is equipped with the MiCS-5524 sensor, a compact MOS sensor from SGX Sensortech. This sensor consists of a micromachined metal oxide semiconductor diaphragm, with an integrated heating resistor. The resistor produces heat which catalyzes the reaction, which in turn affects the electrical resistance of the oxide layer itself. The temperature of the heater is quite high: it is in the range from 350 °C to 550 °C. After the initial preheating period, the sensor can detect gas changes in time intervals below two seconds.
The resistance of the MiCS-5524 sensor does not change linearly with the gas concentration, so a proper calibration must be performed prior to using it for absolute gas concentration measurement applications. The impedance changes the most when used with low gas concentrations. As the atmosphere gets saturated with gas, the impedance changes slower. This should be taken into an account, especially when developing applications for estimating blood alcohol content (BAC) from a breath sample (also known as breathalyzers).
The MiCS-5524 sensor is a simple device: it has only four connections. Two pins are the connections of the internal heating element, while the other two pins are the MOS sensor connections. The application is reduced to calculating a proper resistor for the voltage divider. The datasheet of the MiCS-5524 sensor offers typical values for its resistance when used in a clean air (artificial conditions). The sensitivity is then expressed as the ratio between the resistance of the sensor in clean air and resistance at a concentration of 60 ppm CO.
The middle tap between the sensor (as a resistor) and the fixed resistance is used to provide an output voltage. It directly depends on the resistance of the sensor, allowing it to be used as the input into the MCP3221, a low-power 12-bit A/D converter with I2C interface, from Microchip. This ADC allows the output voltage to be translated into a digital information, which can be accessed over the I2C pins on the mikroBUS™ socket. By using the power supply voltage as the voltage reference for the conversion, this ADC further reduces the complexity of the design, still offering a good conversion quality, thanks to its low noise input. Due to the sensor's inert nature, this ADC is more than fast enough, although it can provide up to 22.3 ksps when operated in the I2C Fast mode.
The I2C communication voltage level can be adjusted so that the Click board™ can be used with both 3.3V and 5V MCUs. The provided SMD jumper labeled as VCC SEL can be used to select the desired voltage level. However, the Click board™ requires +5V for a proper operation, regardless of the logic voltage level selection jumper.
Specifications
Applications |
It can be used for various alcohol breath tester applications, early fire and gas leakage warning applications, VOC concentration warning applications, and similar |
On-board modules |
MiCS-5524 sensor, a compact MOS sensor from SGX Sensortech; MCP3221, a low-power 12-bit A/D converter with I2C interface, from Microchip |
Key Features |
Robust and reliable MOS sensor, a high-quality 12-bit ADC from Microchip onboard, can detect a range of different redux gasses, ideal for a breathalyzer application development, etc. |
Interface |
I2C |
Input Voltage |
3.3V,5V |
Click board size |
M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on Alcohol 3 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes |
Pin |
|
Pin |
Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
|
NC |
2 |
RST |
INT |
15 |
NC |
|
|
NC |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
SCL |
I2C Clock |
|
NC |
6 |
MOSI |
SDA |
11 |
SDA |
I2C Data |
Power Supply |
+3V3 |
7 |
3.3V |
5V |
10 |
+5V |
Power Supply |
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label |
Name |
Default |
Description |
---|
LD1 |
PWR |
- |
Power LED indicator |
JP1 |
VCC SEL |
Left |
Power supply voltage selection |
Software support
We provide a library for the Alcohol 3 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for reads adc data from I2C. The library includes function for reads CO data in the AIR (in ppm and mg/L), function for reads Ethanol data in ppm and reads the percentage of alcohol in the blood (BAC).
Key functions:
float alcohol3_getPercentageBAC()
- Function for read percentage of alcohol in the blood (BAC).
uint16_t alcohol3_ethanolInPPM()
- Function for read Ethanol (C2H5OH) data in ppm.
uint16_t alcohol3_getCOinPPM()
- Function for read CO (Carbon monoxide) data in ppm.
Examples description
The application is composed of the three sections :
- System Initialization - Initializes I2C module.
- Application Initialization - Initialization driver init.
- Application Task - (code snippet) - Reads percentage of alcohol in the blood (BAC) and this data logs to USBUART every 1 sec.
void applicationTask()
{
uint16_t CO_ppm;
uint16_t pBAC;
char demoText[ 50 ];
mikrobus_logWrite(" --- Alcohol diagnostics ----", _LOG_LINE);
CO_ppm = alcohol3_getCOinPPM();
WordToStr(CO_ppm, demoText);
mikrobus_logWrite(" CO in ppm | ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
pBAC = alcohol3_getPercentageBAC() * 1000;
WordToStr(pBAC, demoText);
if( 10 > pBAC && pBAC < 100 )
{
mikrobus_logWrite(" BAC | 0.00", _LOG_TEXT);
LTrim(demoText);
mikrobus_logWrite(demoText, _LOG_LINE);
}
else if(100 <= pBAC && 1000 > pBAC)
{
mikrobus_logWrite(" BAC | 0.0", _LOG_TEXT);
LTrim(demoText);
mikrobus_logWrite(demoText, _LOG_LINE);
}
else if ( pBAC >= 1000)
{
mikrobus_logWrite(" BAC | 0.", _LOG_TEXT);
LTrim(demoText);
mikrobus_logWrite(demoText, _LOG_LINE);
}
else
{
mikrobus_logWrite(" BAC | 0.0000", _LOG_LINE);
}
mikrobus_logWrite(" ----------------------------", _LOG_LINE);
mikrobus_logWrite( " " , _LOG_LINE);
Delay_ms( 1000 );
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.