
​Arduino 33 Nano to ESP 32: Modbus Communication
Arduino Nano 33 IoT
This is a compact microcontroller board featuring an ARM Cortex-M0+ processor, Wi-Fi and Bluetooth connectivity (via the u-blox NINA-W102 module), and an onboard IMU, making it ideal for IoT applications and sensor-based projects.

Master Code with Read/Write
Writes a value (100) to the slave's holding register 0 and then reads the modified value from register 1. It verifies the success of each operation and prints the results to the serial monitor for debugging.

Modbus Connection Schematic
This schematic illustrates a Modbus RTU communication setup between an Arduino Nano 33 IoT (Master) and an ESP32 (Slave) using RS-485 modules. The master sends data to the slave, which processes it and stores the modified value for the master to read. Communication is handled over an RS-485 differential bus (A/B lines).
Note: The RS-485 module shown in the schematic is not the exact model used but the closest available equivalent. The actual RS-485 module features automatic switching between transmission and reception, eliminating the need for manual RE/DE control. Similarly, the ESP32 module depicted may differ from the actual ESP32-WROOM development board used in the implementation.

WROOM ESP32 Development Board with 2.4GHz WiFi, Dual Cores, and Integrated Antenna
A powerful, low-power module with a dual-core Xtensa LX6 processor, integrated 2.4GHz Wi-Fi and Bluetooth, multiple GPIOs, and an onboard antenna widely used for IoT, automation, and edge computing applications.

Slave Code with Read/Modify
When the master writes a value to holding register 0, the slave adds 100 and stores the result in holding register 1. The master can then read this modified value in a separate request.

Modbus Communication DEMO
The video demonstrates the Modbus RTU communication between an Arduino Nano 33 IoT (Master) and an ESP32-WROOM (Slave) using RS-485 modules. It begins by showing the power supply, microcontrollers, and RS-485 modules. The serial monitors of both devices display real-time data exchange.
​
The power supply is disconnected to test the setup, causing an error on the master’s serial feed, indicating it cannot read or write. Once power is restored, communication resumes normally. The same test is repeated by disconnecting power from the ESP32’s RS-485 module and then from the Nano 33 IoT’s RS-485 module, each time causing communication errors. This confirms that the devices are successfully communicating through the RS-485 modules.