We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-01-29
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Gas
Downloaded: 3496 times
Not followed.
License: MIT license
Alcohol 3 click is a gas sensor Click board, equipped with the MiCS-5524, a compact metal oxide (MOS) sensor. This sensor reacts to the presence of deoxidizing and reducing gases, such as ethanol (also known as alcohol).
Do you want to subscribe in order to receive notifications regarding "Alcohol 3 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Alcohol 3 click" changes.
Do you want to report abuse regarding "Alcohol 3 click".
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 :
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 );
}
Other mikroE Libraries used in the example:
I2C
Conversions
UART
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor 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.