Previous posts for this project:
- [AirCare] InTheAir - Project Description
- [AirCare] InTheAir - Week 1: Getting a Launchpad to Blink
- [AirCare] InTheAir - Week 2: Preparing the Beaglebone Black
- [AirCare] InTheAir - Week 3: Fuel Tank Testing
- [AirCare] InTheAir - Week 4: Using the CC3200
- [AirCare] InTheAir - Week 5: openHAB and MQTT
- [AirCare] InTheAir - Week 6: Accessing Fuel Tank's Data
Introduction
For this week's post, I experimented with the Sharp GP2Y1010AU0FSharp GP2Y1010AU0F dust sensor which I plan to use in my project.
Sensor info
The Sharp GP2Y1010AU0F dust sensor uses an IR LED and detector to provide information on the dust concentration in the air.
The output of the sensor is analog and provides a voltage which can be used to correlate the dust concentration. (See paragraph "Measurements" in this post)
In the pictures above, you can see a disassembled sensor with both the LED and detector crossing paths at the ventilation hole.
The sensor is also low power, with a typical supply current of 11mA and maximum supply current of 20 mA (at 5V).
Circuit
An example circuit is provided in the datasheet. It provides the function of every pin and indicates the need of an RC circuit on the LED input.
I didn't have the exact same values available, so I used the closest I could find.
To be able to test the sensor, I soldered breadboard friendly headers on the sensor cable.
The test setup:
The white cone contains a fan used to create an airflow to the sensor. I plan on 3D printing a more compact version so that it will fit inside the build.
In the circuit above, the fan is always on. This will not be the case in the final solution: the fan should be turned on before sampling, and turned off after it.
Through testing, I will need to find the best timing between turning the fan on and sampling, as initially, turning the fan on might give different results (dust on fan blowing through sensor).
Sketch
Based on the datasheet information on sampling timing, I made a quick Arduino sketch i order to test the sensor and the circuit.
The resulting sketch is as follows:
int sensorPin = A0; int sensorValue = 0; int ledPin = 2; int delaySampling = 280; // wait 280 us before sampling after turning on LED int delayLed = 40; // wait 40 us after sampling before turning off LED int delayCycle = 10000 - delaySampling - delayLed; // 10ms cycle void setup() { Serial.begin(9600); pinMode(sensorPin, INPUT); pinMode(ledPin, OUTPUT); digitalWrite(ledPin, HIGH); // turn LED off } void loop() { digitalWrite(ledPin, LOW); // turn LED on delayMicroseconds(delaySampling); // wait before sampling sensorValue = analogRead(sensorPin); // sample delayMicroseconds(delayLed); // wait before turning LED off digitalWrite(ledPin, HIGH); // turn LED off delayMicroseconds(delayCycle); // wait for end of cycle Serial.print("Sensor Value: "); Serial.println(sensorValue); float voltage = sensorValue * (5.0 / 1023.0); Serial.print("Voltage Value: "); Serial.println(voltage); Serial.println(); delay(1000); }
Measurements
I performed two measurements for initial testing.
The first test, was to use the sensor as is, measuring the dust concentration in the room.
The second, was to trigger an extreme condition using a smoking matchstick.
The change in value is clearly indicating the smoke was detected. Looking further in the datasheet, following graph is provided.
The maximum value in the graph matches the result when using the smoking matchstick, meaning a density larger than 0.6mg/m3.
As for the dust, it would seem there is an approximate concentration of 0.05mg/m3 in the room I was testing.
I'll be testing the sensor further and porting the Arduino code to the Launchpad (which should be straightforward with Energia ?!).
I'm curious to see the results when measuring in different rooms (who has the dirtiest room).
Top Comments