owned this note
owned this note
Published
Linked with GitHub
---
title : 智慧盆栽守護者
type : slide
slideOptions:
transition: slide
---
# 智慧盆栽守護者
## 27蔡宸睿 28蔡雁丞
---
# 壹、動機與目的
----
在現代都市生活中,許多人因為工作繁忙,常常忽略了對盆栽的日常照護,導致植物枯萎死亡。本專題旨在設計一套自動監控與澆灌系統,利用土壤濕度感測、自動灌溉與即時回饋的方式,實現「智慧盆栽守護者」的構想,協助使用者輕鬆養護植物,降低植物死亡率。
----
本電路特別適用於:
- **長期不在家的上班族**
- **缺乏植物照護經驗的初學者**
- **教學與STEM教育應用場景**
我們的目的是建構一個低成本、可擴充、具有互動性的智慧園藝解決方案。
---
# 貳、設計理念
----
本報告整合感測器、灌溉模組、蜂鳴警示、RGB視覺提示等多重輸出裝置,提供以下功能:
1. **即時土壤濕度感測**:避免過度或不足澆水
2. **自動澆灌邏輯**:控制水泵精準啟動與冷卻時間
3. **多重提示輸出**:蜂鳴器、RGB燈可視化資訊
4. **人因工程考量**:訊息清楚明確,顏色與聲音便於使用者辨識
---
# 参、硬體架構
----
# 架構
| **元件** | **功能** |
| -------- | -------- |
| Arduino Uno | 控制電路 |
| 土壤濕度感測器 | 得到土壤濕度 |
| 繼電器 | 控制水泵開關|
| 有緣蜂鳴器 | 提醒使用者植物缺水 |
| RGB LED | 顯示濕度等級 |
----

----
## 土壤濕度感測器

S:data
+:5V
-:GND
----
## 繼電器

$$
V_{out} = \begin{cases} V_{cc_{out}} &\text {if $IN=V_{cc_{in}}$} \\
0 &\text{if $IN=GND$}
\end{cases}
$$
----
## RGB LED

red | common anode | green | blue
---
# 肆、程式說明
----
## 1.初始化
```cpp=
const int sensorPin = A0;
const int relayPin = 8;
const int buzzerPin = 9;
const int redPin = 5;
const int greenPin = 6;
const int bluePin = 7;
const unsigned long wateringDuration = 3500;
const unsigned long wateringCooldown = 10000;
unsigned long lastWateredTime = 0;
int melody[] = {262, 294, 330, 349, 392, 440, 494, 523};
int noteDurations[] = {4, 4, 4, 4, 4, 4, 4, 4};
```
----
## 1.初始化
```cpp=
void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW);
pinMode(buzzerPin, OUTPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
```
----
## 2.濕度偵測
```cpp= [|2-3|4]
void loop(){
int sensorValue = analogRead(sensorPin);
int moisturePercent = map(sensorValue, 0, 400, 0, 100);
moisturePercent = constrain(moisturePercent, 0, 100);
}
```
----
## 3.澆水邏輯
```cpp= [|3|4-7|8]
void loop(){
// ...
if (moisturePercent < 20 && millis() - lastWateredTime > wateringCooldown) {
digitalWrite(relayPin,HIGH);
playMelody();
delay(wateringDuration);
digitalWrite(relayPin, LOW);
lastWateredTime = millis();
} else {
digitalWrite(relayPin, LOW);
}
}
```
----
## 4.播放美妙的音樂
```cpp=
void playMelody() {
for (int i = 0; i < 8; i++) {
int noteDuration = 1000 / noteDurations[i];
tone(buzzerPin, melody[i], noteDuration);
delay(noteDuration * 1.3);
}
noTone(buzzerPin);
}
```
----
## 5.發出閃耀的亮光
```cpp=
void loop(){
// ...
if (moisturePercent > 70) {
setRGB(0, 255, 0);
} else if (moisturePercent > 30) {
setRGB(255, 255, 0);
} else {
setRGB(255, 0, 0);
}
}
void setRGB(int r, int g, int b) {
analogWrite(redPin, r);
analogWrite(greenPin, g);
analogWrite(bluePin, b);
}
```
---
# 伍、實體展示
---
# 陸、結論與發展
----
### 優點
- 可以自動澆灌
- 便宜、構造簡單
- 人性化的提示系統
----
### 缺點
- 因素過少(陽光、溫度)
- 無法泛用於各種土壤與植物
- 無法遠端通知
----
## 未來發展
- 增加WiFi或藍牙模組
- 引用AI模型
- 太陽能電源設計
- 增加其功能
---
# 柒、參考文獻與資料
----
- [繼電器簡介](https://www.digikey.tw/zh/articles/an-introduction-to-relays)
- [繼電器怎麼用? 它讓Arduino可以控制更多好玩的東西!](https://crazymaker.com.tw/arduino-how-to-use-relay/#google_vignette)
- [Arduino土壤溼度感測器使用](https://crazymaker.com.tw/arduino-how-to-use-soil-moisture-sensor/)