Jump to content
Genetry Solar Forums

Data logging


AquaticsLive
 Share

Recommended Posts

  • 4 weeks later...

If you have V119 charger you can tap the information via the wifi connection.  I did look into it when given a V119 to evaluate but have no idea what I did with the information I gathered. 

The way I did it was a bit convoluted but, connect an access point as a client to the V119 controller's wifi.  Connect phone to the network behind the access point.  Place a dual ethernet interface computer with wireshark running between the access point and the rest of the network and listen.  It could also be done with a single interface computer and a smart switch that can reflect / mirror all traffic to a single port so that wireshark can see everything still.

For prior versions I had a microcontroller snooping the serial between the micro in the controller and the front panel.  Pin 9 and 10 on the connector LCD connector on the main board IIRC.

Link to comment
Share on other sites

  • 1 month later...

So I've finally cracked open a v119 60A MSB charge controller, tossed the DSO 'scope probes on the TX/RX lines to the little WiFi board, installed their highly suspiciously snoopy app (how many permissions again? what, you "need" to make/receive phone calls + access device storage???!), and started writing down the decoded data.  Turns out to be quite a simplistic protocol that can be read/written to pretty easily.

Data is all RS-232 @ 9600, n, 1.  In the 'scope, the "master TX" line is at a 3.3v logic level ("master RX" is at 5v)...but this is almost certainly due to the ESP8266 being a 3.3v chip.

The MSB unit does not send any data unless it's first asked for data.  (With no WiFi comm, the TX/RX leads are dead silent.)  Checksum is the simple addition of all bytes in the packet AFTER the 0xAA header byte.

I have observed the following "master output" data packets:

  • [0xAA] [0x55] [0x00 0x00 0x00] [checksum] -> "Read Status"
    • MSB responds ~300mS later with the following data string
      • [0xAA] [0xBB] [16: BatteryVoltage x.1] [16: BatteryAmps x.1] [16: SolarVolts x.1] [16: SolarWatts x1] [16: Temperature C x.1] [16: Cumulative KWH] [16: ???] [ModeFlags] [ErrorFlags] [0x00] [checksum]
      • note: all "16" registers are 2-byte little-endian 16-bit values.  For example, battery voltage bytes of [0x53] [0x01] -> 0x0153 -> 339 decimal = 33.9v
      • [ModeFlags]...only seen 1 bit ever get set:
        • 7:
        • 6:
        • 5:
        • 4:
        • 3:
        • 2: MPPT Mode Active
        • 1:
        • 0:
      • [ErrorFlags]...only got 2 bits set, but maybe I haven't had too many errors yet...
        • 7:
        • 6:
        • 5:
        • 4:
        • 3:
        • 2:
        • 1: Battery Overvoltage
        • 0: Battery Undervoltage
  • [0xAA] [0xCB] [register] [0x00 0x00 0x00 0x00 0x00] [checksum] -> "Read Config Register"
  • [0xAA] [0xCA] [register] [16: data x1000] [0x00 0x00 0x00] [checksum] -> "Write Config Register"
    • all data in these registers seems to be multiplied by 1,000 (decimal) for whatever reason
    • register 0x00 -> special case function, see below
    • register 0x01 -> MPPT Bulk Voltage * 1000 (i.e. 0x48 0x71 -> 0x7148 -> 29,000 -> 29.000v
    • register 0x02 -> MPPT Float Voltage * 1000
    • register 0x03 -> Out Timer * 1000 (why??!  5,000 decimal = 5 hours.  App won't let you do partial hours though.)
    • register 0x04 -> MPPT Amps * 1000
    • register 0x05 -> UVP Off Voltage * 1000
    • register 0x06 -> UVP Recover Voltage * 1000
    • register 0x07 -> COM Address * 1000 (pretty sure, app won't let this change)
    • register 0x08 -> Battery Type * 1000 (0 = SLA, 1 = LiPo, 2 = LiLo, 3 = LiFe, 4 = LiTo--assuming, app won't accept anything other than SLA / LiPo)
    • register 0x09 -> Battery Cells * 1000 (app doesn't seem to allow anything other than 2...at least for my 24v SLA battery test rig.)
    • Regardless of whether function code is Read or Write, MSB responds ~150mS later with the following string:
      • [0xAA] [0xDA] [register] [16: data x1000] [0x00 0x00 0x00] [checksum]
  • There is one rather strange command that I don't fully understand, as it has a blank hole in place of a character.  It is basically a "write config register" command to register 0x00, value 0x02.
    Seems to be connected to the MPPT on/off function.  Here is a 'scope screenshot:SDS00043.png.42ad0b56c5d314ef8d3bc48a8e544d06.png
    The checksum indicates no change for the blank hole, like it's a timed delay??  0xCC + 0x02 = 0xCE

I hope this is of some value to those who want to hack their MSB to actually get some data out of it.  Pads on the PCB look to indicate that this port may have been intended as some sort of external optically isolated RS-232 interface at some point.

Reading current stats is very simple...just send the status read command, and out comes back a status string.

 

EDIT: Thanks to @Busky for identifying the "cumulative KWH" register.  Still don't know what the last "unknown is".

 

EDIT: more info from @Busky: on/off commands (which I provided a 'scope shot of above, but apparently the "hole" in the RS-232 comms is not required!):

[0xAA] [0xCC] [0x02 0x00 0x00] [checksum] -> "MSB On"

      write_byte(0xAA);
      write_byte(0xCC);
      write_byte(0x02);
      write_byte(0x00);
      write_byte(0x00);
      write_byte(0xCE);

MSB responds with:

0xaa, 0xdd,  0x0, 0x0, 0x0, 0xdd

 

[0xAA] [0xCC] [0x01 0x02 0x00] [checksum] -> "MSB Off"

      write_byte(0xAA);
      write_byte(0xCC);
      write_byte(0x01);
      write_byte(0x02);
      write_byte(0x00);
      write_byte(0xCF);

MSB responds with:

0xaa, 0xdd,  0x1, 0x0, 0x0, 0xde

Note that the last byte of the MSB response is always the checksum byte--calculated INCLUDING the 2nd byte! 

(When "off" the ModeFlags are 0x00.)

  • Like 1
Link to comment
Share on other sites

8 hours ago, Sid Genetry Solar said:

 

  • [0xAA] [0x55] [0x00 0x00 0x00] [checksum] -> "Read Status"

Thanks well don't have one where I am at right now but going to have to try it out wonder if the non wifi model has those data pins.  Thanks for posting it.  Good capture for future people coming to the forum too. 

Link to comment
Share on other sites

1 minute ago, AquaticsLive said:

Thanks well don't have one where I am at right now but going to have to try it out wonder if the non wifi model has those data pins.  Thanks for posting it.  Good capture for future people coming to the forum too. 

So there is a minor difference between WiFi modules and non/WiFi modules...maybe.  The one unit I had (and eventually gave away) that didn't have WiFi...doesn't have the header that this one does.  But the same pins are sorta there.

Here's a photo I took of a non-WiFi MSB MPPT, and then super-imposed parts onto that I presume were originally intended for an optoisolated RS-232 port:

image.png.df496dda919d0d0a01bc61741671e5fc.png

Interestingly the power pins provided are different here; it's 3.3v for the non-WiFi unit, but 5v on the WiFi enabled unit.  Maybe the comm protocol is the same?? I haven't a clue.  Also noting there's another RX/TX port on the top left of the board closer to the MCU.

Here's a schematic of how I think the isolated circuit would work....

image.thumb.png.e889e86184249627456b7d354276606c.png

 

 

Obviously, completely up to the end user....

 

Found by accident that I can read config registers past register 0x09 that the app uses.  Not sure if this is a memory leak or some "hidden" settings...

Link to comment
Share on other sites

Didn't think of it until now, so thanks for the inspiration everyone, but I have some V117 hardware with V118 firmware loaded.  It's been a while since I looked inside the V117 but I think there is a serial port header near the terminal block, but with no components populated at all.  I'll try sending some serial commands on the lines going to the microcontroller, you never know, V118 may be listening.

Link to comment
Share on other sites

The serial lines are active low, which makes TX/RX very easy to differentiate. 

One option is to follow the lines all the way back to the MCU; it was fairly easy to work out from the datasheet which pins went to the UART (RS-232) modules.

The other option would be to try to find the 2 lines that go all the way from the MCU, to the pads for the optoisolators.  As these are both active-low, the TX line will be at ~5v, while the RX line will be floating at 0v.

PLEASE NOTE: These are TTL 5v logic level signals.  If you want to connect these to a computer RS-232 port (or a level-shifted USB->RS-232 converter), you will need a RS-232 level shifter (MAX232, SP3232, etc.)

Link to comment
Share on other sites

I am thinking of using one of those DFRobot multi converter boards has multiple inputs and outputs types so I can adapt to my existing RS485 network of devices.  Well just brain storming a bit but will need to come back to this when I have some time to tinker more. 

Link to comment
Share on other sites

9 hours ago, AquaticsLive said:

I am thinking of using one of those DFRobot multi converter boards has multiple inputs and outputs types so I can adapt to my existing RS485 network of devices.  Well just brain storming a bit but will need to come back to this when I have some time to tinker more. 

It could be adapted to an RS-485 "network" if you use an auto-direction RS-485 driver like the MAX13487 (look for modules on eBay by searching for "MAX1348"...they work pretty good).

Link to comment
Share on other sites

Appreciated but I was doing it via an old laptop + usb serial with perl.  Only realised I wasn't sending the 0xAA start byte after I put everything back together and tidied up the bench.  Still haven't gotten around to trying it again, been occupied with other things.

Link to comment
Share on other sites

  • 5 months later...

Wish I would have seen this earlier!  I had to figure out the protocol as well!  But it did manage to hack my MSB to farm the data.  I basically intercept the TX of the wifi and then retransmit to the MSB controller...  Asking for data every so often..

 

Link to comment
Share on other sites

On 4/30/2021 at 12:23 PM, Sid Genetry Solar said:

 

  • [0xAA] [0xBB] [16: BatteryVoltage x.1] [16: BatteryAmps x.1] [16: SolarVolts x.1] [16: SolarWatts x1] [16: Temperature C x.1] [16: ???] [16: ???] [ModeFlags] [ErrorFlags] [0x00] [checksum]

The first [16:???] is cumulative kWh's  I have no idea what the second one is as well...

Link to comment
Share on other sites

On 10/28/2021 at 3:33 PM, Sid Genetry Solar said:

I'll update the post with the info.  Is it whole KWH or partial KWH (seeing as most of the entries are ".1" precision, i.e. 100 = 10.0)?

whole kWh.  I guess they wanted to have the range go all the way up to 65k vs 6500...

Maybe that second 16 bits is the upper range for the kWh? that would be a lot of kWh's!! 🙂  It would be a very long time until I would get there!  I'm only at >700kWh's!

 

Link to comment
Share on other sites

I have a few MSB left over from various things so have had one sitting on 24V AGM bank.  The normal load on the battery doesn't draw much, but there's also a 125l water heater attached.  During winter when it's on it pulls power from the MSB for a good part of the day.  I think I must have > 1.5MWh on the MSB, but firmware updates and resets have cleared the counter.  For all the problems I've noticed with them, once you overcome those problems, they do sit there and plug away day in day out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...