Demo 10 - Using Smoke Sensor to Detect Alcohol Leakage on VisionFive 2

According to StarFive, developers have successfully used smoke sensors on VisionFive/VisionFive 2, and the specific instructions are as follows:

1. Preparation

Development board: VisionFive/VisionFive 2

Smoke sensor: Smoke sensor with AO output

Analog to digital conversion module: ADS1115

DuPont Line: Many
image

2. The Principial of smoke sensor

The specific smoke sensor modules used in this demo are as follows:
The back of the sensor
smoke sensor

Similar to flame sensors, digital output interface DO and analog output interface AO are also provided on this smoke sensor.

Because VisionFive itself does not have an ADC module, this demo specifically uses an ADC module to help the board read the AO simulation output information of the smoke sensor and obtain the detected data.

Smoke sensors can not only detect combustion smoke that we encounter in daily life, but also detect various combustible gases such as liquefied gas, butane, propane, methane, alcohol, hydrogen, etc. They have good sensitivity to liquefied gas, butane, methane, smoke, etc.

The ADC module used in this demo is ADS1115, as follows:
ADS1115

ADS1115 is a 16-bit precision ADC signal conversion module that uses the IIC interface to communicate with the board. It can simultaneously measure four sets of voltage signals for conversion, and can work between 2V and 5.5V. It can be used in conjunction with various development boards and microcontrollers, and can be used in many applications such as automobiles, televisions, and sensors.

3. The use of smoke sensor

Based on the principle of the smoke sensor mentioned above, we can learn that to obtain the specificdetected value, it is necessary to perform analog-to-digital conversion through ADS1115.

Firstly, connect the AO interface of the smoke sensor module to the AO interface of ADS1115, so that ADS1115 can obtain the analog voltage signal output by the smoke sensor.
Then, refer to the following figure and connect ADS115 to VisionFive:
Connection
Connection:
Connection

Note:
The power supply voltage should be determined based on the actual sensor used. The flame sensor module and ADS1115 module in this demo uses a 5V power supply voltage.

Then, write the following program:

*# -*- coding: utf-8 -*-# file: ~/projects/smoke/smoke_ao.py*
**import** ADS1115**import** time**import** numpy
*#* *Initialize* *ADS1115* *module*
ads = ADS1115.ADS1115()
**while** True:
*#* *Read the data of channal 0 in* *ADS1115* *module*
volt = ads.readADCSingleEnded(0)
*#* *Conversion*
per = numpy.interp(volt, [0, 5000], [0, 100])
*#* *Output information*
print("%d mV of A0, val is %f" % (volt, per))
*#* *Delay*
time.sleep(0.1)

The logic of the above program is to detect the AO of the smoke sensor module through ADS1115, and then convert it to the corresponding value.

To run the above programs, it is also necessary to install the corresponding third-party support libraries numpy and ADS1115. However, the ADS1115 extension library uses i2c-1 by default, but VisionFive uses i2c-0. Therefore, after installing the extension library, it needs to be processed to use it, as follows:

*#Install Extension Library*
Pip install SMBus
Pip install numpy
Pip install ADS1115 *#Modify ADS1115 library file*
Vi~/. local/lib/Python 3.10/site packages/ADS1115/__ Init__ Py *# Modify smbus2. SMBus (1) in this file to smbus2. SMBus (0), then save and exit*

After writing, run smoke_ao.py, then use an alcohol cotton ball to approach the test, or spray a mist of alcohol in the surrounding environment.
python3 smoke_ao.py

The actual testing of this demo is as follows:

  • When the alcohol cotton balls are close to it:
    alcohol cotton balls

  • Alcohol spray:
    alcohol spray

The data read:
Data

4. Detection result

  • During the test, when the smoke was not detected, the simulated output of the smoke sensor was basically around 30.

  • When using an alcohol cotton ball to approach, the analog output of the smoke sensor rises to between 30 and 49.

  • When alcohol spray is used, the analog output of the smoke sensor significantly rises to more than 70.

5. Summary

In this demo, we learned how to read the analog output signal of smoke sensors for detecting alcohol leakage.

As mentioned in the principle section, smoke sensors have good sensitivity to liquefied gas, butane, methane, smoke, etc. Therefore, they are also part of daily safety equipment and can help us protect houses, offices, and stores from the impact of fires. Almost all modern houses, apartments, shopping centers, cinema halls, theaters, office buildings and stores are equipped with security devices that include smoke sensors.

2 Likes