아두이노 - 토양 수분 센서 펌프 | Arduino - Soil Moisture Sensor Pump

이 튜토리얼에서는 아두이노와 전기용량식 토양 습도 센서를 사용하여 펌프를 제어하는 방법을 배울 것입니다.

준비물

1×Arduino Uno Amazon
1×USB 2.0 cable type A/B 쿠팡 | Amazon
1×Capacitive Soil Moisture Sensor Amazon
1×Relay Amazon
1×12V Pump Amazon
1×Vinyl Tube Amazon
1×12V Power Adapter Amazon
1×DC Power Jack 쿠팡 | Amazon
1×Jumper Wires Amazon
1×(Optional) 9V Power Adapter for Arduino Amazon
1×(Recommended) Screw Terminal Block Shield for Arduino Uno 쿠팡 | Amazon
1×(Optional) Transparent Acrylic Enclosure For Arduino Uno Amazon
공개: 이 섹션에서 제공된 링크 중 일부는 제휴 링크입니다. 이 링크를 통해 구매한 경우 추가 비용없이 수수료를 받을 수 있습니다. 지원해 주셔서 감사합니다.

Buy Note: Many soil moisture sensors available in the market are unreliable, regardless of their version. We strongly recommend buying the sensor from the DIYables brand using the link provided above. We tested it, and it worked reliably.

토양 수분 센서 및 펌프에 관하여

펌프와 토양 수분 센서(핀 배치, 작동 방식, 프로그래밍 방법 등)에 대해 모른다면, 다음 자습서에서 그것들에 대해 배워보세요:

작동 원리

아두이노는 주기적으로 전기용량식 토양 수분 센서에서 값을 읽습니다. 토양 수분 값에 기초하여, 다음과 같은 조치를 취할 것입니다:

  • 토양 수분 값이 한계치보다 낮은 경우, 아두이노는 자동으로 릴레이를 활성화하여 펌프를 켭니다.
  • 그렇지 않으면, 아두이노는 자동으로 릴레이를 비활성화하여 펌프를 끕니다.

선연결

Arduino soil moisture sensor Pump Wiring Diagram

이 이미지는 Fritzing을 사용하여 만들어졌습니다. 이미지를 확대하려면 클릭하세요.

아두이노 코드

/* * 이 Arduino 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino/arduino-soil-moisture-sensor-pump */ #define RELAY_PIN 2 // 아두이노 핀은 릴레이를 통해 펌프를 제어합니다 #define MOISTURE_PIN A0 // 아두이노 핀은 모이스처 센서의 AOUT 핀에 연결됩니다 #define THRESHOLD 530 // => 여기서 임계값을 변하십시오 void setup() { Serial.begin(9600); pinMode(RELAY_PIN, OUTPUT); } void loop() { int value = analogRead(MOISTURE_PIN); // 센서에서 아날로그 값을 읽습니다 if (value > THRESHOLD) { Serial.print("The soil moisture is DRY => activate pump"); digitalWrite(RELAY_PIN, HIGH); } else { Serial.print("The soil moisture is WET => deactivate the pump"); digitalWrite(RELAY_PIN, LOW); } Serial.print(" ("); Serial.print(value); Serial.println(")"); delay(1000); }

사용 방법

습-건 THRESHOLD를 결정하기 위한 보정을 하십시오. Arduino - 토양 수분 센서 보정 참조

코드에서 THRESHOLD 값을 보정된 값으로 업데이트하십시오.

Arduino IDE에서 시리얼 모니터 열기

코드를 Arduino에 업로드하십시오.

시리얼 모니터에서 결과를 확인하십시오.

COM6
Send
The soil moisture is DRY => activate the pump The soil moisture is DRY => activate the pump The soil moisture is DRY => activate the pump The soil moisture is DRY => activate the pump The soil moisture is WET => deactivate the pump The soil moisture is WET => deactivate the pump The soil moisture is WET => deactivate the pump The soil moisture is WET => deactivate the pump
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

코드 설명

소스 코드의 주석 줄에 있는 줄별 설명을 읽으세요!

동영상

비디오 제작은 시간이 많이 걸리는 작업입니다. 비디오 튜토리얼이 학습에 도움이 되었다면, YouTube 채널 을 구독하여 알려 주시기 바랍니다. 비디오에 대한 높은 수요가 있다면, 비디오를 만들기 위해 노력하겠습니다.

※ OUR MESSAGES

  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!