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.
video
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.
video
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..
video

Sunday, March 23, 2008

Data logging

I worked on it with Seungran and Sunghun. We ordered a DOSon chip and a micro SDcard from sparkfun( DOSon CHIP). Here is a picture of it.
And we connected it to an arduino. First, we tried to use a toggle switch for a reset button but for some reasons it was not working so I made a circuit without it. And we also connected a pot to an analog pin 0 to get some value.


We tried data logging with a sample code from the Sensor Wiki which was named 4dSystems xD Datalogger (Arduino-Processing). We got some data from the pot but it did not seem reliable because values were so unstable and also we could not save any data in the card. We were so confused, because we thought that as long as an arduino got some value (no matter if it was garbage value), it was supposed to be saved in the card. However, data file was saved in the computer.

Here are the text files.
Text 1
Text 2

We were trying to figure out what was wrong, so kept doing same things over and over but the more we tried , the more confused we were. Then Steve brought the new code that he got from Jeff. He changed the delay value in the code and finally we could make Arduino communicate to the chip then save some data to the chip. (Thanks Steve!)

Here are the code for Arduino and the results.
Code
Result 1 , Result 2

Sunday, February 24, 2008

Sensors and Time

I chose a photocell for visualizing a sensor because I have never used it. The circuit was simple but it was not easy to connect arduino and processing. So I started with a really simple code and made them talk to each other first then kept developing them based on the code from the sensor wiki. After I did it, the photocell was giving pretty stable values as the amount of light.

Sensors and Time_Arduino code

int photocellPin = 0;
int value = 0;


void setup() {

Serial.begin(9600);
pinMode(photocellPin,INPUT);

}

void loop() {

value = analogRead(0)/2;
Serial.print("photocell:");
Serial.println(value);
delay(10);

}

Sansors and Time


Version 1.

video
Processing Code for version 1.

Version 2.
video
Processing Code for version 2.

Version 3.
video
Processing Code for version 3.

Sunday, February 10, 2008

Sensor Walk

  • Heating system
    temperature sensor or thermometer outside of windows of my room to control the heater. - On a really cold day, heater is stronger.
  • Fire alarm - smoke sensor
  • Elevator
    weight sensor (scale?)– when the elevator gets overweight, it makes warning sounds.
    Cf. Escalators at the subway station – There are two ways escalator: going up and going down. So if you enter to opposite way, it would warn. And if the escalator is empty, it will stop.
  • ATM
    touch screen – it might be a basic question, how does it work?
  • Bookstore –barcode reader
  • Auto flushed toilets in a public bathroom – IR sensor
  • Auto sinks in a public bathroom – IR sensor
  • Security sensor bars at the store – magnetic sensor(?)
  • Automatic doors at the grocery store– IR sensor
  • Barcode scanner - Barcode
  • Conveyor belt
    IR sensor(?) - this belt looks like moving automatically. When there is some stuff at the edge of the belt, it stops and in the same situation but suff is far from the edge of the belt, it starts moving.
  • Iron
    temperature sensor – the little light on the top of the iron is turned on when it is heated
    enough.
  • Nintendo DS
    touch screen / thermometer for the blowing option.

  • Night light – light sensor – When the room is bright, it is dimmed but when the room is dark it is getting brighter.

(Can timers be sensors? If they can,)

  • Auto turning off system of my camera - timer
  • Sleeping function of my lap-top - timer
  • Alarm clock - timer
    Cf. Speaking of an alarm clock, one of my friends have funny alarm clock. When it is ringing, to stop it you should make a sound like a voice or clapping instead of hitting a button.

  • People – I sensed people, and they did also.
    I have been thinking about the humans as sensors. When I called my mother she notices my mood, whether I have good news or I am tired just hearing my voice and its tone. At this point I want to talk more about sensing emotions than the five senses such as sight, smell, hearing, touch and taste. Sensing emotions could be related to intuition which is called our sixth sense. We can detect people’s feeling easily even unintentionally and react following what we detect. Sometimes it is wrong but I grantee, over 90 percent, it is right. We have such a good sensor. I can’t stop thinking about an emotion sensor. Is there a sensor that detects emotions except humans? If there is no sensor like it, how could I make it?