ชุดรดน้ำต้นไม้อัตโนมัติด้วย Arduino สำหรับ Smart Farm (พร้อมโค้ด)
ชุดรดน้ำต้นไม้อัตโนมัติด้วย Arduino เป็นโปรเจคยอดนิยมสำหรับผู้เริ่มต้นด้านอิเล็กทรอนิกส์และ IoT
ช่วยให้สามารถดูแลต้นไม้ได้อย่างสม่ำเสมอ แม้ในเวลาที่ไม่อยู่บ้าน
เหมาะสำหรับการเรียนรู้ระบบ Smart Farm และสามารถนำไปพัฒนาต่อยอดได้จริง
โปรเจคนี้ใช้ Arduino Uno R3 เป็นหลัก และสามารถประยุกต์ใช้งานร่วมกับระบบ IoT เช่น
Blynk เพื่อควบคุมผ่านมือถือได้ โดยต้นทุนเริ่มต้นประมาณ 495 บาท
และเวอร์ชัน IoT ประมาณ 520 บาท
อุปกรณ์ที่ต้องใช้
- Arduino Uno R3 https://shopee.co.th/product/243007968/3526271333
- Relay Module 1 Channel 250V/10A https://shopee.co.th/product/243007968/6725582008
- Soil Moisture Sensor (เซ็นเซอร์วัดความชื้นดิน) https://shopee.co.th/product/243007968/4625583495
- ปั๊มน้ำ DC ขนาดเล็ก https://shopee.co.th/product/243007968/3526271333
- สายยางน้ำ 1 เมตร https://shopee.co.th/product/243007968/6225581846
- Adapter 5V 1A https://shopee.co.th/product/243007968/7925582943
- Power Adapter Jack https://shopee.co.th/product/243007968/4925584578
- สาย Jumper Male to Female https://shopee.co.th/product/243007968/7525582748

หลักการทำงาน
ระบบจะใช้ Soil Moisture Sensor ตรวจวัดความชื้นในดิน โดยส่งค่าแบบ Analog ไปยัง Arduino
เมื่อค่าความชื้นต่ำกว่าที่กำหนด (เช่น 40%) ระบบจะสั่ง Relay ให้เปิดปั๊มน้ำโดยอัตโนมัติ
ค่าความชื้นที่เหมาะสมโดยทั่วไปอยู่ที่ประมาณ 40% (ขึ้นอยู่กับชนิดของพืช)
ตัวอย่างโค้ด Arduino
const int analogInPin = A0;
const int relay = 2;
int sensorValue = 0;
int outputValue = 0;
void setup() {
Serial.begin(9600);
pinMode(relay, OUTPUT);
}
void loop() {
sensorValue = analogRead(analogInPin);
outputValue = map(sensorValue, 0, 1023, 100, 0);
Serial.print("Soil Moisture = ");
Serial.print(outputValue);
Serial.println(" %");
if (outputValue <= 40) {
digitalWrite(relay, HIGH);
} else {
digitalWrite(relay, LOW);
}
delay(1000);
}
จุดเด่นของโปรเจค
- ต้นทุนต่ำ เหมาะสำหรับมือใหม่
- สามารถพัฒนาเป็นระบบ IoT ได้
- ช่วยประหยัดน้ำ
- ดูแลต้นไม้อัตโนมัติ
- ต่อยอดเป็น Smart Farm ได้
การพัฒนาเพิ่มเติม (IoT)
สามารถอัปเกรดเป็นระบบ IoT โดยใช้ Wemos D1
เชื่อมต่อ WiFi เพื่อ:
- ดูค่าความชื้นแบบ Real-time
- สั่งรดน้ำผ่านมือถือ
- แจ้งเตือนผ่าน LINE หรือ Telegram
สรุป
โปรเจครดน้ำต้นไม้อัตโนมัติด้วย Arduino เป็นจุดเริ่มต้นที่ดีสำหรับผู้สนใจด้าน
IoT และ Smart Farm สามารถนำไปใช้งานจริงในสวน หรือพัฒนาเป็นโปรเจคขั้นสูงได้ในอนาคต