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

이 튜토리얼에서는 용량성 토양 수분 센서에서 읽은 값에 따라 펌프를 제어하는 방법을 Arduino Nano ESP32를 사용하여 배우게 됩니다.

준비물

1×Arduino Nano ESP32 Amazon
1×USB Cable Type-C 쿠팡 | Amazon
1×Capacitive Soil Moisture Sensor Amazon
1×Relay Amazon
1×12V Pump Amazon
1×Vinyl Tube Amazon
1×12V Power Adapter Amazon
1×(Optional) DC Power Jack 쿠팡 | Amazon
1×Breadboard 쿠팡 | Amazon
1×Jumper Wires Amazon
1×(Recommended) Screw Terminal Adapter for Arduino Nano 쿠팡 | 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.

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

펌프와 토양 습도 센서(pinout, 작동 원리, 프로그래밍 방법 등)에 대해 잘 모르신다면, 다음 튜토리얼에서 배워보세요:

작동 방식

Arduino Nano ESP32는 주기적으로 정전 용량식 토양 수분 센서에서 값을 읽습니다. 토양 수분 값에 따라 다음과 같은 조치를 취할 것입니다:

  • 토양 수분 값이 임계값 이하인 경우, Arduino Nano ESP32는 자동으로 릴레이를 활성화하여 펌프를 켭니다.
  • 그렇지 않으면, Arduino Nano ESP32는 자동으로 릴레이를 비활성화하여 펌프를 끕니다.

선연결

Arduino Nano ESP32 soil moisture sensor Pump Wiring Diagram

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

아두이노 나노 ESP32 코드

/* * 이 Arduino Nano ESP32 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino Nano ESP32 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino-nano-esp32/arduino-nano-esp32-soil-moisture-sensor-pump */ #define RELAY_PIN D2 // 아두이노 나노 ESP32 핀이 릴레이에 연결됩니다 #define SENSOR_PIN A2 // 아두이노 나노 ESP32 핀이 모이스처 센서의 AOUT 핀에 연결됩니다 #define THRESHOLD 2800 // => 여기서 임계값을 변경하세요 void setup() { Serial.begin(9600); pinMode(RELAY_PIN, OUTPUT); } void loop() { int value = analogRead(SENSOR_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); }

사용 방법

  • Arduino Nano ESP32에 익숙하지 않다면, Arduino IDE에서 Arduino Nano ESP32 환경 설정 방법에 대한 자습서를 참조하세요. Arduino Nano ESP32 설정 방법.
  • 습기-건조 THRESHOLD를 결정하기 위해 보정을 실시하세요. Arduino Nano ESP32 - 토양 습도 센서 보정
  • 보정된 값을 코드의 THRESHOLD에 업데이트하세요.
  • Arduino IDE에서 시리얼 모니터를 엽니다.
  • Arduino Nano ESP32에 코드를 업로드하세요.
  • 시리얼 모니터에서 결과를 확인하세요.
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!