Sunday, April 27, 2008

Sensor Report - MQ3 Gas sensor

1. MQ3 Gas Sensor
This is an alcohol sensor from futurlec, named MQ-3, which detects ethanol in the air. It is one of the straightforward gas sensors so it works almost the same way with other gas sensors. It costs $6.90.Typically, it is used as part of the breathalyzers or breath testers for the detection of ethanol in the human breath.

2. Datasheet
Here is a datasheet, only 2 pages. It shows features, applications, specifications and configurations etc. It is a pretty simple datasheet. Since this datasheet was not prepared in English, the translation is not very accurate.

3. How it looks like :
Basically, it has 6pins, the cover and the body. Even though it has 6 pins, you can use only 4 of them. Two of them are for the heating system, which I call H and the other 2 are for connecting power and ground, which I called A and B.

If you look at the inside of the sensor, you will find the little tube. Basically, this tube is a heating system that is made of aluminum oxide and tin dioxide and inside of it there are heater coils, which practically produce the heat. And you can also find 6 pins. 2 pins that I called Pin H are connected to the heater coils and the other ones are connected to the tube.

4. How it works :
How does it work? The core system is the cube. As you can see in this cross-sectional view, basically, it is an Alumina tube cover by SnO2, which is tin dioxide. And between them there is an Aurum electrode, the black one. And also you can see how the wires are connected. So, why do we need them? Basically, the alumina tube and the coils are the heating system, the yellow, brown parts and the coils in the picture.
5. Working Process :
If the coil is heated up,

SnO2 ceramics will become the semi - conductor, so there are more movable electrons, which means that it is ready to make more current flow.
Then, when the alcohol molecules in the air meet the electrode that is between alumina and tin dioxide, ethanol burns into acetic acid then more current is produced. So the more alcohol molecules there are, the more current we will get. Because of this current change, we get the different values from the sensor.
6. Microcontroller Connections
Here is the schematic. It is pretty simple. First, you can use 5v. And as you can see one of H pins goes to the power and the other one is connected to the ground. And the pin A is connected between the power and the pin H and the pin B is goes to the microcontroller. Also between the ground and the Arduino, you need the resistor. Before you connect the resistor if you use the pot, you can tune the resistor for getting more accurate values. In the datasheet they say you can used 100k om to 470k om.

7. Typical Behavior
If you blow, it will react. Depending on the environment, it gives you little bit of different values. But in my case, it gives me 200 as the lowest value and 1000 as the highest value. And when it detects the alcohol in the air, actually it is pretty sensitive, the value gets higher very quickly but you have to wait for about 1 to 5 minutes to reset it. So that means getting values is fast but resetting is so slow. And the sensitivity of this sensor is affected by time span. When I used an old sensor, the range of value was smaller than the new one's.

8. Code Sample and Demo

Here is the sample codes for the arduino and processing.
Arduino
Processing

**Actually, I could not drink whenever I wanted to test it so I used the hand gel, which is really strong instead of drinking. You can just rub your hands the hand gel and blow it.

I made a simple demo with this sensor. So when users blow their breath to the sensor and the sensor detects the alcohol then my face in the screen is getting red.

codes for processing and arduino

Also I did the events, actions and filtering assignment with this sensor. I think this one might be a better demo. Here is a video. If the users blow their breath to the sensor, the foam of beer will go up and after a while it will go down itself. And you can see more details here.

code for arduino

Actions, Events and Filtering

For this assignment, I made a new demo of the sensor that I used for my sensor report, which is the gas sensor. Basically, this sensor detects the alcohol in the air and is usually the part of the breathalysers. So I wanted to make a funny demo that is related to this property. There were many ideas that I liked but I chose the one that fit the actions, events and filtering assignment. Here is an Idea : Bear and Foam!
I made a cup of beer and inside of the cup, there was a foam made of the foam board, which is attached to the servo. In the code I set the threshold to make the servo turn so if the sensor detects a certain amount of alcohol in the air, the servo will turn and the foam is going to go up. Usually, after the sensor detects alcohol, it takes about 30 seconds so if the sensing value is smaller than the threshold, the servo will go back to the initial position and the foam will go down as well.

The orange one is the alcohol sensor.


Left photo is when there is no alcohol in the air or the detected alcohol is smaller than threshold and right one is when the alcohol is detected.

In these photos, you can see the servo under the cup and the foam board that is attached the servo.


Here is the video. When you blow your breath after drinking..