Sensing the signal change in a sensor

Hello forum,
I know the title might sound a little bit weird but this is exactly what i want to do.

1- I'm building a breathalyser using a very simple semi conductor alcohol sensor.
2- I want to know when the person is blowing into the device and if not alarm the person and display an error.

Now you may think of using the if else function with change of the detected value, but that won't work because the value might stay the same when the person is clean and actually has no alcohol in the breath.
Another Idea (which i don't even know how to do or if it's doable or not) is to actually do this:

Now the sensor consume current to heat up the heater and when it heats up, the current draw should decrease (i'm assuming this), so when a user blows into it the heater will cool down and then it will start drawing more current again (is this even true ?), can i actually ask the arduino to sense this current change (if it exists)?

Or do you have any other idea to accomplish that ?

In order for you to develop a code for your sensor you will need to have an idea of how the sensor responds to alcohol concentration in someone's breath, for example, if it is a resistive sensor (i.e. its resistance changes with alcohol concentration) 10 ohms would mean a certain concentration and 100 ohms would mean a different concentration and so on.

What does the sensor do when it is presented with someone breath? does it produce a small voltage? or does its conductivity change?

what you're trying to achieve is something like this:

void loop(){

    float alcoholConcentration = readSensor();

    Serial.print(F("Alcohol concentration: "));
    Serial.println(alcoholConcentration);

    if(alcoholConcentration > warningConcentration){
        Serial.println(F("Alcohol concentration too high!"));
        digitalWrite(LED_BUILTIN, HIGH);
    }

    delay(1000);

}

the readSensor() function is something you will need to write to measure your sensor. Which you can achieve using the Arduinos ADC, but you will need to know how the sensor voltage/resistance corelates to the alcohol concentration

1 Like

The sensor is a resistive seonsor.

I have no issue with reading the value at all.

My problem comes when i want to know if there is a breath blown or not WITHOUT using a flow sensor

Ah i see, there are two different ways that I can think of.

The simpler method would be to use a push-button so that the Arduino is only measuring the sensor when a button is being pressed. So, for example, if you had a pull-up resistor on digital pin 9, you could then have a push-button switch connected to ground and use:

void loop() {

  if(digitalRead(9) == LOW)
  {
    readSensor();
  }

  delay(1000);

}

or, the other way would be to get an airflow sensor. The purpose of the airflow sensor would be to tell the Arduino if someone is blowing onto the surface of your sensor. Then, if someone is blowing onto the sensor, you can begin measuring the alcohol concentration:

void loop() {

  float airFlow = measureAirFlowSensor();

  //Using a greater than comparison as the airflow sensor may
  //pick up background airflow from wind or so on
  if(airFlow > backgroundNoise)
  {
    readSensor();
  }

  delay(1000);

}

float measureAirFlowSensor(){
  //Inset airflow measurement code here
}

A good example of an airflow sensor that you can use on the Arduino is demonstrated here:

or, or, an even simpler method would be to use neither of these. Technically, you wouldn't actually need to know if someone is blowing on the surface of the sensor or not.
If no one is blowing on the sensor the alcohol concentration will be zero (unless you have vodka floating around in the air). So, you can print a message saying the concentration is low. If someone then blows onto it and they are sober, the concentration is still low as there is no difference in the sensor resistance (assuming it only changes to alcohol concentration and not moisture), so it doesn't matter that the Arduino was measuring before the person started blowing.

You only want a warning message to display if the concentration goes above a certain value, which will only ever happen if someone blows onto it (or if it gets dropped into a pint).

1 Like

Then you are the first person to find out how your sensor actually reacts on blowing.

1 Like

First of all, thank you for your ideas I would definitely make a use of these...

However, the goal in my mind is to know if there is someone blowing into the sensor or not (regardless of the alcohol existence) and do the following:

1- if the person has blown successfully and was sober then show that alcohol is zero (this is simple as it depends on the calibration)
2- if no one has blown successfully then show an error message indicating that the device has failed to recognize a breath (now this is tricky since i want to achieve it without using extra components like an airflow sensor for example)
3- and of course if the person is drunk then display the concentration (also simple and depends on calibration)

Check This video at the time i linked specifically, the device recognized that noone has blown into it and displayed the error and then later in the same video the person will open up the device and show that there is no any flow sensor. The person too wasn't sure how did the device do that But it was done.

I like the way you put it, i guess i will have to do a lot of trial and error and observation

But let's say if found that the sensing element reacts to alcohol only and the heater is the one that reacts by drawing more current to keep up the heat when there is breath cooling it down, Can the arduino read that current change assuming that i'm NOT supplying the heater from the arduino itself

If you supply an access to the current, e.g. a shunt resistor. If the heating is by PWM you have to get a voltage and determine its duty cycle.

1 Like

The heating is done from an external power supply because the heater will draw 488mA which is higher than what arduino can handle, would i still be able to connect a shunt resistor ?

In case of an independent heater circuit you are free to add a shunt resistor wherever it makes sense.

1 Like

Thanks mate, that helped to point the direction...
all what i have to do now is do a little bit of research on using shunt resistors with arduino.