7. iot:kit case01:Air quality monitoring¶
7.1. Our goal¶
Let’s make an air quality monitoring.
7.2. Required materials¶
1 x IOT:kit https://www.elecfreaks.com/store](https://www.elecfreaks.com/store/micro-bit-smart-science-iot-kit-with-micro-bit.html)
What is the IOT¶
IoTThe Internet of things (IoT) is the network of devices such as vehicles, and home appliances that contain electronics, software, sensors, actuators, and connectivity which allows these things to connect, interact and exchange data.The IoT involves extending Internet connectivity beyond standard devices, such as desktops, laptops, smartphones and tablets, to any range of traditionally dumb or non-internet-enabled physical devices and everyday objects. Embedded with technology, these devices can communicate and interact over the Internet, and they can be remotely monitored and controlled.
7.4. Hardware connection¶
As below picture, connect
LED IN of the dust sensor to
Connect the OLED screen to the
Click on “Advanced” in the MakeCode Drawer to see more code sections.
We need to add an extension for coding to the IOT. Click on the “Extension” at bottom of coding drawer, then Search for “IOT” and click on the IOT package to add it to your project. (As below picture)
Note：If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Project file menu.
initialize OLED block into the
on start and write parameters
Initialize the OLED screen to
clear OLED display,
show string and
show number blocks into the forever as below picture.
Dust(ug/m3):to display returned value of the dust sensor.
60s, once a minute.
If you don’t want to type these code by yourself, you can directly download the whole program from the link below:
The dust particle number will be displayed every minute.
How do you do to make it alarm when the air is in bad quality?