Case 72: The Smoke Detection Fan
Make a dust detection device to automatically turn on the fan for ventilation when the dust concentration is too high.
The structure is built as shown in the figure:
In the diagram below, connect the Dust Sensor to the J1 port and the Motor Fan to the J2 port of the Nezha Board.
Click "Extensions" in the MakeCode Drawer.
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.
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.
Write the program as shown in the figure
You can also download the program directly from the following webpage and start running the program once the download is complete.
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.