Case 01: Water Backflow Prevention Device in Subway
Contents
3. Case 01: Water Backflow Prevention Device in Subway#
3.1. Introduction#
There are many ways to travel in cities, and the subway has gradually become the preferred means of transportation for people because of its fast, convenient, and comfortable features. Subway are mostly constructed in the underground. Strong rainstorms are very likely to cause rainwater intrusion accidents at subway entrances and exits, the water accumulation in the stations may trap people, damage the equipment, affect the normal operation of the subway. Therefore, we can design a water backflow prevention device, when it detects the water level exceeds the threshold, the waterproof baffle is automatically raised to prevent rainwater from backflow.
3.2. Function#
Detect the water level on the export of the subway with the water level sensor, if the value is over the threshold, program to lift the barrier automatically.
3.3. Products Link#
3.4. Picture#
3.5. Hardware Connection#
Connect the water level sensor to P1 and the servo to P2 on IoT:bit.
3.6. Software Programming#
Click “Advanced” in the MakeCode to see more choices.
For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “iot-environment-kit” in the dialogue box to download it.
For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “servo” in the dialogue box to download it.
Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.
3.7. Program#
Save the returned water level value as the variable “water_level”.
Judge if the variable is over the threshold, if yes, set to display “×” or to go ahead.
If yes, it also indicates that the water level has risen to a risk value, now program to use the servo to lift the barrier in case of the backflow; if the water level returns to normal, the barrier would be put down.
3.8. Result#
If the water level is over the threshold, an icon “x” shall diaply on the micro:bit to remind people of not passing and the barrier gets lifted; if the water level is not over the threshold, the micro:bit shall display the keep-going icon and the barrier is put down.