76. Case 72: The Smoke Detection Fan#

76.1. Introduction#

Make a dust detection device to automatically turn on the fan for ventilation when the dust concentration is too high.

../../_images/neza-inventor-s-kit-case-72-01.png

76.2. Case building#

Required equipment#

ELECFREAKS micro:bit Nezha 48 IN 1 Inventor’s Kit

ELECFREAKS PlanetX Dust Sensor

ELECFREAKS PlanetX Motor Fan

Assembly steps#

Parts List

../../_images/neza-inventor-s-kit-case-72-02.png

The structure is built as shown in the figure:

../../_images/neza-inventor-s-kit-step-72-01.png

../../_images/neza-inventor-s-kit-step-72-02.png

../../_images/neza-inventor-s-kit-step-72-03.png

../../_images/neza-inventor-s-kit-step-72-04.png

../../_images/neza-inventor-s-kit-step-72-05.png

../../_images/neza-inventor-s-kit-step-72-06.png

../../_images/neza-inventor-s-kit-step-72-07.png

../../_images/neza-inventor-s-kit-step-72-08.png

../../_images/neza-inventor-s-kit-step-72-09.png

../../_images/neza-inventor-s-kit-step-72-10.png

../../_images/neza-inventor-s-kit-step-72-11.png

../../_images/neza-inventor-s-kit-step-72-12.png

Connection schematic#

In the diagram below, connect the Dust Sensor to the J1 port and the Motor Fan to the J2 port of the Nezha Board.

microbitKit/Nezha_Inventor_s_kit_for_microbit/images/neza-inventor-s-kit-case-72-04.png

76.3. Makecode Programming#

Step 1#

Click “Extensions” in the MakeCode Drawer.

../../_images/neza-inventor-s-kit-case-37-04.png

In order to program the Dust sensor, we need to add an extension library. Search with “PlanetX” in the dialog box to download this library.

../../_images/neza-inventor-s-kit-case-37-05.png

*Note: *If you get a prompt saying that some code libraries will be removed for incompatibility reasons, you can either follow the prompt and continue, or create a new project inside the project menu bar.

Step 2#

Write the program as shown in the figure#

../../_images/neza-inventor-s-kit-case-72-06.png

Reference Program#

Link:https://makecode.microbit.org/_PDhL3PeJkJtV

You can also download the program directly from the following webpage and start running the program once the download is complete.

Results#

The dust sensor is used to detect the dust concentration of the current environment, and when the dust concentration is too high, the fan is turned on for automatic ventilation.

../../_images/neza-inventor-s-kit-case-72.gif