Dispositivo-medidor-de-Soiling
Firmware para dispositivo medidor de soiling en paneles solares fotovoltaicos
태양광 패널 소일링 측정 장치 — Raspberry Pi Pico & WIZnet W5500
두 개의 기준 셀(청결/오염)의 단락 전류를 비교해 소일링 비율(SR)을 자동 산출하고, WIZnet W5500 이더넷과 Modbus TCP로 원격 모니터링 시스템에 실시간 전송하는 자율 측정 장치
배경 및 개발 동기
태양광 패널 표면에 먼지, 꽃가루, 오염물질이 쌓이는 현상을 소일링(Soiling) 이라고 합니다. 특히 건조하거나 산업지역에 설치된 태양광 발전소에서는 소일링으로 인한 발전 손실이 연간 5~10% 이상에 달하는 경우도 흔합니다. 그러나 이 손실을 정량적으로 측정하려면 고가의 전용 센서나 주기적인 현장 방문이 필요해, 중소규모 혹은 오지 설비에서는 현실적으로 적용하기 어렵습니다.
이 프로젝트는 Raspberry Pi Pico와 WIZnet W5500 이더넷 컨트롤러를 기반으로, 저비용으로 소일링 비율(Soiling Ratio, SR)을 자동 측정하는 장치를 구현합니다. 동일한 사양의 소형 기준 태양전지 셀 두 개를 사용하는데, 하나는 항상 청결하게 유지하고 나머지 하나는 자연 오염에 그대로 노출시킵니다. 두 셀의 단락 전류(Isc)를 같은 일사 조건에서 비교함으로써 매일 소일링 비율을 산출합니다. 측정 결과는 Modbus TCP 프로토콜을 통해 원격 감시 시스템(SCADA)으로 유선 이더넷 전송됩니다.
통신 수단으로 Wi-Fi 대신 유선 이더넷을 선택한 이유는 명확합니다. 야외 산업 환경에서는 무선 신호 간섭이 잦고 연결 안정성을 보장하기 어렵기 때문입니다. W5500의 하드웨어 TCP/IP 스택은 이더넷 통신 전반을 칩 내부에서 자율 처리하므로, RP2040은 측정 로직과 전력 관리에만 집중할 수 있습니다.
시스템 구조 및 동작 원리
장치의 동작은 아래와 같은 유한 상태 머신(FSM) 으로 구성됩니다.
소일링 비율(SR) 계산 방식:
청결 셀의 Isc를 온도계수로 보정한 뒤, STC 기준값과 비교해 유효 일사량(Geff)을 산출합니다. 이 Geff와 오염 패널 실측 온도를 바탕으로 오염 셀이 이론적으로 내야 할 예상 Isc를 계산하고, 실제 측정값과 비교해 소일링 비율을 구합니다.
SR = Isc_dirty(실측) / Isc_dirty(예상)SR = 1.0이면 소일링 없음, 값이 낮을수록 오염이 심해 발전 손실이 크다는 의미입니다.
전력 관리:
배터리로 구동되는 야외 설치 환경을 고려해, 대기 상태에서는 RP2040의 시스템 클럭을 48 MHz로 낮춰 소비 전력을 절감합니다. Modbus TCP 요청 처리나 측정 수행 시에는 원래 클럭으로 자동 복원되어 정확한 연산을 보장합니다.
구현 세부사항
하드웨어 연결
W5500은 RP2040과 SPI로 연결됩니다.
| W5500 핀 | RP2040 GPIO |
|---|---|
| MISO | PIN_MISO |
| MOSI | PIN_MOSI |
| SCK | PIN_SCK |
| CS | PIN_CS |
| RST | PIN_RST |
| INT | W5500_INT_PIN |
시작 시 RST 핀을 최소 10ms 동안 LOW로 유지해 W5500을 완전히 초기화하고, 이후 100ms 대기로 내부 부팅 시퀀스가 완료되도록 합니다.
두 INA219 전류 센서는 서로 다른 I2C 주소(INA219_CLEAN_ADDR, INA219_DIRTY_ADDR)로 동일한 I2C 버스에 연결되며, 0.1 Ω 션트 저항 기준으로 최대 3.2 A 범위로 캘리브레이션됩니다. DS3231 RTC는 하드웨어 인터럽트(RTC_INT_PIN)로 일일 알람을 발생시켜 소프트웨어 타이머 없이도 정확한 시각에 측정을 트리거합니다.
단락 전류 측정은 GPIO_PANEL_CLEAN, GPIO_PANEL_DIRTY 핀을 순간적으로 HIGH로 하여 각 기준 셀을 INA219 션트를 통해 실제로 단락시키는 방식으로 수행합니다. 부하에 의존하지 않는 진정한 Isc 측정이 가능합니다.
Modbus TCP 통신
장치는 고정 IP(192.168.0.123)로 Modbus TCP 서버 역할을 합니다. 클라이언트가 접속하면 다음 날 10:00 알람을 예약하고 대기 상태로 진입합니다. 지원하는 함수 코드는 0x03(Read Holding Registers) 하나로, 응답에는 최신 소일링 비율(SR), 측정 시각, 날짜가 포함됩니다.
에러 상황은 별도의 코드로 구분됩니다. 배터리 부족 시 0xFFFF, 일사량 부족 시 0x0000을 반환해 모니터링 소프트웨어가 유효 측정값과 비정상 상황을 명확히 식별할 수 있습니다.
W5500의 소켓 인터럽트(Sn_IR 레지스터 플래그)가 신규 접속, 데이터 수신, 연결 해제, 타임아웃 등 모든 네트워크 이벤트를 처리합니다. 폴링 루프 없이 인터럽트 기반으로 동작하므로 CPU 부담이 최소화됩니다.
개발 환경 및 빌드
- IDE: Visual Studio Code (Raspberry Pi Pico 확장 플러그인)
- 빌드: CMake (Pico SDK + WIZnet ioLibrary_Driver 서브모듈 포함)
- 툴체인: ARM GCC (Pico SDK v2.x 이상에서 VS Code 확장이 자동 설치)
서브모듈을 포함해 전체 레포지토리를 클론하려면 아래 명령을 사용하세요:
git clone --recurse-submodules https://github.com/esteban04-ux/Dispositivo-medidor-de-Soiling.git이후 표준 Pico SDK CMake 빌드 흐름으로 빌드 및 플래시하면 됩니다. 사용 보드는 CMakeLists.txt에서 설정합니다.
시장 가치 및 WIZnet Maker 커뮤니티에 대한 기여
재생에너지 시장이 빠르게 성장하면서 태양광 O&M(Operation & Maintenance) 비용을 줄이려는 수요도 함께 커지고 있습니다. 상용 소일링 모니터링 솔루션은 수백만 원대의 장비 비용과 전용 소프트웨어 라이선스를 요구하는 경우가 많아, 소규모 농촌 태양광이나 개발도상국 오프그리드 설비에서는 도입이 현실적으로 어렵습니다.
이 프로젝트는 W5500과 RP2040만으로 그 공백을 메울 수 있음을 직접 증명한다는 점에서 의미가 큽니다. WIZnet 칩을 활용하는 Maker 입장에서도 실질적인 레퍼런스가 되는데, 구체적으로 아래 세 가지 기술 패턴은 유사 프로젝트에 그대로 응용할 수 있습니다.
- W5500 하드웨어 TCP/IP 스택 + 소켓 인터럽트 × Modbus TCP 조합 — 폴링 없이 산업 표준 프로토콜을 구현하는 방법
- 배터리 환경에서의 SPI 이더넷 저전력 운용 — 안정적인 초기화 시퀀스와 클럭 스케일링 병행 기법
- RTC 하드웨어 알람 기반 정밀 스케줄링 — 소프트웨어 타이머 의존 없이 슬립-웨이크 사이클을 제어하는 패턴
이 패턴들은 농업용 토양 센서, 원격 기상 관측소, 산업용 환경 모니터링 등 W5100S · W5500 · W55RP20을 사용하는 수많은 프로젝트에 재활용할 수 있습니다. 또한 오픈소스 CMake 빌드 환경 덕분에 WIZnet EVB-Pico 시리즈를 비롯한 다른 WIZnet 보드로의 포팅도 최소한의 수정으로 가능합니다.
결과 및 마무리
이 장치는 별도의 인간 개입 없이 매일 자율적으로 소일링 측정 사이클을 완수합니다. RTC 하드웨어 알람, 인터럽트 기반 W5500 이더넷, 클럭 절전 조합 덕분에 오지 태양광 설비에서도 장기간 배터리 운용이 가능합니다.
Modbus TCP 인터페이스를 통해 Node-RED, Ignition, 또는 pymodbus 기반 Python 클라이언트 등 다양한 산업용 SCADA 플랫폼과 쉽게 연동할 수 있습니다. 당일 측정값을 그날 바로 확인할 수 있어, 불필요한 물 낭비 없이 적시에 세척 결정을 내릴 수 있습니다.
향후 개선 계획으로는 DHCP 지원, 로컬 스토리지를 활용한 다일 SR 추세 기록, 이더넷 OTA 펌웨어 업데이트 등을 검토하고 있습니다.
Background & Motivation
Solar photovoltaic installations lose efficiency over time as dust, pollen, and environmental debris accumulate on panel surfaces — a phenomenon known as soiling. In regions with high irradiance but frequent dust events (such as semi-arid or industrial areas), soiling losses can easily exceed 5–10% of total energy production, and in extreme cases even more. Traditionally, quantifying this loss requires expensive dedicated sensors or periodic manual measurements, making it impractical for small-scale or remote installations.
This project proposes a low-cost, autonomous Soiling Ratio (SR) measurement device built around a Raspberry Pi Pico and a WIZnet W5500 Ethernet controller. The device uses a pair of identical small-scale photovoltaic reference cells — one intentionally kept clean and one left exposed to natural soiling — and compares their short-circuit currents (Isc) under the same irradiance conditions to compute a daily soiling ratio. Results are made available to a remote supervisory system via Modbus TCP over wired Ethernet.
Wired Ethernet was chosen over Wi-Fi specifically because the device is designed to operate outdoors in an industrial or agricultural context, where wireless connectivity is unreliable and interference is common. The W5500's hardware TCP/IP stack handles all Ethernet communication autonomously, freeing the RP2040 to focus on measurement logic and power management.
System Architecture & How It Works
The system implements a finite state machine (FSM) that coordinates all measurement, cleaning, and communication tasks:
Soiling Ratio calculation:
The device measures the short-circuit current of both the clean and dirty reference cells under real irradiance conditions. Before comparison, the clean cell's Isc is corrected for its measured temperature using the panel's temperature coefficient. The effective irradiance (Geff) is derived from the temperature-corrected clean Isc against its STC (Standard Test Conditions) reference. An expected Isc for the dirty cell is then computed at the actual irradiance and dirty-panel temperature. The Soiling Ratio is:
SR = Isc_dirty / Isc_expected_dirtyA value of SR = 1.0 means no soiling; lower values indicate increasing soiling losses.
Power management:
To preserve battery life in off-grid deployment, the system reduces the RP2040 system clock to 48 MHz during idle periods and restores full clock speed only when processing Modbus TCP requests or performing measurements. This avoids excessive power draw during the long daily idle window.
Implementation Details
Hardware Wiring
The W5500 is connected to the RP2040 via SPI:
| W5500 Pin | RP2040 GPIO |
|---|---|
| MISO | GPIO configured via PIN_MISO |
| MOSI | GPIO configured via PIN_MOSI |
| SCK | GPIO configured via PIN_SCK |
| CS | GPIO configured via PIN_CS |
| RST | GPIO configured via PIN_RST |
| INT | GPIO configured via W5500_INT_PIN |
The W5500 reset line is held low for at least 10 ms on startup to guarantee a clean initialization, followed by a 100 ms wait for internal stabilization.
Both INA219 current sensors share the I2C bus at different addresses (INA219_CLEAN_ADDR and INA219_DIRTY_ADDR), allowing simultaneous calibration with a 0.1 Ω shunt resistor for a 3.2 A full-scale range. The DS3231 RTC generates a hardware interrupt (RTC_INT_PIN) that triggers daily measurement alarms without relying on software timers, which would drain the battery during sleep.
Short-circuit measurements are taken by briefly asserting GPIO lines (GPIO_PANEL_CLEAN, GPIO_PANEL_DIRTY) that physically short-circuit each reference cell through the corresponding INA219 shunt, ensuring a true Isc measurement rather than a load-dependent approximation.
Modbus TCP Communication
The device listens on a static IP (192.168.0.123) as a Modbus TCP server. Upon receiving a client connection, it schedules the daily 10:00 alarm and enters idle mode. Only Function Code 0x03 (Read Holding Registers) is supported; the response carries the latest Soiling Ratio (SR), timestamp, and date. Error conditions (low battery = 0xFFFF, low irradiance = 0x0000) are returned as Modbus exception frames using a dedicated error code register, allowing the SCADA/monitoring client to distinguish between a valid SR measurement and an invalid measurement day.
Socket interrupts from the W5500 (Sn_IR register flags) handle all connection lifecycle events — new connection, data received, disconnection, and timeout — without any polling loop, keeping the CPU available for other tasks.
Development Environment
- IDE: Visual Studio Code with the Raspberry Pi Pico extension
- Build system: CMake (Pico SDK + WIZnet ioLibrary_Driver as submodules)
- Toolchain: ARM GCC (configured via the Pico VS Code extension — no manual GCC installation required as of Pico SDK v2.x)
To clone the repository with all submodules:
git clone --recurse-submodules https://github.com/esteban04-ux/Dispositivo-medidor-de-Soiling.gitBuild and flash using the standard Pico SDK CMake workflow. The target board is set in CMakeLists.txt.
Results & Conclusion
The device successfully performs fully autonomous daily soiling measurements with no human intervention. The combination of RTC-driven alarms, interrupt-driven W5500 Ethernet, and aggressive clock scaling keeps the system operational on battery for extended periods — essential for remote photovoltaic monitoring sites without grid power.
The Modbus TCP interface allows seamless integration with any industrial SCADA or monitoring platform (e.g., Node-RED, Ignition, or a custom Python client using pymodbus). The measured Soiling Ratio is available on demand within the same day of measurement, enabling timely cleaning decisions and preventing unnecessary water usage.
Future improvements under consideration include DHCP support for flexible network deployment, multi-day SR trending with local storage, and OTA firmware updates over Ethernet.
