# Daikin Chiller (RTU) Emulator This project is an Arduino-based emulator for a Daikin Chiller unit, communicating over Modbus RTU. It is designed to be a flexible template that can be adapted to simulate different types of chillers by modifying the configuration and state logic. The emulator operates on a state machine with three core states: * **Standby**: The chiller is idle but ready. * **Running**: The chiller is active and operational. * **Fail**: The chiller has encountered a fault condition. ## Features * **Modbus RTU Communication**: Emulates a Modbus slave device. * **State Machine Logic**: Simulates different operational states (Standby, Running, Fail). * **Dynamic Value Simulation**: Uses "Strategies" (e.g., PID, Ramp) to generate realistic, changing values for Modbus points. * **Configurable Modbus Map**: The entire Modbus register map is defined in a single, easy-to-modify file (`config.h`). * **Extensible Design**: The structure allows for the addition of new states and behaviors. ## Hardware Prerequisites The code is written for an ESP8266/ESP32-style microcontroller with WiFi capabilities and at least one hardware serial port for RS485 communication. * **Microcontroller**: ESP8266, ESP32, or similar. * **RS485 Transceiver**: A module like the MAX485 to interface with the Modbus RTU bus. ## Software Dependencies This project relies on a Modbus library. Ensure you have the correct library installed in your Arduino IDE. * **Modbus Library**: The code uses a library that provides `ModbusRTU.h` and optionally `ModbusIP_ESP8266.h`. --- ## How to Customize for a New Chiller To adapt this template for a new chiller, follow these steps. ### 1. Configure Device-Specific Parameters (`config.h`) Open `CH_Daikin_AWV026B_RTU/config.h`. This is the main file for device-specific settings. #### Modbus RTU Settings Update the following constants for your device's serial communication setup. ```c++ const int BAUDRATE = 19200; // The serial communication speed const int RX_PIN = 17; // The GPIO pin for receiving data (RX) const int TX_PIN = 16; // The GPIO pin for transmitting data (TX) const int RST_PIN = 4; // The GPIO pin for RS485 direction control const int MODBUS_ID = 1; // The unique slave ID for this device