A Forum run by Enthusiasts of MidNite Solar

MidNite Solar Monitoring software and hardware => MidNite Monitoring FAQ'S => Topic started by: Lubos_H on October 12, 2020, 07:53:51 AM

Title: Midnite Classic Modbus RS-232 communication
Post by: Lubos_H on October 12, 2020, 07:53:51 AM
Good day,
first I have to apologize for my bad English (google translator). I have this problem. I run 1 x Midnite Solar Classic 150 and 1 x Midnite Solar Classic Lite 150 in one place.
Both controllers only in SOLAR mode
I try to read data from the operation of the controllers from these two controllers via the Mudbus - RS232 protocol. I have controller number 1 set to Modbus ID 10, I have controller number 2 set to Modbus ID 11. The controllers are connected by an RS 232 cable to the Arduino Mega 2560 device. The Arduino Mega 2560 with the appropriate software reads data from the controller. If I connect the Arduino Mega to controller number 1, I set the Modbus 10 ID in the arduino software, I read the data from this controller correctly. If I connect the Arduino Mega to controller number 2, I set the Modbus 11 ID in the arduina software, it reads the data from the other controller correctly.


Next, I will connect the RS232 bus to the TX data of controller number 1, I will connect the data of TX controller number 2 and the RX data of controller number 1 will be connected to the data of RX controller number 2. After connecting, the communication will stop working.  In the Midnite Solar Classic 150 controller I use the middle RJ11 port, in the Midnite Solar Classic LITE 150 controller I use the lower RJ11 port. I assume that my consideration of RS232 bus interconnection is correct. However, I am not sure if I need to make any other settings in the Midnite Solar Classic 150 controller or the Midnite Solar Classic LITE150 controller.
I've been worried about this problem for about a week now and I can't find a solution to the problem.
Please ask for your information whether my assumptions are correct, or for a proposed solution on how to read data from both controllers via the RS-232 bus using the Modbus protocol. Thank you for your feedback.

Title: Re: Midnite Classic Modbus RS-232 communication
Post by: ClassicCrazy on October 12, 2020, 11:34:55 AM
There was a recent post that you need to set the Classic ID using the MNGP and not the Local Status App - not sure if this is  your issue or not.
Take a look in the Open Source section of the forums here because there is more info on connecting via rs-232 and modbus.
http://midniteftp.com/forum/index.php?board=34.0
Also look in the Raspberry Pi section because there is already a project that can get the data from two Classics and make it into MQTT data which you can then do with whatever you want. Also there is a project using ESP32 to do the same thing. They are in Open Source section of forums and on here
https://github.com/ClassicDIY
which also has tools to test the modbus.

Larry
Title: Re: Midnite Classic Modbus RS-232 communication
Post by: ClassicCrazy on October 12, 2020, 11:39:03 AM
Also look through this post - there was a lot of discussion on how to use the RS232 converter like you have and the ports to Classic to monitor data .
Graham was discussing various tools on how to test things .
http://midniteftp.com/forum/index.php?topic=4880.0

Larry
Title: Re: Midnite Classic Modbus RS-232 communication
Post by: Graham on October 12, 2020, 12:30:10 PM
Quote from: Lubos_H on October 12, 2020, 07:53:51 AM
Good day,
first I have to apologize for my bad English (google translator). I have this problem. I run 1 x Midnite Solar Classic 150 and 1 x Midnite Solar Classic Lite 150 in one place.
Both controllers only in SOLAR mode
I try to read data from the operation of the controllers from these two controllers via the Mudbus - RS232 protocol. I have controller number 1 set to Modbus ID 10, I have controller number 2 set to Modbus ID 11. The controllers are connected by an RS 232 cable to the Arduino Mega 2560 device. The Arduino Mega 2560 with the appropriate software reads data from the controller. If I connect the Arduino Mega to controller number 1, I set the Modbus 10 ID in the arduino software, I read the data from this controller correctly. If I connect the Arduino Mega to controller number 2, I set the Modbus 11 ID in the arduina software, it reads the data from the other controller correctly.


Next, I will connect the RS232 bus to the TX data of controller number 1, I will connect the data of TX controller number 2 and the RX data of controller number 1 will be connected to the data of RX controller number 2. After connecting, the communication will stop working.  In the Midnite Solar Classic 150 controller I use the middle RJ11 port, in the Midnite Solar Classic LITE 150 controller I use the lower RJ11 port. I assume that my consideration of RS232 bus interconnection is correct. However, I am not sure if I need to make any other settings in the Midnite Solar Classic 150 controller or the Midnite Solar Classic LITE150 controller.
I've been worried about this problem for about a week now and I can't find a solution to the problem.
Please ask for your information whether my assumptions are correct, or for a proposed solution on how to read data from both controllers via the RS-232 bus using the Modbus protocol. Thank you for your feedback.

I don't think you can connect both ports in parallel as you have it in your schematic, RS232 is meant to connect the DTE (terminal) to the DCE (computer) see https://en.wikipedia.org/wiki/RS-232 (https://en.wikipedia.org/wiki/RS-232), you would need to convert it to RS485 or use a separate serial port on the Arduino for each classic + you would have to modify the arduino code to use both ports

You could have a look at my Modbus Adapter project https://github.com/ClassicDIY/ModbusAdapter (https://github.com/ClassicDIY/ModbusAdapter) that converts modbus RTU to modbus TCP over wifi. I use this to access my Tri-Star TS-45 with my Android app. Each classic would need it's own ESP32 dev board.

Graham