MQ3 (or MQ303a) Alcohol Sensor Arduino Guide

This little device is wonderful, for parties at least. Accuracy wise, it’s not much more than a toy (without some opamps for signal amplification and filtering) but I digress. Just plugged right straight into an Arduino will be plenty of fun, assuming you read the datasheet.


To wire this properly, check out this diagram, which will get further explanation after the break.

The image is fairly self explanatory. Give the heater +1VDC (PWM with analogWrite(heaterPwrPin, 51) attached to base of 2n3906 or any PNP transistor, +5VDC to collector and emitter to the heater,) have the output (pin 2) attached to an analog in, and don’t forget to have a resistor between analog in and +5VDC. Oh, and make sure all grounds are connected together. For best results, use something between 5k and 20k, my test sensor loves a 16k. The lower the resistor value, the smaller the range of ethanol (alcohol) the sensor will respond to from its’ minimum to maximum.

Furthermore, for a semblance of accuracy (but quite non mandatory, see below,) it requires a burn in period of 48 hours at 2.2VDC. Its going to draw around 120mA of current, so make sure your power source can handle the load. I powered mine on a breadboard connected to my USB power bus (thanks Teensy!) I would also suggest oversampling and averaging, for a little extra boost in accuracy once you’ve got it burned in.

The datasheet for this item is pretty marred by the curse of Engrish, but I’ve been successful with the setup here, found on various forums and on irc. If you’ve tried something different or had different results, let me know. That’s what comments are for!

Advertisements

3 thoughts on “MQ3 (or MQ303a) Alcohol Sensor Arduino Guide

  1. hey, thank you for this post! we’re working on the mq303b alcohol sensor. we find it difficult to get readings from the sensor. we connected pin 0 of arduino to pin 2 of the mq303b alcohol sensor and found inconsistent values. the lowest range we get is 0 and the highest is 1023. when we try to blow alcohol on the sensor, we aren’t really sure if it reads the alcohol’s presence or doing nothing at all. the values are not consistent. can you help us with this? also, do we connect the 2n3096 pnp transistor emitter to ground or directly to pin 1 of mq303b (then mq303b’s pin 3 is connected to ground)? i’m hoping for your response. thank you!

    • The reason why you are getting a reading between 0 and 1023 is because the voltage level is converted/scaled automatically to fall within this range. If you have specific reference voltage to measure against, the voltage is scaled to +5v. So for example, if the output voltage of your component is 2.5v you will get a reading of 512. If you have a voltage at or above your reference voltage (default +5v unless changed on the vin pin) you will get a reading of 1023. The reason why it will always range between 0 and 1023 is due to the data structure size used. All you have to do to overcome this ‘problem’ is to add a line of code to scale the analogue read value into a meaningful voltage value.

  2. I tried the way you explained the output is always 5.0 V (i.e 1023). Can you please upload the CKT diagram.

    The steps i followed :-

    1) powered Arduino via USB.
    2) for A1 (AnalogPin) analogWrite(1,51);
    3) A0 is made as analog output (Serial).
    4) Sensor Pin 3 is connected to ardunio ground.
    5) Sensor pin 2 is connected to +5v(From ardunio) via 16Kohm Resitor.
    6) Collector is connected to +5v from ardunio.
    7) Emitter is connected to heater directly.
    8) Base is connected to A1 pin (Step-2).
    9) A0 is connected to pin-2.

    The output is +5 volts.

    Is there Anything wrong in the steps i followed.

What's The Word?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: