Micro:bit Game: Pitch Perfect
January 7, 2019Friday Product Post: PM2.5, Wind Speed and Joystick Case
January 7, 2019Introduction
PM 2.5 sensor is a professional sensor for detecting PM2.5 and PM10. It is used for testing the air quality. It has good consistency and high accuracy,which can be accurate to a single unit of digit.
Shipping List
1 x Octopus PM2.5 PM10 Detector Sensor Module
Hardware
Features
- Accuracy:Laser detection, stable and consistent.
- Fast Response: Less than 10 seconds’ response to the occasion change.
- Easy to Integrate:Serial port output, with a built-in fan.
- High resolution:Enable to recognise particles with diameters smaller to 0.3um.
- Working Voltage???V
- Max Working Current???00mA
- Sleep Current???mA
- Working Temperature???20-50???/li>
- Data Output Time??? second
- Serial Port Data Sending Frequency:1 time per second
- Relative Tolerance???0%
- Product Dimension???1x70x23mm
Application
- Available to be applied to PM2.5 detectors, air purifiers, filtering systems, etc..
Pins Instruction
Pin | Name | Note |
---|---|---|
1 | NC | NC |
2 | 1um | >0.3um particle intensity, PWM output |
3 | 5V | 5V power input |
4 | 25um | >2.5um particle intensity, PWM output |
5 | GND | Ground |
6 | RXD | Serial port receive RX |
7 | TXD | Serial port send TX |
Dimension:
Data Output
Read by PWM
Read by Serial Port
Serial Port Protocol:96008N1.(Speed Ratio 9600, 8 bits, no parity, 1 stop bit) Serial Port Report Time: 1+0.5 second Data Frame???0 byte):header+command+data(6 byte)+checksum+tail 0 header AA 1 command C0 2 data 1 PM2.5 lower byte 3 data 2 PM2.5 high byte 4 data 3 PM10 lower byte 5 data 4 PM10 high byte 6 data 5 0(retain) 7 data 6 0(retain) 8 checksum checksum 9 tail AB Checksum:Sum from data 1 to data 6. PM2.5 data content: PM2.5(ug/m3) = ((PM2.5 high byte x 256) + PM2.5 lower byte)/10 PM10 data content:PM10(ug/m3) = ((PM10 high byte x 256) + PM10 lower byte )/10
Example
Arduino
Circuit Connection
Connect PM2.5 GVS to A0 on the Arduino UNO, and connect PM10 GVS to A1 on the Arduino UNO.
Code
#define pm25Pin 14 #define pm10Pin 15 void setup() { pinMode(pm25Pin, INPUT); pinMode(pm10Pin, INPUT); Serial.begin(9600); } void loop() { Serial.print("PM2.5 = "); Serial.println(pulseIn(pm25Pin, HIGH, 1500000) / 1000 - 2); Serial.print("PM10 = "); Serial.println(pulseIn(pm10Pin, HIGH, 1500000) / 1000 - 2); }
Micro:bit
Circuit Connection
Connect PM2.5 GVS to P15 on the micro:bit breakout board, and connect PM10 GVS to P16.
Code
For the whole code, see this link: https://makecode.microbit.org/_83oYC4DcVc5z Or you can click Downloadin the page below to download all example code.
Other
Relative Accessary
Freaduino UNO Rev2.2 MB_EFUNO
BBC Micro:bit Board for Coding & Programming
ElecFreaks Micro:bit Breakout Board ( Octopus:bit)