SmartGarden
SmartGarden
프로젝트 개요
SmartGarden은 Arduino 기반 Master station과 여러 Remote station으로 구성된 관수 제어 및 환경 모니터링 시스템입니다. Master station은 WIZnet W5500 기반 Ethernet shield를 통해 Web UI, 로그 조회, 시간 동기화 같은 네트워크 기능을 제공하고, 센서 데이터와 관수 이력은 MicroSD에 저장합니다. 원본 프로젝트는 인터넷 연결, Web UI, RF link 기반 multi-station 지원을 주요 특징으로 설명합니다.
시스템은 정원, 온실, 시설 재배 환경에서 여러 관수 zone을 제어하고 온도, 습도, 기압, 유량 같은 환경 데이터를 기록하도록 설계되었습니다. Remote station은 RF 링크를 통해 Master station과 통신하며, 떨어진 위치의 밸브나 센서를 제어합니다.
데이터 흐름은 명확합니다. 센서가 측정값을 생성하면 station firmware가 값을 갱신하고, 필요한 항목은 MicroSD에 기록합니다. 사용자는 Web UI에서 현재 상태를 확인하거나 저장된 로그를 다운로드할 수 있습니다. 관수 제어는 zone 단위로 실행되며, 각 zone은 스케줄, 실행 시간, seasonal adjustment, 사용 수량 같은 정보를 기반으로 동작합니다.
Industrial IoT 관점에서 중요한 점은 제어와 기록이 함께 동작한다는 것입니다. SmartGarden은 밸브를 켜고 끄는 단순 제어기를 넘어서, 어떤 zone이 언제 얼마나 동작했는지와 센서 값이 어떻게 변했는지를 함께 남기는 현장형 데이터 기반 관수 시스템입니다.
이미지 출처 : AI 생성
WIZnet이 들어가는 위치
이 프로젝트에서 사용하는 WIZnet 제품은 W5500 Ethernet controller입니다.
W5500은 Master station의 유선 네트워크 인터페이스 역할을 합니다. Web UI 접속, 로그 조회, 시간 동기화, 네트워크 기반 관리 기능이 이 Ethernet 경로 위에서 동작합니다. 센서 데이터 자체는 MicroSD에 저장되지만, 사용자가 그 데이터를 확인하고 가져오는 통로는 W5500 기반 Ethernet 연결입니다.
W5500이 적합한 이유는 Master station이 동시에 처리해야 할 일이 많기 때문입니다. 관수 스케줄 계산, RF remote station 관리, 센서 폴링, SD 카드 기록, 로컬 UI, Web UI가 같은 MCU 환경에서 돌아갑니다. W5500은 hardwired TCP/IP stack, SPI 최대 80 MHz, 8개 socket, 32 KB 내부 Tx/Rx buffer를 제공하므로 MCU의 네트워크 처리 부담을 줄이는 데 유리합니다.
또한 유선 Ethernet은 고정 설치형 농업·설비 환경에 잘 맞습니다. 펌프, 릴레이, 긴 배선, 금속 구조물, 습도 변화가 있는 현장에서는 무선보다 물리 링크 상태를 확인하기 쉬운 Ethernet 구성이 운영 관리에 유리합니다.
구현 노트
Master station 설정에서는 Ethernet과 SD 카드가 함께 활성화됩니다. W5500과 MicroSD는 모두 SPI 버스를 사용하므로, 각 장치의 chip select 핀을 분리해서 관리해야 합니다. Station/Defines.h에서는 Master 하드웨어 구성에서 Ethernet, SD, MoteinoRF가 활성화되고, W5500 SS는 D1, SD SS는 D3으로 정의됩니다.
#define HW_ENABLE_ETHERNET 1
#define HW_ENABLE_SD 1
#define W5500_USE_CUSOM_SS 1
#define W5500_SS 1
#define SD_USE_CUSOM_SS 1
#define SD_SS 3파일 경로: Station/Defines.h
이 설정은 Master station이 네트워크와 로컬 로그 저장을 동시에 사용하는 구조임을 보여줍니다. W5500은 Ethernet 통신을 담당하고, SD 카드는 센서 및 관수 기록을 저장합니다.
Ethernet 초기화 코드는 W5500의 CS 핀을 출력으로 설정하고 비활성 상태로 둔 뒤, DHCP 또는 static IP 설정에 따라 Ethernet.begin()을 호출합니다. 같은 파일에는 SD 카드를 초기화하기 전에 Ethernet을 먼저 초기화해야 한다는 주석도 있어, W5500과 SD 카드의 SPI 공유 관계가 실제 코드 설계에 반영되어 있음을 확인할 수 있습니다.
pinMode(W5500_SS, OUTPUT);
digitalWrite(W5500_SS, HIGH);
if( GetIsDHCP() )
Ethernet.begin(mac);
else
Ethernet.begin(mac, GetIP(), INADDR_NONE, GetGateway(), GetNetmask());파일 경로: Station/Station.ino
센서 데이터 로깅은 Sensors::ReportSensorReading()에서 측정값을 갱신한 뒤 SD 로그 모듈로 전달하는 방식입니다. sensors.cpp의 헤더 주석은 센서 모듈이 온도, 압력, 습도, 유량 등을 처리하며, sensor reading을 SD logging class에 time-series pattern으로 기록한다고 설명합니다.
sdlog.LogSensorReading(
SensorsList[i].config.sensorType,
(int)i,
sensorReading
);파일 경로: Station/sensors.cpp
관수 이력은 zone watering event로 따로 기록됩니다. 로그 항목에는 zone, 실행 시간, 사용 수량, schedule ID, adjustment 값이 포함됩니다. sdlog.cpp는 system log뿐 아니라 temperature, humidity, waterflow 같은 데이터를 처리하는 logging subsystem으로 정의되어 있습니다.
bool Logging::LogZoneEvent(
time_t start,
int zone,
int duration,
uint16_t water_used,
int schedule,
int sadj,
int wunderground
)파일 경로: Station/sdlog.cpp
관수 제어는 zone의 위치에 따라 다른 경로로 실행됩니다. 로컬 parallel/serial station은 바로 running 상태로 전환되고, RF remote station은 명령 전송 후 응답을 기다리는 starting 상태로 들어갑니다. core.cpp는 XBee 또는 MoteinoRF network ID일 때 rprotocol.ChannelOn()을 호출하고, remote station은 응답이 도착하면 running 상태로 전환된다고 주석으로 설명합니다.
if( lBoardParallel.ChannelOn(sStation.networkAddress + zone.channel) )
zoneStateCache[nZone] = ZONE_STATE_RUNNING;
else if( rprotocol.ChannelOn(zone.stationID, zone.channel, ttr) )
zoneStateCache[nZone] = ZONE_STATE_STARTING + ZONE_STATE_TIMEOUT;파일 경로: Station/core.cpp
이 로직은 원격 밸브 제어에서 중요한 안전 장치입니다. 로컬 출력은 즉시 실행 상태로 판단할 수 있지만, RF remote station은 실제 응답이 도착해야 running 상태로 넘어갈 수 있습니다. 스케줄 처리에서는 zone duration과 seasonal adjustment를 반영한 뒤 다음 zone을 실행합니다.
유사 프로젝트 비교: SmartGarden vs Climate Czar
https://maker.wiznet.io/mason/projects/climate%2Dczar/
Climate Czar는 SmartGarden과 마찬가지로 농업·온실 환경에서 센서 데이터를 읽고 장치를 제어하는 프로젝트입니다. 다만 SmartGarden은 Arduino Master station 중심의 독립형 관수 컨트롤러이고, Climate Czar는 Linux 서버와 ESP32 Combo Hub를 나눈 서버 중심 온실 자동화 시스템입니다. Climate Czar는 Linux/PHP/MySQL 환경에서 동작하며, 서버가 온도, 습도, pH, EC, 조도, 플로트 스위치, 도어 스위치 같은 입력을 읽고 팬, 히터, 조명, 펌프, 릴레이 등을 제어하는 구조입니다.
유사점
| 항목 | SmartGarden | Climate Czar |
|---|---|---|
| 적용 분야 | 정원, 관수, 환경 모니터링 | 온실, 실내 재배, 환경 제어 |
| 목적 | 센서 기반 관수 제어 | 센서 기반 기후 제어 |
| WIZnet 제품 | W5500 | W5500 |
| 유선 네트워크 | Ethernet 기반 Web UI와 로그 접근 | Ethernet 기반 HTTP API 통신 |
| 센서 활용 | 온도, 습도, 기압, 유량 | 온도, 습도, pH, EC, 조도 |
| 제어 대상 | 밸브, 관수 zone | 팬, 히터, 조명, 펌프, 릴레이 |
| 원격 확장 | Remote station | Slave unit / 현장 I/O node |
| 현장 성격 | 고정 설치형 관수 시스템 | 고정 설치형 온실 자동화 시스템 |
차이점
| 항목 | SmartGarden | Climate Czar |
|---|---|---|
| 시스템 중심 | Arduino Master station | Linux 서버 + ESP32 Combo Hub |
| 구조 | MCU 단독 제어 중심 | 서버 판단 + 현장 I/O 분리 |
| 주요 기능 | 관수 스케줄, zone 제어, SD 로그 | 기후 제어, 대시보드, API 기반 자동화 |
| 데이터 저장 | Master station의 MicroSD | 서버의 PHP/MySQL 기반 저장 구조 |
| W5500 역할 | Master station의 Web UI와 로그 접근 경로 | ESP32 Combo Hub와 서버 간 유선 통신 경로 |
| 유선 네트워크 | W5500 Ethernet shield | W5500 Ethernet interface |
| 무선 통신 | RF link, XBee 또는 MoteinoRF 계열 | LoRa slave communication |
| 무선 통신 역할 | Master station과 Remote station 간 관수 제어 명령 전달 | Combo Hub가 LoRa slave와 현장 데이터를 주고받음 |
| 제어 로직 | 스케줄, duration, seasonal adjustment | 센서 조건, virtual sensor, logic gate, scheduler |
| 원격 노드 성격 | Master 명령을 받는 관수 확장 노드 | 서버/API 구조에 연결되는 현장 I/O 또는 LoRa slave 노드 |
| 확장 방향 | zone과 station 확장 | 센서, 릴레이, 자동화 조건 확장 |
| 강점 | 독립형 관수 제어와 로컬 로그 | 서버 기반 확장성과 복잡한 자동화 |
| 한계 | MCU 자원과 SD 저장 구조 제약 | 서버 의존도와 시스템 구성 복잡도 |
SmartGarden의 무선 확장은 RF link 기반입니다. 코드 구성에서는 Master/Remote 하드웨어에 따라 XBee 또는 MoteinoRF가 사용될 수 있고, remote station 제어는 RF protocol을 통해 zone start/stop 상태를 주고받습니다. Climate Czar의 Combo Hub는 DHT22, BH1750, DS18B20, MCP23017 relay, OLED와 함께 LoRa slave communication을 처리하는 현장 I/O 허브로 설명됩니다.
두 프로젝트 모두 W5500을 단순한 인터넷 연결 부품으로만 쓰지 않습니다. SmartGarden에서는 W5500이 Master station의 관리 인터페이스를 담당하고, Climate Czar에서는 ESP32 Combo Hub와 Linux 서버를 연결하는 유선 API 통신 경로가 됩니다. Climate Czar 페이지는 Combo Hub가 HTTP API 형태로 서버에 결과를 제공하고, W5500이 ESP32 Combo Hub의 유선 Ethernet 경로를 담당한다고 설명합니다.
따라서 단독 설치형 관수 컨트롤러에는 SmartGarden 구조가 더 단순합니다. 반대로 여러 센서, 출력 장치, 조건식, 대시보드 기반 운영이 필요하다면 Climate Czar 구조가 더 확장하기 쉽습니다.
실무 팁 / 주의할 점
- W5500과 SD 카드가 같은 SPI 버스를 공유하므로 CS 핀 충돌을 먼저 점검해야 합니다.
- 현장 설치형 시스템에서는 DHCP보다 static IP 또는 DHCP reservation이 관리하기 쉽습니다.
- SD 카드 로그는 전원 차단에 취약할 수 있으므로 파일 기록 주기와 카드 내구성을 고려해야 합니다.
- RF remote station은 응답 지연이나 통신 실패가 발생할 수 있으므로 timeout 정책이 중요합니다.
- 유량 센서는 노이즈가 잘못된 사용량 기록으로 이어질 수 있어 필터링이나 debounce 처리가 필요합니다.
- 릴레이, 펌프, 긴 케이블이 있는 환경에서는 Ethernet 케이블 품질, 접지, EMI 영향을 함께 확인해야 합니다.
FAQ
Q: 왜 W5500을 사용하나요?
A: Master station은 Web UI, 로그 조회, 시간 동기화, 센서 기록, 관수 제어를 함께 처리합니다. W5500은 하드웨어 TCP/IP 스택을 제공하므로 Arduino급 MCU에서 네트워크 기능을 비교적 안정적으로 붙일 수 있습니다.
Q: Arduino Master station에는 어떻게 연결되나요?
A: W5500은 SPI 기반 Ethernet shield로 연결됩니다. 코드에서는 W5500용 chip select와 SD 카드용 chip select를 별도로 정의해 같은 SPI 버스에서 두 장치를 구분합니다.
Q: 이 프로젝트에서 W5500은 센서 데이터 로깅에 어떤 역할을 하나요?
A: 센서 데이터는 MicroSD에 저장되고, W5500은 그 데이터를 Web UI에서 확인하거나 다운로드할 수 있게 하는 네트워크 통로 역할을 합니다.
Q: 초보자도 따라 할 수 있나요?
A: 기본 Arduino 예제보다 난도가 높습니다. SPI, SD 카드 파일 시스템, Ethernet 설정, 릴레이 제어, RF remote station 구조를 이해해야 안정적으로 구현할 수 있습니다.
Q: Climate Czar와 비교하면 어떤 차이가 있나요?
A: SmartGarden은 Arduino Master station이 직접 제어와 로깅을 수행하는 독립형 관수 컨트롤러에 가깝습니다. Climate Czar는 Linux 서버와 ESP32 Combo Hub를 분리해 더 복잡한 온실 자동화를 처리하는 서버 중심 구조입니다.
Project Overview
SmartGarden is an irrigation control and environmental monitoring system composed of an Arduino-based Master station and multiple Remote stations. The Master station provides network functions such as Web UI access, log viewing, and time synchronization through a WIZnet W5500-based Ethernet shield, while sensor data and irrigation history are stored on a MicroSD card. The original project describes internet connectivity, a Web UI, and RF link-based multi-station support as its main features.
The system is designed to control multiple irrigation zones in gardens, greenhouses, and controlled cultivation environments while recording environmental data such as temperature, humidity, barometric pressure, and water flow. Remote stations communicate with the Master station through RF links and control valves or sensors located away from the main controller.
The data flow is straightforward. When sensors generate measurements, the station firmware updates the values, and the required data is recorded to the MicroSD card. Users can check the current status through the Web UI or download stored logs. Irrigation control runs by zone, and each zone operates based on parameters such as schedule, runtime, seasonal adjustment, and water usage.
From an Industrial IoT perspective, the important point is that control and logging operate together. SmartGarden is not just a simple controller that turns valves on and off. It is a field-oriented, data-driven irrigation system that records which zone operated, when it operated, how long it ran, how much water was used, and how sensor values changed.
Image Source : AI Generated
Where WIZnet Fits
The WIZnet product used in this project is the W5500 Ethernet controller.
The W5500 acts as the wired network interface for the Master station. Web UI access, log viewing, time synchronization, and network-based management functions all run through this Ethernet path. The sensor data itself is stored on the MicroSD card, but the W5500-based Ethernet connection is the path users use to view and retrieve that data.
The W5500 fits this project because the Master station has to handle many tasks at the same time. Irrigation schedule calculation, RF remote station management, sensor polling, SD card logging, local UI handling, and Web UI operation all run in the same MCU environment. Since the W5500 provides a hardwired TCP/IP stack, SPI up to 80 MHz, 8 sockets, and a 32 KB internal Tx/Rx buffer, it helps reduce the network-processing burden on the MCU.
Wired Ethernet is also well suited to fixed agricultural and facility installations. In environments with pumps, relays, long cables, metal structures, and humidity changes, Ethernet is easier to manage than wireless links because the physical link state can be checked directly.
Implementation Notes
In the Master station configuration, Ethernet and the SD card are enabled together. Since both the W5500 and the MicroSD card use the SPI bus, each device must be managed with a separate chip select pin. In Station/Defines.h, Ethernet, SD, and MoteinoRF are enabled in the Master hardware configuration, with W5500 SS defined as D1 and SD SS defined as D3.
#define HW_ENABLE_ETHERNET 1
#define HW_ENABLE_SD 1
#define W5500_USE_CUSOM_SS 1
#define W5500_SS 1
#define SD_USE_CUSOM_SS 1
#define SD_SS 3File path: Station/Defines.h
This configuration shows that the Master station uses networking and local log storage at the same time. The W5500 handles Ethernet communication, while the SD card stores sensor and irrigation records.
The Ethernet initialization code sets the W5500 CS pin as an output and leaves it inactive before calling Ethernet.begin() according to either DHCP or static IP configuration. The same file also includes a comment indicating that Ethernet must be initialized before the SD card is initialized, which shows that the shared SPI relationship between the W5500 and the SD card is reflected in the actual code design.
pinMode(W5500_SS, OUTPUT);
digitalWrite(W5500_SS, HIGH);
if( GetIsDHCP() )
Ethernet.begin(mac);
else
Ethernet.begin(mac, GetIP(), INADDR_NONE, GetGateway(), GetNetmask());File path: Station/Station.ino
Sensor data logging is handled by updating the measured value in Sensors::ReportSensorReading() and then passing it to the SD logging module. The header comments in sensors.cpp explain that the sensor module handles temperature, pressure, humidity, water flow, and similar values, and records sensor readings to the SD logging class in a time-series pattern.
sdlog.LogSensorReading(
SensorsList[i].config.sensorType,
(int)i,
sensorReading
);File path: Station/sensors.cpp
Irrigation history is recorded separately as zone watering events. Each log entry includes the zone, runtime, water used, schedule ID, and adjustment value. sdlog.cpp defines the logging subsystem as handling not only system logs but also data such as temperature, humidity, and water flow.
bool Logging::LogZoneEvent(
time_t start,
int zone,
int duration,
uint16_t water_used,
int schedule,
int sadj,
int wunderground
)File path: Station/sdlog.cpp
Irrigation control is executed through different paths depending on where the zone is located. A local parallel or serial station immediately transitions to the running state, while an RF remote station enters a starting state after the command is sent and waits for a response. The comments in core.cpp explain that when an XBee or MoteinoRF network ID is used, rprotocol.ChannelOn() is called, and the remote station transitions to the running state when a response arrives.
if( lBoardParallel.ChannelOn(sStation.networkAddress + zone.channel) )
zoneStateCache[nZone] = ZONE_STATE_RUNNING;
else if( rprotocol.ChannelOn(zone.stationID, zone.channel, ttr) )
zoneStateCache[nZone] = ZONE_STATE_STARTING + ZONE_STATE_TIMEOUT;File path: Station/core.cpp
This logic is an important safety mechanism for remote valve control. A local output can be treated as running immediately, but an RF remote station should only transition to the running state after an actual response is received. During schedule processing, the next zone is started after applying the zone duration and seasonal adjustment.
Similar Project Comparison: SmartGarden vs Climate Czar
https://maker.wiznet.io/mason/projects/climate%2Dczar/
Climate Czar, like SmartGarden, is a project that reads sensor data and controls devices in agricultural and greenhouse environments. However, SmartGarden is a standalone irrigation controller centered on an Arduino Master station, while Climate Czar is a server-centered greenhouse automation system that separates a Linux server from an ESP32 Combo Hub. Climate Czar runs in a Linux/PHP/MySQL environment, where the server reads inputs such as temperature, humidity, pH, EC, light level, float switches, and door switches, and controls fans, heaters, lights, pumps, and relays.
Similarities
| Item | SmartGarden | Climate Czar |
|---|---|---|
| Application field | Garden, irrigation, environmental monitoring | Greenhouse, indoor growing, environmental control |
| Purpose | Sensor-based irrigation control | Sensor-based climate control |
| WIZnet product | W5500 | W5500 |
| Wired network | Ethernet-based Web UI and log access | Ethernet-based HTTP API communication |
| Sensor usage | Temperature, humidity, barometric pressure, water flow | Temperature, humidity, pH, EC, light level |
| Control targets | Valves, irrigation zones | Fans, heaters, lights, pumps, relays |
| Remote expansion | Remote station | Slave unit / field I/O node |
| Field system type | Fixed irrigation system | Fixed greenhouse automation system |
Differences
| Item | SmartGarden | Climate Czar |
|---|---|---|
| System center | Arduino Master station | Linux server + ESP32 Combo Hub |
| Architecture | MCU-centered standalone control | Server decision-making + separated field I/O |
| Main functions | Irrigation schedule, zone control, SD logging | Climate control, dashboard, API-based automation |
| Data storage | MicroSD on the Master station | PHP/MySQL-based server storage structure |
| W5500 role | Network path for the Master station’s Web UI and log access | Wired communication path between the ESP32 Combo Hub and the server |
| Wired network | W5500 Ethernet shield | W5500 Ethernet interface |
| Wireless communication | RF link, XBee, or MoteinoRF family | LoRa slave communication |
| Wireless communication role | Sends irrigation control commands between the Master station and Remote stations | Combo Hub exchanges field data with LoRa slaves |
| Control logic | Schedule, duration, seasonal adjustment | Sensor conditions, virtual sensors, logic gates, scheduler |
| Remote node type | Irrigation expansion node controlled by Master commands | Field I/O or LoRa slave node connected to the server/API structure |
| Expansion direction | Expansion by zones and stations | Expansion by sensors, relays, and automation conditions |
| Strength | Standalone irrigation control and local logging | Server-based scalability and complex automation |
| Limitation | MCU resources and SD storage structure constraints | Server dependency and system configuration complexity |
SmartGarden’s wireless expansion is based on RF links. Depending on the Master/Remote hardware configuration, XBee or MoteinoRF can be used, and remote station control exchanges zone start/stop states through the RF protocol. The Climate Czar Combo Hub is described as a field I/O hub that handles LoRa slave communication together with devices such as DHT22, BH1750, DS18B20, MCP23017 relay modules, and an OLED display.
Neither project uses the W5500 merely as an internet connectivity component. In SmartGarden, the W5500 provides the management interface for the Master station. In Climate Czar, it becomes the wired API communication path between the ESP32 Combo Hub and the Linux server. The Climate Czar page explains that the Combo Hub provides results to the server through an HTTP API, and that the W5500 handles the wired Ethernet path for the ESP32 Combo Hub.
Therefore, the SmartGarden architecture is simpler for a standalone irrigation controller. In contrast, if the system requires many sensors, output devices, conditional rules, and dashboard-based operation, the Climate Czar architecture is easier to scale.
Practical Tips / Pitfalls
- Since the W5500 and SD card share the same SPI bus, check for chip select pin conflicts first.
- For field-installed systems, static IP or DHCP reservation is easier to manage than plain DHCP.
- SD card logs can be vulnerable to power loss, so the file write interval and SD card endurance should be considered.
- RF remote stations can experience response delays or communication failures, so timeout handling is important.
- Water flow sensors may produce incorrect usage records if noise is not filtered, so filtering or debounce handling is required.
- In environments with relays, pumps, and long cables, Ethernet cable quality, grounding, and EMI effects should be checked.
FAQ
Q: Why use the W5500?
A: The Master station handles Web UI access, log viewing, time synchronization, sensor recording, and irrigation control together. The W5500 provides a hardware TCP/IP stack, making it easier to add relatively stable networking functionality to an Arduino-class MCU.
Q: How is it connected to the Arduino Master station?
A: The W5500 is connected as an SPI-based Ethernet shield. In the code, separate chip select pins are defined for the W5500 and the SD card so that both devices can share the same SPI bus.
Q: What role does the W5500 play in sensor data logging in this project?
A: Sensor data is stored on the MicroSD card, and the W5500 acts as the network path that allows users to view or download that data through the Web UI.
Q: Can beginners follow this project?
A: This is more difficult than a basic Arduino example. To implement it reliably, users need to understand SPI, SD card file systems, Ethernet configuration, relay control, and the RF remote station structure.
Q: How is it different from Climate Czar?
A: SmartGarden is closer to a standalone irrigation controller where the Arduino Master station directly handles control and logging. Climate Czar separates the Linux server and ESP32 Combo Hub, making it a server-centered architecture for more complex greenhouse automation.

