Arduino Alcohol Sensor Code

Last Updated on March 16, 2024

Interfacing Gas Sensors with Arduino board is simple task and you just need to put correct code to Arduino microcontroller through IDE. Here Simple Arduino Alcohol Sensor Code is written to interface MQ 3 Gas sensor (Alcohol) with Arduino board in this case we used Arduino uno board.




We know MQ3 alcohol sensor is suitable for detecting alcohol concentration in air or from the breath, this gas sensor interfacing circuit can be used as breathalyzer. MQ 3 sensor has high sensitivity and fast response time and this sensor provides an analog resistive output based on the alcohol concentration in air or breath.

Arduino Alcohol Sensor MQ-3 Interfacing

Components Required

  • Arduino UNO board (Use what you have)
  • MQ 3 Gas sensor
  • Resistor 10KΩ
  • Connecting Wires 

Wiring & Operation

Gas Sensor MQ3 will have 6 pins and you can choose A or B side for sensing output and two Middle pins are dedicated for Heater (H1, H2 terminals), Connect +5V supply to A1, A2 and H1 terminal and Connect GND supply to H2 and B2 through 10KΩ Resistor and then Connect B1 terminal to Analog input pin A0.

After completing the wiring setup upload the following Arduino Alcohol sensor code to take raw output data in serial monitor.


Arduino Alcohol sensor code

/* Arduino Alcohol Sensor Code
 *  www.theorycircuit.com
 */
int mq3_analogPin = A0; // connected to the output pin of MQ3

void setup(){
Serial.begin(9600); // open serial at 9600 bps
}

void loop()
{
// give ample warmup time for readings to stabilize

int mq3_value = analogRead(mq3_analogPin);
Serial.println(mq3_value);

delay(100); //Just here to slow down the output.
}


MQ 3 Sensor Pin Diagram

For to Connect Analog output pin (A0) we can use either A side or B side terminals. There are Breakout boards for MQ3 (Alcohol) Sensor available in the market you can use those boards also.




2 thoughts on “Arduino Alcohol Sensor Code

Leave a Reply

Your email address will not be published. Required fields are marked *