Reference
Last revision 2026/01/16
Library
Download and install the DFRobot Alcohol Sensor library. (About how to install the library?)
Communication Protocol Description
By UART communication protocol, the SEN0376 Alcohol sensor can be connected to any controllers with UART for data reading and sensor configuration.
Parameter Setup
| Baud Rate | 9600 |
|---|---|
| Data bit | 8 |
| Check | 1 |
Communication Commands
The sensor has two communication modes: auto-upload and passive reply. The default one is auto-upload, and the sensor sends the alcohol concentration every 1 second in this mode.
Data format in auto-upload mode:
| Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
|---|---|---|---|---|---|---|---|---|
| Start | Gas Name C2H5OH |
Unit (ppb) |
Decimal digit None |
Gas Concentration High |
Gas Concentration Low |
Full-scale High |
Full-scale Low |
Check |
| 0xFF | 0x17 | 0x04 | 0x00 | 0x00 | 0x25 | 0x13 | 0x88 | 0x25 |
Note:Gas Concentration(PPB)=Gas Concentration High*256+Gas Concentration Low. When converted in PPM: PPM= PPB/1000.
In passive reply mode, the commands to re-switch to auto-upload mode are as follows:
| Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
|---|---|---|---|---|---|---|---|---|
| Start | None | Swtich command | Auto-upload | none | none | none | none | Check |
| 0xFF | 0x01 | 0x78 | 0x40 | 0x00 | 0x00 | 0x00 | 0x00 | 0x47 |
The commands to switch to passive-reply mode and read concentration in this mode:
Switch to passive-reply mode:
| Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
|---|---|---|---|---|---|---|---|---|
| Start | None | Switch command | passive-reply | None | None | None | None | Check |
| 0xFF | 0x01 | 0x78 | 0x41 | 0x00 | 0x00 | 0x00 | 0x00 | 0x46 |
Read gas concentration:
| Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
|---|---|---|---|---|---|---|---|---|
| Start | None | Command | None | None | None | None | None | Check |
| 0xFF | 0x01 | 0x86 | 0x00 | 0x00 | 0x00 | 0x00 | 0x20 | 0x79 |
Data format in passive-reply mode:
| Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
|---|---|---|---|---|---|---|---|---|
| Start | Command | None | None | None | None | Gas concentration High(ppb) |
Gas concentration Low(ppb) |
Check |
| 0xFF | 0x86 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x20 | 0x5A |
Gas concentration(PPB)=Gas concetration High*256+Gas concentration Low
Checksum Caculation
Checksum= (Reverse(Byte1 + Byte2 + ··· ··· +Byte7) + 1
Reference Sample Program:
/******************************************************************
* Name: unsigned char FucCheckSum(uchar *i,ucharln)
* Function:checksum(Reverse the sum of 1\2\3\4\5\6\7 of sending and receiveing, then plus 1)
* Description:Sum up the elements from the first to the second to last in the array, reverse the sum and then plus 1 (There should be more than 2 elements).
******************************************************************/
unsigned char FucCheckSum(unsigned char *i,unsigned char ln)
{
unsigned char j,tempq=0;
i+=1;
for(j=0;j<(ln-2);j++)
{
tempq+=*i;
i++;
}
tempq=(~tempq)+1;
return(tempq);
}
API Description
There two data reading modes for this Alcohol Sensor: auto-upload and passive reply. It is default to auto-upload, and users can alter it in Codes.
Mode Select Functions
Revise the parameter in the parentheses to adjust the data sending mode.
“MEASURE_MODE_AUTOMATIC” is auto-upload mode. The sensor automatically uploads parameter every 1 second in this mode.
”MEASURE_MODE_PASSIVE“ is passive reply mode. The sensor feedbacks parameter only when the function is called in this mode.
Alcohol.SetModes(MEASURE_MODE_AUTOMATIC);
/*
MEASURE_MODE_AUTOMATIC // Auto-upload
MEASURE_MODE_PASSIVE // Passive Reply
*/
Data Reading Functions
The data of alcohol sensor can be read by the function “ReadAlcoholData()”. Before outputing, this function will take the average of the data in data collect array “COLLECT_NUMBER”. The default size of that array is 5, and it can be adjusted within 1~100 in the code “#define COLLET_NUMBER 5".
#define COLLECT_NUMBER 5
Alcohol.ReadAlcoholData(COLLECT_NUMBER);
/*
COLLECT_NUMBER // The collection range is 1-100
*/
Principle
Based on the electrochemistry principle, this alcohol sensor has been calibrated before factory.
Cross Interference Characteristics
Due to the electrochemical principle, the sensor performance may be influenced by other gases, shown as below:
| Gas | Concentration/PPM | Equivalent concentration of ethanol |
|---|---|---|
| Benzene | 10 | 0.1 |
| Toluene | 10 | 0.46 |
| Acetic acid | 200 | 0.52 |
| Hydrogen sulfide | 50 | 3 |
| Carbon monoxide | 200 | 0.64 |
Operating Principles
- Do not contact the module with substances like silica gel, adhesives, coatings, chemicals, oil and high concentration gas.
- The sensor cannot be completely packaged with resin material or immersed in an oxygen free environment, otherwise its performance will be affected.
- The module cannot be used in environment with corrosive gas for a long time since it will cause damage to the sensor.
- Excessive impact and vibration should not be applied to the sensor.
- Preheat the sensor for 24-48 hours when powering up for the first time to make it perform stably.
- Organic solvents will affect the accuracy of the sensor, such as air freshener, cosmetics, Florida Water, etc.
- Do not install the module in environment with Strong convective air.
- Do not place the product in high concentration organic gas for a long time since it will lead to sensor zero drift and slow recovery.
- It is forbidden to use hot melt adhesive or sealant with curing temperature higher than 80℃ to fix the module.
- Do not place and use the sensor in alkaline gas of high concentration for a long time.
Other Supplementary Information
Was this article helpful?
