005 - Brickcell Fine Dust | MakeCode Microbit
Introduction
Fine Dust sensor also known as Particulate Matter(PM) sensor is a device used to measure the concentration of fine particulate matter in the air. Fine particulate matter refers to tiny, airborne particles or droplets that can be inhaled into the respiratory system and can have adverse effects on human health and the environment. These particles are often categorized based on their size, with PM2.5 and Pm10 begin common size classifications.
Particle Detection
The sensor contains a mechanism for detecting airborne particles. This can be done using various methods, including light scattering, laser technology, or electrical charges.
Data Processing
Once particles are detected, the sensor processes the data to quantify the concentration of particulate matter in the air. It can differentiate between different particle sizes, such as PM2.5 (particles with a diameter of 2.5 micrometers or smaller) and PM10 (particles with a diameter of 10 micrometers or smaller).
Output
The sensor provides output in the form of concentration measurements, often in units such as micrograms per cubic meter or other relevant units. This data can be displayed on a screen or transmitted to a monitoring system for further analysis.
Hardware Instruction
Let's explore how to connect the Fine Dust sensor to a micro:bit microcontroller and utilize MakeCode for programming.
- Connect the Fine Dust sensor GND pin to microbit GND pin.
- Connect the Fine Dust sensor VCC pin to microbit VCC pin.
- Connect the Fine Dust sensor voltage output pin (Vo) to microbit pin 0.
- Connect the Fine Dust sensor led control (LED) to microbit pin 1.
Software Instruction
Now, let's start into programming the micro:bit to utilize the Fine Dust sensor.
- Login to https://makecode.microbit.org/ using your Microsoft account.
- Create a new project by clicking the "New Project" button. You may name it anything you want, I suggest to name it with descriptive name such as "dust-gp2y10-test".
- Click the "Extensions" block just under the "Math" block.
- Type https://github.com/gbantique/brickcell-dust-gp2y10/ on the search bar.
- Select the "brickcell-dust-gp2y10" from the search results. The "fine dust" block should appear under the "Brickcell" block.
- Copy the code provided below.
1Brickcell.initializeFineDustSensor(AnalogPin.P0, DigitalPin.P1)
2serial.setBaudRate(BaudRate.BaudRate115200)
3basic.forever(function () {
4 serial.writeNumber(Brickcell.readFineDust())
5 serial.writeString("" + ("\r\n"))
6 basic.pause(2000)
7})
- Open a Serial Monitor such as Termite terminal app https://www.compuphase.com/software_termite.htm/. Set the baud rate to 115200 bps.
Or you make a copy of my created project in your MakeCode workspace.
https://makecode.microbit.org/S02369-13902-13078-44505/
Expected Result
If you carefully follow the provided instruction above, you should be able to view the measured air particles on the serial terminal every 2000 milliseconds.
Posts in this series
- 016 - Brickcell 8x16 Dot Matrix Display | MakeCode Microbit
- 015 - Brickcell 8x8 Dot Matrix Display | MakeCode Microbit
- 014 - Brickcell CO2 SGP30 | MakeCode Microbit
- 013 - Brickcell Gesture APDS9960 | MakeCode Microbit
- 012 - Brickcell Rotary Encoder | MakeCode Microbit
- 011 - Brickcell RTC DS3231 | MakeCode Microbit
- 010 - Brickcell Gyro MPU6050 | MakeCode Microbit
- 009 - Brickcell TOF VL53L0X | MakeCode Microbit
- 008 - Brickcell Color TCS34725 | MakeCode Microbit
- 007 - Brickcell Pressure BMP280 | MakeCode Microbit
- 006 - Brickcell Weight HX711 | MakeCode Microbit
- 004 - Brickcell Ultrasonic HCSR04 | MakeCode Microbit
- 003 - Brickcell NTC Temperature | MakeCode Microbit
- 002 - Brickcell DHT11 | MakeCode Microbit
- 001 - Brickcell LCD I2C | MakeCode Microbit
No comments yet!