Skip to content

Commit 05a4f12

Browse files
committed
Dust sensor with Arduino Code and Schematic
1 parent d78ce81 commit 05a4f12

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# [Interfacing DHT11 Humidity & Temperature Sensor with Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-dht11-sensor-with-arduino)
2+
3+
<img src="https://github.com/Circuit-Digest/Basic-Arduino-Tutorials-for-Beginners-/blob/ec149c466027bbd156a00ae7c4e91f3619728856/Interfacing%20DHT11%20Sensor%20With%20Arduino/2022-05-12.jpg" width="" alt="alt_text" title="image_tooltip">
4+
<br>
5+
6+
<br>
7+
<a href="https://circuitdigest.com/tags/arduino"><img src="https://img.shields.io/static/v1?label=&labelColor=505050&message=Arduino Basic Tutorials Circuit Digest&color=%230076D6&style=social&logo=google-chrome&logoColor=%230076D6" alt="circuitdigest"/></a>
8+
<br>
9+
10+
[<h1>Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.</h1>
11+
12+
13+
<br>
14+
<br>
15+
<br>
16+
DHT11 Temperature & Humidity Sensor features a temperature & humidity sensor
17+
complex with a calibrated digital signal output. The exclusive digital-signal-acquisition technique and temperature & humidity sensing technology ensure high reliability and excellent long-term stability. This sensor includes an NTC for temperature measurement and a resistive-type humidity measurement component for humidity measurement. These are connected to a high-performance 8-bit microcontroller, offering excellent quality, fast response, anti-interference ability and cost-effectiveness.
18+
<br>
19+
[Note: As this projects are very simple we are only providing the code, schemaitic, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website.]
20+
<br>
21+
<br>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Sharp Optical Dust Sensor GP2Y1014AU0F get data
3+
*/
4+
5+
int measurePin = 0; //Connect dust sensor to Arduino A0 pin
6+
int ledPower = 7; //Connect 3 led driver pins of dust sensor to Arduino D2
7+
8+
int samplingTime = 280;
9+
int deltaTime = 40;
10+
int sleepTime = 9680;
11+
12+
float voMeasured = 0;
13+
float calcVoltage = 0;
14+
float dustDensity = 0;
15+
16+
void setup(){
17+
Serial.begin(9600);
18+
pinMode(ledPower,OUTPUT);
19+
}
20+
21+
void loop(){
22+
digitalWrite(ledPower,LOW); // power on the LED
23+
delayMicroseconds(samplingTime);
24+
25+
voMeasured = analogRead(measurePin); // read the dust value
26+
27+
delayMicroseconds(deltaTime);
28+
digitalWrite(ledPower,HIGH); // turn the LED off
29+
delayMicroseconds(sleepTime);
30+
31+
// 0 - 5V mapped to 0 - 1023 integer values
32+
// recover voltage
33+
calcVoltage = voMeasured * (5.0 / 1024.0);
34+
35+
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
36+
// Chris Nafis (c) 2012
37+
dustDensity = 170 * calcVoltage - 0.1;
38+
39+
40+
Serial.println(dustDensity); // unit: ug/m3
41+
42+
delay(1000);
43+
}
Loading
Loading

0 commit comments

Comments
 (0)