diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f66f7b9 --- /dev/null +++ b/readme.md @@ -0,0 +1,66 @@ +# DN23E08 Modbus Slave + +This project enables the DN23E08, an Arduino-based PLC module, to function as a Modbus RTU slave device, allowing it to be integrated into industrial automation systems and controlled remotely via Modbus communication. + +## Features + +- **Modbus RTU Slave**: Implements standard Modbus RTU protocol over RS485 +- **I/O Mapping**: Maps DN23E08 inputs/outputs to Modbus registers +- **Arduino-based**: Easy to customize and extend using Arduino IDE + +## Hardware Requirements + +- DN23E08 PLC module +- Arduino Nano v3.0 (required for DN23E08 operation) +- RS485 communication interface +- 12-24V power supply + +## Installation + +1. Clone this repository: + ```bash + git clone https://git.nielsgeens.be/projects/DN23E08_modbus.git + cd DN23E08_modbus + ``` + +2. Open the Arduino sketch in Arduino IDE + +3. Install required libraries (if any - check the code for dependencies) + +4. Configure your Modbus settings: + - Slave ID + - Baud rate + - Parity settings + +5. Upload the sketch to your Arduino Nano + +## Configuration + +Edit the configuration parameters in the main sketch: + +```cpp +// Modbus Configuration +#define SLAVE_ID 1 // Modbus slave address +#define BAUD_RATE 9600 // RS485 baud rate +#define PARITY SERIAL_8N1 // Parity settings +``` + +## Modbus Register Map + +| Register Type | Address Range | Description | +|---------------|---------------|-------------| +| Coils | 0x0000-0x0007 | Digital outputs (relays) | +| Discrete Inputs | 0x0000-0x0007 | Digital inputs (opto-isolated) | +| Input Registers | 0x0000-0x0007 | Analog inputs (current/voltage) | +| Holding Registers | 0x0000-0x00FF | Configuration and control registers | + +## Usage + +1. Connect the DN23E08 to your Modbus master via RS485 +2. Configure your Modbus master with the correct slave ID and communication settings +3. Use standard Modbus function codes to read inputs and write outputs: + - **Read Coils (0x01)**: Read relay output status + - **Read Discrete Inputs (0x02)**: Read digital input status + - **Read Input Registers (0x04)**: Read analog input values + - **Write Single Coil (0x05)**: Control individual relay outputs + - **Write Multiple Coils (0x0F)**: Control multiple relay outputs