PC master Arduino Slave with Modbus with RS485

I would like to use a PC as a master and two Arduino Nano as slaves with Max485. Each Arduino slave will use one Max485 with one LED and one button. I don't know know much about ModBus. I see Arduino IDE library has ArduinoModbus.h. I am not sure if they are good or not. I am looking for simple code that I can communicate with two Arduino slaves from PC on serial monitor. I see a lot of sample codes for two arduino which one is master and other is slave on RS485 with Modbus. I am not sure if we can use Modbus on Serial monitor. I have download Modbus tester. I am not sure how to use it and how to write the codes for both two slaves with Modbus.
For wire connect.

USB to RS485 connector on the PC RS485 Pin A to Max485 Pin A, Pin B to Max485 Pin B

two Max485 and two Arduno Nano
Max 485 Pin Di connects to Ardunio TX Pin
Max 485 Pin DE and RE connects both to Ardunio Pin 2
Max 485 Pin RO connects to Arduino RX pin

Button Pin 1 to GND Pin 2 to Ardunio Pin 12
LED one pin to resistor 220 ohm then connect to the GND and other other one to Arduino pin Pin 10

It's a good library but not for the Nano. That library is designed to be used with the MKR series of Arduinos, it uses too much RAM to be used on the AVR series of Arduinos.

Sounds like an academic project. Am I right?

I recommend this library for AVR slaves.

MAX485 is a chip, so you need to connect at least the GND and Vcc pins and you need a decoupling capacitor between GND and Vcc. You might want to pull RO HIGH, otherwise you have a floating pin while RE is HIGH. Maybe that's on your board but you told us that you just use a MAX485.

For good results you should connect GNDs too.


You said ArduinoModbus.h is not for Nano. Can you tell me which Modbus library that we should use for Nano? Where can we download the zip file? It is not for academic projects. I am 62 years old and very hard of hearing. My goal to have the PC is to send and receive the data from three or four Arduino Nano. Right now I just want to learn how to use Modbus tester from PC to send or get data from Arduino Nano. Last time I was able to send the data to Arduino Nano on RS485 from Serial monitor but could not figure out how to get the data from Arduino Nano to Serial Monitor. I wish there some instruction. I have a hard time understanding YouTube. I like to read and see pictures.

Did you read my answer? I already recommended a library.

You also didn't react to all my other hints.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.