Testing a sensor from here.

http://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor

It's a dust sensor. Everyone can buy it anywhere also. It's a cheep one actually.

We can find its document here: http://www.seeedstudio.com/wiki/images/4/4c/Grove_-_Dust_sensor.pdf

It looks good.

It's more cheaper if you buy it from taobao.com or other whole sellers.

Now cut the crap, just send me those codes here:

/* Grove - Dust Sensor Demo v1.0
Interface to Shinyei Model PPD42NS Particle Sensor
Program by Christopher Nafis
Written April 2012 http://www.seeedstudio.com/depot/grove-dust-sensor-p-1050.html
http://www.sca-shinyei.com/pdf/PPD42NS.pdf JST Pin 1 (Black Wire) => Arduino GND
JST Pin 3 (Red wire) => Arduino 5VDC
JST Pin 4 (Yellow wire) => Arduino Digital Pin 8
*/ int pin = ;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = ;//sampe 30s ;
unsigned long lowpulseoccupancy = ;
float ratio = ;
float concentration = ; void setup() {
Serial.begin();
pinMode(,INPUT);
starttime = millis();//get the current time;
} void loop() {
duration = pulseIn(pin, LOW);
lowpulseoccupancy = lowpulseoccupancy+duration; if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s
{
ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100
concentration = 1.1*pow(ratio,)-3.8*pow(ratio,)+*ratio+0.62; // using spec sheet curve
Serial.print(lowpulseoccupancy);
Serial.print(",");
Serial.print(ratio);
Serial.print(",");
Serial.println(concentration);
lowpulseoccupancy = ;
starttime = millis();
}
}

Here's what you can get

via serial promte, you can see:

For more information , you can check this out the link above.

Now please let me explain it from the bottom of it:

Let's see what the spec sheet carve of it:

The curve indicates that the bigger of the Concentration value is, the higher of the Low Pluse Occupancy will be.

So what's the Low Pulse Occupancy Time perentage for?

Let's check out this:

we count the time from the starting moment of the low pulse begins until the moment of next high pulse stops.

The time we can get is the cycle period. We can caculate the ratio of the LowPluseOccupancyTime/TheTimeWeSetToMeasure

    # radio = LowPluseOccupancyTime/TheTimeWeSetToMeasure

With help of the chart which indicates the relationship of between the LowPulseOccupancyTimePercentage and the concentration, we can get the air quality value.

the unit of the concentration is   : PCS/Liter.

PCS/liter is short for Particals / Liter

####################3

P.S. : There is another good air quality measuring module which looks like this :https://www.sparkfun.com/products/9689

I haven't tested it. But it looks neat and somehow better I guess.

So my next project will have something to do with a LIVE BROADCASTING AIR QUALITY STATION!

Let's see :)

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测的更多相关文章

  1. Arduino 各种模块篇 光敏感应模块 light sensor

    It looks like this one: This one isn't a digital light sensor, so it's very simple. http://www.seeed ...

  2. Arduino 各种模块篇 摇杆模块

    Arduino的另外几种模块,我们常见的joystick摇杆模块. 用起来很爽,摇杆 有X,Y轴可调 这里有一篇非常想尽的示例代码: http://www.geek-workshop.com/foru ...

  3. Arduino 各种模块篇 蓝牙模块 手机蓝牙控制Arduino LED灯

    解决方案. 条件: 1.手机android 商店下载 blueTerm 2.向arduino中载入如下代码: char val; ; void setup() { Serial.begin(); pi ...

  4. Arduino 各种模块篇 motor shield

    根据arduino官方网站出的shield, 类似的情况有很多中motor shield 这里测试采用的是http://www.seeedstudio.com/wiki/Motor_Shield_V1 ...

  5. Arduino 各种模块篇 震动模块 vibrator module

    The vibrator I got works at the voltage ranging from 3.3V ~ 5.5V I want to make it vibrate variably. ...

  6. Arduino 各种模块篇 GPRS module 手机模块 短信 电话 上网 for texting, calling, internet

    ---恢复内容开始--- The GPRS shield which I tested is one which looks like this: ---恢复内容结束--- Need to be re ...

  7. Arduino 各种模块篇 震动模块 vibrator

    vibrator is a good thing. it has multi-funtionality . :) Now the  vibrator we choose is the one whic ...

  8. Arduino 各种模块篇 RGB LED灯

    示例代码: 类似与这样的led,共阴rgb led,通过调节不同的亮度,组合成不同的颜色. 示例代码: /* 作者:极客工坊 时间:2012年12月18日 IDE版本号:1.0.1 发布地址:www. ...

  9. 【雕爷学编程】Arduino动手做(42)---PM2.5粉尘传感器

    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的.鉴于本人手头积累了一些传感器和模块,依照实践(动手试试)出真知的理念,以学习和交流为目的,这里准备 ...

随机推荐

  1. cocos2d-x 3.0 rapidJson 解析操作应该注意的细节

    Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstanc ...

  2. android如何判断服务是否正在运行状态

    如何检查后台服务(Android的Service类)是否正在运行?我希望我的Activity能够显示Service的状态,然后我可以打开或者关闭它. /** * 判断服务是否处于运行状态. * @pa ...

  3. UiAutomator源码分析之获取控件信息

    根据上一篇文章<UiAutomator源码分析之注入事件>开始时提到的计划,这一篇文章我们要分析的是第二点: 如何获取控件信息 我们在测试脚本中初始化一个UiObject的时候通常是像以下 ...

  4. CSS中选择器优先级顺序实战讲解

    原文:CSS中选择器优先级顺序实战讲解 我们有些程序猿在给一个元素(比如div)应用样式的时候,会有一些疑问,为什么我写在后面的样式不能覆盖前面的样式呢,不是说CSS是层叠样式表吗? 如果你在开发中也 ...

  5. C语言生成2000w行数据

    最近一直抽空学习shell,脚本语言看多了多多少少有些蛋疼不适,所以捡起以前遇到的一个C语言的问题看看. 原先应该是在C++吧关注的一个帖子,楼主为了测试数据库性能需要如下形式的数据要求: 字符串长度 ...

  6. C++中的左值和右值

    左值和右值的定义 在C++中,能够放到赋值操作符=左边的是左值,能够放到赋值操作符右边的是右值.有些变量既能够当左值又能够当右值.进一步来讲,左值为Lvalue,事实上L代表Location,表示在内 ...

  7. 实例学习SSIS(二)--使用迭代

    原文:实例学习SSIS(二)--使用迭代 导读: 实例学习SSIS(一)--制作一个简单的ETL包 实例学习SSIS(二)--使用迭代 实例学习SSIS(三)--使用包配置 实例学习SSIS(四)-- ...

  8. webapp 开发调试测试方法总结

    好久都没有发表过日志了,反正近期项目也已经接近尾声了,那么是时候该总结一下在项目中用到的技术了,请看:这里先废话几句,我们现在的开发模式是这样子的:先把本地的网页上传到远程服务器(因为好多设备都要去访 ...

  9. win8安装tfs2010提示未启用iis6.0未启用兼容模式需要静态内容组件

    笔者的电脑由于安装TFS2010就提示这个错误,当时网上也没有很好地办法,重装iis组件也不行.如果你同样没有找到更好的办法,建议安装tfs2012,但在vs2010使用tfs2012是无法创建团队项 ...

  10. QMVC

    高性能.NET MVC之QMVC! ASP.NET!这个词代表者一个单词Fat!因为他总是捆绑着太多的太多的类,太多太多的各种功能!你也许会用到,如果你反编译或阅读他们开源的源码,你会不会犹如在大海中 ...