Measuring the level of alcohol with a sensor
In this section, we will build a very cool project: Your very own Alcohol Breath Analyser. To do that, we are going to use a simple Arduino Uno board along with an ethanol gas sensor:
The following diagram shows the connection of the sensor with the Arduino:
We are now going to write the code for the project. Here, we are simply going to go over the most important parts of the code.
You can now either copy the code inside a file called Sensor_alcohol.ino
, or just get the complete code from the folder for this project:
int readings=0; void setup(){ Serial.begin(9600); } void loop(){ lectura=analogRead(A1); Serial.print("Level of alcohol= "); Serial.println(readings); delay(1000); }
When it doesn't detect alcohol, we can see the number of values that the Arduino reads:
If it detects alcohol, we see values from the analog read from Arduino as shown in the following screenshot: