Difference between revisions of "Sensor-Dust"

From Microduino Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|-
 
|-
 
|
 
|
[[File: Microduino-Dust.jpg|400px|thumb|right| Sensor-Dust]]
+
[[File: Microduino-Dust.jpg|200px|thumb|right| Sensor-Dust]]
 
The product number of Sensor-Dust is: '''MSDT62'''
 
The product number of Sensor-Dust is: '''MSDT62'''
  
Line 9: Line 9:
  
 
==Sensor Pin Introduction==
 
==Sensor Pin Introduction==
{{Sensor_explain
+
{{ST_Pinout
|nameA=[[Sensor-Dust]]
+
|st_name=Dust Sensor
|modeA=Soft serial port tx
+
|pin3=Analog Input
|modeB=Soft serial port rx
 
 
}}
 
}}
 +
 
==Features==
 
==Features==
 
*Adopt SHARP GP2Y1010AUOF air quality sensor;  
 
*Adopt SHARP GP2Y1010AUOF air quality sensor;  
Line 19: Line 19:
  
 
==Specification==
 
==Specification==
*Working voltage: 4.5V~5.5V
+
*Sensor voltage  
*Detection sensitivity: 0.5V/0.1mg/m3
+
**3.3V~5V working voltage
*1.27mm-spacing 4Pin-to-6Pin interface
+
 
*Soft serial port (D4, D5) communication
+
*Sensor size
 +
**Board size: 23.5mm*13mm
 +
**1.27mm-spacing 4Pin connected with sensorhub
 +
**The CAD drawing of the sensor: '''[[File:Sensor_CAD.zip]]'''
 +
 
 +
*Connection
 +
**This sensor can be connected to the  following interfaces: '''D4/D5'''
  
 
==Document==
 
==Document==
*Schematic: '''[[File: Microduino_Dust.Zip]]'''
+
*Schematic diagram: '''[[File: Sensor-Dust.Zip]]'''
 +
*Main sensor: '''[[File:Sensor-Dust_datasheet.pdf ]]'''
  
 
==Development==
 
==Development==
  
Microduino-Dust can be applied in outdoor air quality detection or indoor dust detection.
+
===Program Download===
 +
*Download and unzip the program '''[[File:Sensor-Dust_Test.zip]]'''
  
==Application==
+
===Programming===
*All hardware needed: [[Microduino-CoreUSB]], [[Microduino-Sensorhub]], [[Sensor-IO Split]], a USB cable and several wires; 
+
{{Upload
** Make sure you build Microduino IDE or refer to: [[Microduino Getting started]]
+
|nameA=[[Microduino-Core]], [[Microduino-USBTTL]]
*Program
+
|nameB=[[Microduino-USBTTL]]
<source lang="cpp">
+
|boardName=Microduino/mCookie-Core(328p), Atmega328P@16M,5V
 +
|fileName=Sensor-Dust Test.ino
 +
}}
  
#include <SoftwareSerial.h>
+
===Hardware Setup===
SoftwareSerial pmSerial(4, 5);  //PM2.5 sensor soft serail port
+
*Referring to the following diagram, connect the Sensor-Dust to digital interface D4/D5 of '''[[Microduino-Sensorhub]]'''.
#define INTERVAL_pm25            200
+
<br>
unsigned long pm25_time = millis();
+
[[file:Microduino-sensorhub_Dust.JPG|thumb|400px|left]]
 +
<br style="clear: left"/>
 +
===Result===
 +
*After download, open the serial monitor.
 +
*The detected PM2.5 intensity will be printed out in cycle in the serial monitor.
  
void setup() {
+
==Application==
  Serial.begin(9600); // See the connection status in Serial Monitor
+
It can be used to detect the air quality and indoor dust and so on.
  pmSerial.begin(2400);  //start the soft serial port at first
 
}
 
 
 
void loop() {
 
  if (pm25_time > millis()) pm25_time = millis();
 
  if (millis() - pm25_time > INTERVAL_pm25) {
 
    Serial.println(PM25()) ;
 
    pm25_time = millis();    //update the counter
 
  }
 
}
 
 
 
float PM25() {
 
  int data_s = 0;    //serial receives the data
 
  int num = -1;      //serial receives the data and counts
 
  int sum = 0;      //checksum
 
  int cal[5];        //receive the data buffer
 
  float dustDensity = 0;  //PM2.5 intensity
 
 
 
  pmSerial.listen();
 
  while (1) {
 
    if (pmSerial.available() > 0) { //serail cache data
 
      data_s = pmSerial.read();  //read the serial cache data
 
      if (data_s == 0xAA) {        //attain the starting position of the data frame
 
        num = 0;                  //start to count
 
      }
 
      else if (num >= 0) {
 
        cal[num++] = data_s; //read teh data and the number+1, and store the data into the buffer
 
        if (num == 6) {        //read to the last bit of the data frame
 
          sum = cal[0] + cal[1] + cal[2] + cal[3];  //calculate the checksum
 
          if (sum == cal[4] && cal[5] == 0xFF) {    //checksum match, the last bit of the data frame is 0xFF, representing the data frame received is normal
 
            dustDensity = (cal[0] * 256 + cal[1]) * (5.0 / 1024) * 550; //calculate the PM2.5 intensity, in ug/m3
 
          }
 
          else {    //the data received is abnormal
 
            dustDensity = 0;    //clear the intensity
 
          }
 
          break;
 
        }
 
      }
 
    }
 
  }
 
  pmSerial.stopListening();
 
  return dustDensity ;
 
}
 
</source>
 
*Software:
 
*Stack all modules together and then connect the Dust sensor's fan control interface with the D10 pin of the Sensorhub with a wire.
 
*Connect Microduino-Dust sensor's control detection interface to the IO splitter's IN interface with a wire. And then connect the IO splitter's A-OUT interface to Sensorhub A0, the IO splitter's *B-OUT interface to Sensorhub D12.
 
*Open Arduino IDE, copy the program to IDE and then choose the right board from Tools→Board and then compile.
 
*Select the right port from Tools→Serial Port in Arduino IDE after compiling, then download program.
 
*After the download, you can open the serial monitor. After the Dust sensor's fan works for three seconds, the serial console will display the current air dust density and the Dust sensor will have another detection after one second.
 
  
 
==Purchase==
 
==Purchase==
  
 
==History==
 
==History==

Latest revision as of 23:22, 30 March 2017

Language: English  • 中文
Sensor-Dust

The product number of Sensor-Dust is: MSDT62

Microduino-Dust is a PM2.5 sensor.

Sensor Pin Introduction

Sensor backpin.png

Dust Sensor
General Pin Out Sensor / Trinket's Pin Out
PIN1 (GND) GND
PIN2 (VCC) VCC
PIN3 (SIGNAL-A) Analog Input
PIN4 (SIGNAL-B) Not Connected
  • General Pin Out is the standard pin out of a Sensor / Trinket connector.
  • Sensor / Trinket's Pin Out is this specific Sensor / Trinket's wiring in relation to the General Pin Out.
  • SIGNAL-A / SIGNAL-B are signals that could be digital input, digital output, analog input or analog output. Or special signals such as serial communication (SoftwareSerial, IIC (I2C), etc) or other special signals.
  • Not Connected refers to the Pin not being used for this particular Sensor / Trinket.
  • Read more about the hub module.

Features

  • Adopt SHARP GP2Y1010AUOF air quality sensor;
  • Serial port communication.

Specification

  • Sensor voltage
    • 3.3V~5V working voltage
  • Sensor size
    • Board size: 23.5mm*13mm
    • 1.27mm-spacing 4Pin connected with sensorhub
    • The CAD drawing of the sensor: File:Sensor CAD.zip
  • Connection
    • This sensor can be connected to the following interfaces: D4/D5

Document

Development

Program Download

Programming

  • Follow the Software Getting Started Guide.
  • Select the Board, Processor and Port.
  • Click [File]->[Open], browse to the project program address, and click "Sensor-Dust Test.ino" to open the program.
  • After confirming all these items are correct, click "→" to download the program to the development board.

Hardware Setup

  • Referring to the following diagram, connect the Sensor-Dust to digital interface D4/D5 of Microduino-Sensorhub.


Microduino-sensorhub Dust.JPG


Result

  • After download, open the serial monitor.
  • The detected PM2.5 intensity will be printed out in cycle in the serial monitor.

Application

It can be used to detect the air quality and indoor dust and so on.

Purchase

==History==