製作1個自動灌溉系統
透過soil moisture sensor得到泥土的濕度後,便能運用這個數據判斷泥土是否太乾枯,需不需要灌溉.
當太乾枯的時候,便啟動水泵灌溉. 灌溉後,泥土變回濕潤時水泵便會自動關閉.
需要的物料 :
- micro:bit x 1
- I/O board x 1
- soil moisture sensor x 1
- water pump x 1
- 12" M/M Jumper Wires x 3
- Crocodile Clip with Pigtail - male jumper connector x 2
由於我們需要連接water pump來泵水,所以需要使用I/O board來推動馬達(water pump).
**weather:bit並不能推動馬達
soil moisture sensor 在 I/O board的接駁方法 :

Coding 概覽 :

只需要用analog read pin 便可以得到泥士濕度的數據
接著便可以接駁water pump,由於water pump是1個output(motor),
所以我們要把它連到OUTPUT的PIN上,這次我們選擇的是P13.

一般來說,water pump 上有粉紅色標記的connector是負責吸水 , 請用較短的水管接駁
另1邊是泵水,請用較長的水管接駁以方便運水.但還請自行測試

Coding 概覽 :

analog read pin 的數字只供參考, 請自行微調.