How to Monitor Classic 200SL

Started by justinbowser, April 16, 2020, 12:32:42 PM

Previous topic - Next topic

ClassicCrazy

Quote from: Graham on May 18, 2020, 09:06:36 AM
If you have any issues, you can test your serial connection on a pc if you have a USB to RS232 adapter like this https://www.newegg.ca/p/N82E16812203018?item=N82E16812203018&source=region&nm_mc=knc-googleadwordsca-pc&cm_mmc=knc-googleadwordsca-pc-_-pla-_-cables+-+serial+cables-_-N82E16812203018&gclid=CjwKCAjw5Ij2BRBdEiwA0Frc9Te4N5aS_ayeVwhO9of5PZkk6DRLMbk-lQj7lN3ZKBsX4SyFbTA0exoC48YQAvD_BwE
you can verify the serial modbus communication using my modbusTool https://github.com/ClassicDIY/ModbusTool using the Modbus Master in RTU mode, select the com port of the USB adapter and connect, you should be able to 'Read Holding Registers' with start address 4100. (don't forget to set the slaveID to what you have your classic set to, default is 10)

Graham.

I downloaded Modbus Master on my windows computer and unzipped it into a folder . But I can't figure out how to run it ?

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

ClassicCrazy

#31
I can connect to Esp32 with local status app - but no data fills in .
This is serial data from Esp32
I have it connected to the top port , I turned off follow me - still nothing .


ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
Config size: 264
Loaded config 'iwcThingName'= 'ModbusAdapter'
Loaded config 'iwcApPassword'= <hidden>
Loaded config 'iwcWifiSsid'= 'Tomato24'
Loaded config 'iwcWifiPassword'= <hidden>
Loaded config 'iwcApTimeout'= '30'
Loaded config 'modbusPortParam'= '502'
Loaded config 'modbusAddressParam'= '10'
Loaded config 'baudSelector'= '19200'
SkipApStartup mode was applied
State changing from: 0 to 3
Connecting to [Tomato24] (password is hidden)
State changed from: 0 to 3
WiFi connected
IP address: 192.168.3.28
State changing from: 3 to 4
{"IP":"192.168.3.28","ApPassword":"ModbusAdapter"}
                                                  Accepting connection
State changed from: 3 to 4
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

ClassicCrazy

I think I have my wiring right - since I couldn't get modbus master to work I tried Chipkins Modbus scanner with the usb to serial adapter going right to the cable to my Classic
seems like it was reading something ? photo of some of the scan

system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

Graham

#33
Quote from: ClassicCrazy on May 19, 2020, 01:47:31 AM


I downloaded Modbus Master on my windows computer and unzipped it into a folder . But I can't figure out how to run it ?

Larry

You have to go to the Release Tab in github, (https://github.com/ClassicDIY/ModbusTool/releases), download the ModbusTool.msi installation file, double click it to start the installation.
The file is not code signed (since a signing certificate is around $300/yr) so you will get a warning from Windows Defender, click 'more info' and 'Run Anyway' to start the installation.
Just click 'next...close' to complete the installation wizard. Once complete you will find the 'ModbusTool' menu item in the windows start menu where you have the ModbusMaster and ModbusSlave apps.

I added a wiki page describing the installation procedure https://github.com/ClassicDIY/ModbusTool/wiki

Graham
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

Graham

#34
Quote from: ClassicCrazy on May 19, 2020, 02:52:29 AM
I think I have my wiring right - since I couldn't get modbus master to work I tried Chipkins Modbus scanner with the usb to serial adapter going right to the cable to my Classic
seems like it was reading something ? photo of some of the scan

looks like you're trying to read an invalid address, try 4100


ModbusTool should work now, try downloading the msi file again from https://github.com/ClassicDIY/ModbusTool/releases
if you set it up to read at 4100 for 64 byte it should display data similar to the attachment

The Slave ID must be set to what you have in the classic (bottom of the Tech tab in the local app, not sure where it is on the MNGP)



Graham
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

Graham

Quote from: ClassicCrazy on May 18, 2020, 04:38:36 PM
Graham ,
I got the Esp32 talking to the computer via wireless but must not have something right on the connection to the Classic because no data is showing up. I did try flipping the tx rx wires.  I also gave up powering the ESP32 from the 9v on jack - I think it might not have had enough current to run esp wifi.
Well I had a few problems - because I started this last night and then when I was first plugged in and trying to connect I tried reflashing when I did not see it show up on router today. Flashing was working but something not right - finally saw the Flash Tool defaulting to the other espfile for other project - it had the same name but different location.
Did you ever resolve the Follow Me errors on lower port or does follow me have to be off for this to work ? Reason I ask is because I have a serial cable wire coming inside from project a year or two ago and it already has rs232 on it. It would be nice to work inside to debug this instead of having to run out to shed all the time and now I need to get laptop charged up to figure out if my cable to top jack on Classic 2 in follow me will work okay on modbus. That is what I will be trying next time I get back at this. I guess

Larry

I'm not sure if followMe has to be off, I connected the RX & gnd of my USB to RS232 adapter to probe the data between the ESP and the Classic serial comms using putty and I would see a lot more chatter from the classic when FollowMe was on but I'm not sure if that caused any problems. I did notice that the classic did not always answer every modbus request from the ESP so I modified the ESP code to cache the responses from the classic for up to one minute.

Graham.
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

ClassicCrazy

#36
Thanks Graham - I got the Modbus Master installed .
It didn't seem to be working at first but for some reason I don't know all of a sudden it works .
Of course me trying different cables, adapters, etc who knows .
So I can now verify that I make connection to Classic on both lower and middle jacks ( with appropriate wiring changes between ports).
I still cannot get the data into the Esp32 . I checked my ttl to rs232 adapter with an arduino and it seemed to be working .
Some notes - a standard telephone cable reverses the ends so I had to take note that one end of the cable was opposite from the other when I wired it up.
I found a Radio Shack phone data module so that meant I could stop soldering off and onto my DB9 connector and just repunch the wires on data module instead - makes life easier and easier to fix mistakes. Hurray for me picking up stuff at garage sales and hamfests and keeping it around just in case I ever need it.
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

ClassicCrazy

Graham ,
I was looking at the code and see reference to GPIO5 .
Should there be a connection to that pin on Esp32 or on the DB9 ?

void RtuMaster::Init(long baudRate, uint8_t modbusAddress)
{
    Serial1.begin(baudRate, SERIAL_8N1, GPIO_NUM_16, GPIO_NUM_17, false); // Modbus connection
    while (!Serial1)
    {
        ; // wait for serial port to connect.
    }
    _port = &Serial1;
    _unitId = modbusAddress;
    _rtsPin = GPIO_NUM_5;
    if (_rtsPin >= 0)
    {
        pinMode(_rtsPin, OUTPUT);
        digitalWrite(_rtsPin, LOW);
    }
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

Graham

Quote from: ClassicCrazy on May 19, 2020, 04:28:21 PM
Graham ,
I was looking at the code and see reference to GPIO5 .
Should there be a connection to that pin on Esp32 or on the DB9 ?

void RtuMaster::Init(long baudRate, uint8_t modbusAddress)
{
    Serial1.begin(baudRate, SERIAL_8N1, GPIO_NUM_16, GPIO_NUM_17, false); // Modbus connection
    while (!Serial1)
    {
        ; // wait for serial port to connect.
    }
    _port = &Serial1;
    _unitId = modbusAddress;
    _rtsPin = GPIO_NUM_5;
    if (_rtsPin >= 0)
    {
        pinMode(_rtsPin, OUTPUT);
        digitalWrite(_rtsPin, LOW);
    }

The classic serial ports don't expose the RTS or CTS pins so the _rtsPin won't have any affect.

Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

Graham

Quote from: ClassicCrazy on May 19, 2020, 03:42:06 PM
Thanks Graham - I got the Modbus Master installed .
It didn't seem to be working at first but for some reason I don't know all of a sudden it works .
Of course me trying different cables, adapters, etc who knows .
So I can now verify that I make connection to Classic on both lower and middle jacks ( with appropriate wiring changes between ports).
I still cannot get the data into the Esp32 . I checked my ttl to rs232 adapter with an arduino and it seemed to be working .
Some notes - a standard telephone cable reverses the ends so I had to take note that one end of the cable was opposite from the other when I wired it up.
I found a Radio Shack phone data module so that meant I could stop soldering off and onto my DB9 connector and just repunch the wires on data module instead - makes life easier and easier to fix mistakes. Hurray for me picking up stuff at garage sales and hamfests and keeping it around just in case I ever need it.
Larry

Try connecting the ModbusMaster app in TCP mode to the ESP's IP address and try 'Read Holding Register' at address 4100 for 20 bytes... let me know what it says in the log window.

+ if you have a TTL to USB adapter like this one
https://www.aliexpress.com/item/33037470874.html?src=google&src=google&albch=shopping&acnt=494-037-6276&isdl=y&slnk=&plac=&mtctp=&albbt=Google_7_shopping&aff_platform=google&aff_short_key=UneMJZVf&&albagn=888888&albcp=7386552844&albag=80241711349&trgt=743612850714&crea=en33037470874&netw=u&device=c&albpg=743612850714&albpd=en33037470874&gclid=CjwKCAjwqpP2BRBTEiwAfpiD-2TjpL8poiZQdsDnDK1-pZ547p5FPU0mW_St-EXOr6A8bMdER_I17RoCOJwQAvD_BwE&gclsrc=aw.ds
, you can also connect the ESP serial (GPIO16,17) to your PC and use the ModbusSlave tool in RTU mode to emulate the classic, import the attached csv into ModbusSlave and listen to the COM port of the FTDI adapter (19200, 8, 1 None) SlaveID: 10
Then you should be able to have ModbusMaster send a TCP request to the ESP which will then issue a RTU request to the ModbusSlave, the response should make it's way back to the ModbusMaster and display the same data you imported in the ModbusSlave


Graham.
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

ClassicCrazy

Graham -
Got the ftdi hooked up to Modbus Slave - imported your csv to the esp32 pins
I guess it works
Screen shots of Modbus Master, Modbus Slave ,Local Status app connected to Esp32
I guess that means I have some communication issue with my Classic ? Maybe still some problem with my rs232 to ttl adapter or the 25 foot wire run to serial data .
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

justinbowser

My parts are trickling in from Amazon so I might be able to start wiring stuff up by end of week.  It looks like it's a bit mpore complicated than previously thought?
Justin B. - KI5GKD
Classic 200SL, 2.9 KW of Mission Solar panels
Samlex PST-1500-24W inverter
Specialized Power Systems 800 AH 24 V LiFePO4 battery bank (4x200)

ClassicCrazy

No not really that complicated .  Only a few wire connections. You just need to make sure you get them correct  and drawing it out would help. It was more complicated for me since I was switching around between top and bottom ports and the wiring is different for them and I also used different cables .
Not sure which cable you are getting but if you can see the wire colors on the end that plugs in to the Classic  make a drawing .  The Classic has a 6 pin connector but only uses the 3 of the 4 center pins ( doesn't use pin 1 or 6).  But a standard 4 wire telephone cable will also work if that is what you have since it has just the 4 center wires on it. 
I am happy to help if I can.
I didn't get mine to work - still debugging that as you saw in discussion above. The Esp32 part works as expected, the cable to Classic serial port works with computer,  just not sure where my issue is yet.

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

justinbowser

I just got a run-of-the-mill (DSL I think) RJ-11 cable.  I will cut off one end and solder it to a DB9.  I also ordered a "pack" of voltage converters and will take 24V from my bank and step it down to 5V.
Justin B. - KI5GKD
Classic 200SL, 2.9 KW of Mission Solar panels
Samlex PST-1500-24W inverter
Specialized Power Systems 800 AH 24 V LiFePO4 battery bank (4x200)

Graham

Quote from: ClassicCrazy on May 20, 2020, 11:12:19 AM
Graham -
Got the ftdi hooked up to Modbus Slave - imported your csv to the esp32 pins
I guess it works
Screen shots of Modbus Master, Modbus Slave ,Local Status app connected to Esp32
I guess that means I have some communication issue with my Classic ? Maybe still some problem with my rs232 to ttl adapter or the 25 foot wire run to serial data .
Larry

During my testing I found that the classic didn't always respond to modbus RTU commands when it was also had the ethernet connected.
I connected to it using the local app to turn off followMe at which point it stopped responding to any RTU request.
Once I disconnected the Ethernet cable and rebooted the classic, it started to work again.

You can also use the ftdi rx pin and something like CoolTerm to probe the data between the classic and the ESP by connecting the ftdi rx to either the RX & TX pins of the esp
while using the Android app setup with the IP address of the ESP32 to issue read commands every 2 seconds...
(connect the gnd of the ftdi to the ESP gnd, do not connect the tx or vcc of the ftdi)

I had the ESP setup next to the classic, so my serial cable was only about a foot long.

CoolTerm: https://freeware.the-meiers.org/


Graham
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s