Arduino Uno as Modbus RTU Slave with MKR 485 Shield - Not Communicating with PC - Please Help ;

This page summarizes the projects mentioned and recommended in the original post on /r/arduino

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • ArduinoModbus

  • Question: Can anyone assist me figure out the wiring between an Arduino Uno and MKR 485 Shield, and the shield and my PC? All related links are at the bottom of the post. Background: I am trying to use an Uno as a Modbus Slave, and cannot get my PC to read the holding registers (40001-40005). The code generates the registers and writes the values 1-5 to the corresponding holding registers which are printed to the serial monitor as shown below: IDE Screen Capture #include // ArduinoModbus depends on the ArduinoRS485 library #include long holdingRegisterArray[] = {0,0,0,0,0}; // initialize 5 long array for holding registers void setup() { // start the Modbus RTU server, with (slave) id 1 ⠀ if (!ModbusRTUServer.begin(1, 9600)) { Serial.println("Failed to start Modbus RTU Server!"); while (1); } delay(10000); // configure a single coil at address 0x00 ModbusRTUServer.configureHoldingRegisters(0x01, 5); ModbusRTUServer.holdingRegisterWrite(0x01, 1); ModbusRTUServer.holdingRegisterWrite(0x02, 2); ModbusRTUServer.holdingRegisterWrite(0x03, 3); ModbusRTUServer.holdingRegisterWrite(0x04, 4); ModbusRTUServer.holdingRegisterWrite(0x05, 5); } void loop() { // poll for Modbus RTU requests ModbusRTUServer.poll(); holdingRegisterArray[0] = ModbusRTUServer.holdingRegisterRead(0x01); holdingRegisterArray[1] = ModbusRTUServer.holdingRegisterRead(0x02); holdingRegisterArray[2] = ModbusRTUServer.holdingRegisterRead(0x03); holdingRegisterArray[3] = ModbusRTUServer.holdingRegisterRead(0x04); holdingRegisterArray[4] = ModbusRTUServer.holdingRegisterRead(0x05); for(int i = 0; i < 5; i++) { Serial.println(holdingRegisterArray[i]); } } When trying to read registers 40001 - 40005 I get a the following error in ModScan "** MODBUS Message TIME-OUT** as shown below: ModScan Screen Capture ​ I believe I have a wiring issue, but can't seem to get the wiring squared away, any help would be greatly appreciated!! Currently the wiring is as follows: ​ Current Wiring (Not Working) ​ Current Wiring - Top View Current Wiring - Side of MKR 485 Shield Current Wiring - Side of MKR 485 Shield ​ This is my best understanding of the wiring based on the following schematics: ​ MKR 485 Shield Schematic ​ Uno Schematic ​ DT-9003 USB-Serial Converter Links: MKR 485 Shield Page MKR 485 Shield Schematic Uno Schematic MAX3157 Datasheet DT-9003 USB-Serial Converter Manual ArduinoModbus Library ArduinoRS485 Library

  • ArduinoRS485

  • Question: Can anyone assist me figure out the wiring between an Arduino Uno and MKR 485 Shield, and the shield and my PC? All related links are at the bottom of the post. Background: I am trying to use an Uno as a Modbus Slave, and cannot get my PC to read the holding registers (40001-40005). The code generates the registers and writes the values 1-5 to the corresponding holding registers which are printed to the serial monitor as shown below: IDE Screen Capture #include // ArduinoModbus depends on the ArduinoRS485 library #include long holdingRegisterArray[] = {0,0,0,0,0}; // initialize 5 long array for holding registers void setup() { // start the Modbus RTU server, with (slave) id 1 ⠀ if (!ModbusRTUServer.begin(1, 9600)) { Serial.println("Failed to start Modbus RTU Server!"); while (1); } delay(10000); // configure a single coil at address 0x00 ModbusRTUServer.configureHoldingRegisters(0x01, 5); ModbusRTUServer.holdingRegisterWrite(0x01, 1); ModbusRTUServer.holdingRegisterWrite(0x02, 2); ModbusRTUServer.holdingRegisterWrite(0x03, 3); ModbusRTUServer.holdingRegisterWrite(0x04, 4); ModbusRTUServer.holdingRegisterWrite(0x05, 5); } void loop() { // poll for Modbus RTU requests ModbusRTUServer.poll(); holdingRegisterArray[0] = ModbusRTUServer.holdingRegisterRead(0x01); holdingRegisterArray[1] = ModbusRTUServer.holdingRegisterRead(0x02); holdingRegisterArray[2] = ModbusRTUServer.holdingRegisterRead(0x03); holdingRegisterArray[3] = ModbusRTUServer.holdingRegisterRead(0x04); holdingRegisterArray[4] = ModbusRTUServer.holdingRegisterRead(0x05); for(int i = 0; i < 5; i++) { Serial.println(holdingRegisterArray[i]); } } When trying to read registers 40001 - 40005 I get a the following error in ModScan "** MODBUS Message TIME-OUT** as shown below: ModScan Screen Capture ​ I believe I have a wiring issue, but can't seem to get the wiring squared away, any help would be greatly appreciated!! Currently the wiring is as follows: ​ Current Wiring (Not Working) ​ Current Wiring - Top View Current Wiring - Side of MKR 485 Shield Current Wiring - Side of MKR 485 Shield ​ This is my best understanding of the wiring based on the following schematics: ​ MKR 485 Shield Schematic ​ Uno Schematic ​ DT-9003 USB-Serial Converter Links: MKR 485 Shield Page MKR 485 Shield Schematic Uno Schematic MAX3157 Datasheet DT-9003 USB-Serial Converter Manual ArduinoModbus Library ArduinoRS485 Library

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts