Rate_Control
Rate_Control
Summary
RC15는 AgOpenGPS(AOG)에서 작업기(Implement)의 **2채널 Rate(유량/밸브/모터)**와 최대 7–14개 섹션 출력을 제어하기 위한 ESP32 기반 보드 설계이며, 필요 시 **WIZnet W5500(SPI 이더넷 모듈)**을 붙여 UDP 기반 유선 통신으로 AOG와 데이터를 주고받습니다. W5500은 현장 Wi-Fi 환경이 불안정할 때도 링크 품질을 일정하게 유지하는 “유선 통신 경로” 역할을 합니다.
이미지 출처 : AI 생성
AgOpenGPS(AOG)란?
AgOpenGPS(AOG)는 트랙터/정밀농업 작업에서 GNSS 기반 위치 정보를 활용해 조향(autosteer), 구획(섹션) 제어, 가변 살포(Variable Rate) 같은 기능을 통합 운용하는 오픈소스 생태계입니다. 작업기 제어는 “메인 시스템(AOG)”이 목표값(목표 살포율, 섹션 On/Off)을 계산해 내려주고, 현장 작업기 컨트롤러가 밸브/모터/릴레이를 구동하며 상태를 다시 보고하는 구조로 운영됩니다.
이미지 출처 : AI 생성
RC15가 담당하는 역할
RC15는 AOG 작업기 제어에서 다음을 수행하도록 정의되어 있습니다.
Rate 출력 2채널: DRV8870 기반으로 밸브/모터를 정·역(가역) 구동 가능한 채널 2개
섹션 출력 7–14채널: DRV8870 7개를 활용해
7개 가역 출력(모터식 밸브) 또는
14개 단방향 섹션 출력(솔레노이드 밸브 등)
중 하나로 운용 가능한 설계 개념
입력/확장: 5V 아날로그 입력(4ch 또는 2ch 차동 구성 언급), 옵토 절연 디지털 입력(최대 12V) 2ch, RS485, I2C(외부 릴레이 확장 보드 연계)
즉 RC15는 “AOG가 계산한 목표값”을 받아 현장에서 출력(밸브/섹션)을 구동하고, 센서/상태를 AOG로 되돌려 주는 작업기 전용 컨트롤러입니다.
Where WIZnet Fits
RC15는 ESP32의 Wi-Fi 외에, W5500을 SPI로 추가해 유선 이더넷 기반 UDP 통신을 사용할 수 있게 해 둔 설계입니다.
이 선택이 의미 있는 이유는 단순합니다.
작업기는 전장 노이즈/금속 구조물/장거리 하네스 같은 조건이 흔해 무선 링크 품질이 흔들릴 수 있고,
Rate/섹션 제어는 일정 주기로 명령을 반영해야 하므로 통신 지연·손실의 변동이 체감 문제로 이어지기 쉽습니다.
W5500을 쓰면 AOG↔RC15 사이를 유선으로 고정할 수 있어, 현장 재현성이 좋아집니다. (W5500은 하드웨어 TCP/IP 오프로딩 기반의 이더넷 컨트롤러이며, 소켓 기반으로 통신을 처리합니다.)
Implementation Notes
ESP32 Rate 모듈 펌웨어에서 W5500 설정을 확인할 수 있습니다. RC_ESP32.ino에는 W5500 SS 핀과 Ethernet UDP 구성이 포함되어 있습니다.
const uint8_t W5500_SS = 5; // W5500 SPI SS
EthernetUDP UDP_Ethernet;
const uint16_t ListeningPort = 28888;
const uint16_t DestinationPort = 29999;
const uint16_t LoopTime = 50; // 20Hz
const uint16_t SendTime = 200;W5500은 SPI + CS(SS) 핀(기본 5번 GPIO) 전제를 갖습니다. 보드/배선이 이 핀맵과 맞아야 합니다.
**UDP 포트(28888 수신, 29999 송신)**가 코드에 정의되어 있어, AOG 쪽 설정도 동일한 포트를 사용해야 통신이 맞습니다.
루프가 **50ms(20Hz)**로 돌아가도록 잡혀 있어, 통신 경로가 불안정하면 제어 품질이 흔들릴 여지가 있습니다.
Practical Tips / Pitfalls
섹션 운용 모델을 먼저 확정하세요: 7개 가역(모터식)인지, 14개 단방향(솔레노이드)인지에 따라 배선과 출력 사용 방식이 달라집니다.
W5500 사용 시 CS(SS) 핀 매칭을 최우선으로 확인하세요: 펌웨어 기본값은 W5500_SS = 5입니다.
유량계 펄스 입력은 배선 품질이 성능입니다: 모터/밸브 전원선과 분리, 접지/실드, 커넥터 체결 신뢰성을 확보하세요.
아날로그 입력은 5V 직결 전제로 생각하지 마세요: 보드 전면단(ADC/스케일링/필터)이 어떻게 설계됐는지 기준으로 연결해야 합니다.
현장 네트워크가 브로드캐스트/유니캐스트 중 무엇을 요구하는지에 따라 동작이 달라질 수 있습니다(네트워크 정책 확인).
FAQ (5 questions, all WIZnet-focused)
Q1. RC15에서 W5500을 쓰는 핵심 이유는 뭔가요?
A1. AOG↔작업기 컨트롤러 사이의 명령/상태 교환은 주기성이 중요합니다. W5500 유선 이더넷은 Wi-Fi 대비 지연·손실 변동이 작아, 일정 루프(예: 20Hz) 기반 제어에서 체감 안정성이 좋아집니다.
Q2. W5500은 RC15(ESP32)와 어떻게 연결되나요?
A2. SPI로 연결됩니다. 펌웨어에서 W5500 CS(SS)가 W5500_SS = 5로 정의되어 있어, 모듈 CS가 해당 GPIO에 연결되어야 합니다.
Q3. W5500은 이 프로젝트에서 정확히 어떤 통신을 담당하나요?
A3. Ethernet UDP 경로를 담당합니다. 코드상 기본값으로 28888 포트 수신, 29999 포트 송신이 정의되어 있어, 이 포트로 AOG와 데이터를 주고받는 전제가 깔려 있습니다.
Q4. 초보자가 W5500 옵션까지 적용할 때 가장 많이 틀리는 부분은?
A4. (1) CS(SS) 핀 불일치, (2) 전원/그라운드 품질, (3) AOG와 포트/IP 설정 불일치입니다. 특히 CS 핀은 펌웨어가 기대하는 값과 실제 배선이 어긋나면 바로 통신이 실패합니다.
Q5. Wi-Fi 대신 W5500 이더넷을 선택하면 어떤 트레이드오프가 있나요?
A5. 케이블/커넥터/방수 처리 같은 기구 설계가 필요하지만, 그만큼 링크 품질이 예측 가능해집니다. 현장에서 “한 번 잡으면 계속 동일하게 동작”시키려는 목적이라면 유선의 이점이 큽니다.
Summary
RC15 is an ESP32-based board design in the AgOpenGPS (AOG) ecosystem for controlling two rate channels (flow/valve/motor) and up to 7–14 section outputs on an implement. When needed, it can be fitted with a WIZnet W5500 (SPI Ethernet module) to exchange data with AOG over wired UDP. The W5500 acts as a “wired communication path” that helps keep link quality stable even when on-site Wi-Fi is unreliable.
Image source: AI-generated
What is AgOpenGPS (AOG)?
AgOpenGPS (AOG) is an open-source ecosystem for tractors and precision agriculture that uses GNSS-based positioning to integrate functions such as autosteer, section control, and variable-rate application. For implement control, the “main system” (AOG) computes targets (e.g., target application rate, section On/Off commands), while the on-machine implement controller drives valves/motors/relays and reports status back to AOG.
Image source: AI-generated
What RC15 Does
RC15 is defined to perform the following functions for AOG implement control:
Two rate output channels: Two DRV8870-based channels capable of forward/reverse (reversible) drive for valves or motors
7–14 section outputs: Using seven DRV8870 drivers, the design can be operated either as:
7 reversible outputs (e.g., motorized valves), or
14 single-ended section outputs (e.g., solenoid valves)
Inputs/expansion: 5V analog inputs (mentions 4 channels or a 2-channel differential configuration), two opto-isolated digital inputs (up to 12V), RS485, and I2C (including support for an external relay expansion board)
In other words, RC15 is a dedicated implement controller that takes the “targets calculated by AOG,” drives real-world outputs (valves/sections) on the machine, and returns sensor/status information to AOG.
Where WIZnet Fits
In addition to the ESP32’s Wi-Fi, RC15 is designed to support adding a W5500 over SPI so it can use wired Ethernet UDP communication.
This matters because:
Implements often operate in conditions with electrical noise, metal structures, and long wiring harnesses—factors that can destabilize wireless links.
Rate/section control must apply commands on a fixed cadence, so variation in latency and packet loss quickly becomes noticeable.
With a W5500, the AOG↔RC15 link can be fixed to wired Ethernet, improving repeatability in the field. (The W5500 is a hardware TCP/IP offload Ethernet controller that communicates via a socket-based interface.)
Implementation Notes
You can confirm W5500-related settings in the ESP32 rate module firmware. In RC_ESP32.ino, the W5500 SS pin and the Ethernet UDP configuration are included:
const uint8_t W5500_SS = 5; // W5500 SPI SS
EthernetUDP UDP_Ethernet;
const uint16_t ListeningPort = 28888;
const uint16_t DestinationPort = 29999;
const uint16_t LoopTime = 50; // 20Hz
const uint16_t SendTime = 200;Three points here directly affect an RC15 build:
The W5500 assumes SPI plus a CS/SS pin (default GPIO 5). Your board wiring must match this pin map.
The UDP ports are defined in code (receive 28888, transmit 29999), so the AOG side must use the same ports.
The control loop is set to 50 ms (20 Hz), so unstable communication can translate into visible control quality issues.
Practical Tips / Pitfalls
Decide the section output mode first: 7 reversible (motorized) vs 14 single-ended (solenoid) affects wiring and how outputs are used.
When using W5500, verify CS/SS pin matching first: the firmware default is W5500_SS = 5.
Pulse inputs (e.g., flow meters) are only as good as the wiring: separate from motor/valve power, ensure proper grounding/shielding, and use reliable connectors.
Don’t assume analog inputs can be “direct 0–5V into the MCU”: connect based on the board’s front-end (ADC scaling/filtering) design.
Behavior may differ depending on whether your field network expects broadcast vs unicast; check the network policy of your switch/router setup.
FAQ (5 questions, all WIZnet-focused)
Q1. What’s the main reason to use W5500 on RC15?
A1. Command/status exchange between AOG and the implement controller is cadence-sensitive. Wired Ethernet via W5500 typically shows less variation in latency and packet loss than Wi-Fi, which tends to feel more stable in fixed-loop (e.g., 20 Hz) control.
Q2. How does the W5500 connect to RC15 (ESP32)?
A2. Over SPI. The firmware defines the W5500 chip select as W5500_SS = 5, so the module’s CS must be wired to that GPIO.
Q3. What communication does the W5500 handle in this project?
A3. The Ethernet UDP path. The code defines default ports as 28888 for receiving and 29999 for transmitting, assuming AOG exchanges data over those ports.
Q4. What do beginners most often get wrong when adding W5500?
A4. (1) CS/SS pin mismatch, (2) poor power/ground quality, and (3) mismatch between AOG and controller port/IP configuration. A CS mismatch in particular can stop communication entirely.
Q5. What trade-offs come with choosing W5500 Ethernet instead of Wi-Fi?
A5. You must handle cabling, connectors, and weatherproofing, but the link becomes more predictable. If the goal is “configure once and behave the same every time” in the field, wired Ethernet often pays off.


