RS485 Modbus RTU Sniffer Using Arduino Nano + MAX485
1. Introduction
This document describes how to set up an Arduino Nano with a MAX485 RS485 module to
passively listen (snoop) on RS485 Modbus RTU communication. It uses SoftwareSerial to
read RS485 data via female-to-female jumper wires.
2. Required Components
- Arduino Nano
- MAX485 RS485 Module
- Female-to-female jumper wires
- USB Cable for Arduino Nano
- RS485 A/B data lines (from existing RS485 network)
3. Wiring Connections (Using Female-to-Female Jumpers)
Connect the MAX485 module to Arduino Nano as follows:
MAX485 Pin Arduino Nano Pin
RO D10 (RX for SoftwareSerial)
RE GND
DE GND
DI Not Connected
VCC 5V
GND GND
RS485 A/B lines should be connected to the existing RS485 network.
4. Arduino Sketch
Upload the following sketch to the Arduino Nano:
#include <SoftwareSerial.h>
#define RS485_RX 10 // MAX485 RO pin connected here
#define RS485_TX 11 // Not used, but required for SoftwareSerial
SoftwareSerial rs485Serial(RS485_RX, RS485_TX); // RX, TX
void setup() {
Serial.begin(9600); // Serial monitor
rs485Serial.begin(9600); // Match Modbus baudrate
void loop() {
if (rs485Serial.available()) {
byte b = rs485Serial.read();
Serial.print("0x");
if (b < 0x10) Serial.print("0");
Serial.print(b, HEX);
Serial.print(" ");
#include <SoftwareSerial.h>
#define RS485_RX 10 // MAX485 RO pin connected here
#define RS485_TX 11 // Not used, but required for SoftwareSerial
SoftwareSerial rs485Serial(RS485_RX, RS485_TX); // RX, TX
void setup() {
Serial.begin(9600); // Serial monitor
rs485Serial.begin(9600); // Match Modbus baudrate
void loop() {
if (rs485Serial.available()) {
String msg = rs485Serial.readStringUntil('\n');
Serial.print("Received: ");
Serial.println(msg);
5. Arduino IDE Setup and Code Upload
To upload the Arduino sketch to the Nano, you need to install the Arduino IDE and set it up
correctly:
1. Download the Arduino IDE from the official website:
https://www.arduino.cc/en/software
https://downloads.arduino.cc/arduino-1.8.19-windows.exe
2. Install and open the Arduino IDE.
3. Connect the Arduino Nano via USB cable to your computer.
4. Select the correct board: Go to Tools > Board > 'Arduino Nano'.
5. Select the correct processor: For newer clones, choose 'ATmega328P (Old Bootloader)'.
6. Select the correct port: Go to Tools > Port and choose the one labeled 'Arduino Nano' (e.g.,
COM3 or /dev/ttyUSB0).
7. Paste the provided sketch into the Arduino IDE.
8. Click the Upload button (right arrow icon) to compile and upload the code.
9. Open the Serial Monitor (top right icon) and set baud rate to 9600 to observe data.
6. Operation Instructions
1. Connect the Arduino Nano and MAX485 as per the wiring table using female-to-female
jumper wires.
2. Upload the provided Arduino sketch.
3. Connect the RS485 A/B lines from the existing RS485 network.
4. Open Serial Monitor (9600 baud) and observe raw Modbus RTU frames in hex format.
7. Safety Tips
- Ensure DE and RE pins are tied to GND to keep the MAX485 in receive-only mode.
- Do not connect DI; the module must not transmit.
- Make sure A/B lines are not reversed; incorrect polarity will cause no or corrupted data.
- Use an isolated RS485 module if connecting to industrial devices.