Semi-DIY BMS: Active Balancer + Microcontroller

schroederjd

Solar Addict
Joined
Nov 12, 2020
Messages
175
Looking at the manual:

Communication Connection Please use supplied communication cable to connect to inverter and PC. Insert bundled CD into a computer and follow on-screen instruction to install the monitoring software. For the detailed software operation, please check user manual of software inside of CD.

The simplest is to get communications operational between a PC and inverter. You can then connect a "sniffer" to the data line to record communications. I've done this to obtain proprietary automotive communication.
My understanding is that the PC-to-Inverter comms follow a completely different protocol than the BMS-to-Inverter Comms (PylonTech's RS232 protocol). I have a copy of the Growatt Modbus RTU protocol, and it doesn't follow the data format of the Pylontech comms, nor does it include any registers related to battery management (eg, charge/discharge enable/disable). Unless I'm missing something, I don't think i would gain much by listening to the PC-to-Inverter comms.
 

schroederjd

Solar Addict
Joined
Nov 12, 2020
Messages
175
Quick Update: So, after some reading and reflection, I decided that using SoftwareSerial on the Nano was not the best idea. I moved everything over to an ESP32 so i could use one of the hardware serial pins. This change, along with adding some delays to allow time for the data to come in/go out at 9600 baud, seems to have resolved the issues I was having. I'm now able to transmit the "get analog values" response to the inverter with the "Alarm" and "Switch" flags 'raised'. Following those transmissions, the inverter is sending alternating requests for the alarm data and the charge/discharge management data. Now I just need to cobble together those transmissions and I should be able to:
  1. Enable/disable charging
  2. Enable/disable discharging
  3. Set the Max charge current
  4. Set Max discharge current
  5. Set max charge voltage
  6. Set min discharge voltage
  7. Shut the inverter down (in an 'emergency' state)
I'm pretty sure those are all the functions I'll need to leverage. Any thing else I would want the BMS to tell the inverter to do?
 

schroederjd

Solar Addict
Joined
Nov 12, 2020
Messages
175
Parts finally came in for the active low pass filter that I'm adding to the current sensor. As a reminder, I'm currently using a TinyBMS with an external current sensor (LEM DHAB S/133). I've been fighting variability in my current readings since I hooked up the inverters. I put together a simple (first-order) active RC filter using a MCP6292 Op Amp, 4.7 kohm resistors, and 10 uF ceramic caps. The theoretical frequency cut off is 3.4 hz. Plot below shows a ~29 A discharge without and with the filter in place. I've still got some ripple in the data (probably could/should have gone with a lower cut off, or add a second stage to the filter), but I'm ok with it. I'll certainly be a lot more confident in my SOC values knowing that I don't have a +/- 20% ripple in the current readings.

Filter Effect.png

I ended up soldering it up to a narrow PCB along with some headers. I think it turned out ok (for my first time soldering a PCB together...). At some point in the future, I'll probably go back and do this a bit more thoughtfully (ie, using the Op Amp that BiduleOhm suggested, and adding a second stage to the filtering), but for now, I'm happy.

IMG_7700.JPG IMG_7701.JPG IMG_7702.JPG
 

BiduleOhm

Electronics Sorcerer
Joined
Jan 30, 2020
Messages
1,871
Location
France
Do some over-sampling + averaging and you should avoid the last tiny bit of the ripple ;)
 

schroederjd

Solar Addict
Joined
Nov 12, 2020
Messages
175
So, after finishing up the low-pass filter for the current sensor, I turned my attention back to the BMS-to-MCU-to-Inverter Comms. I was making some great progress on getting the 'dialog' between the MCU and the Inverter ironed out. I coded in the CheckSum calculation, so that is happening automatically now. That made fiddling with the actual information being sent a lot easier. After playing around with the variables in the 'Charge/Discharge Management' response, I was realizing that the inverter was not behaving as I was expecting. Most notably, when I sent the 'disable' command for charging or discharging, the inverter didn't seem to do anything different. And that's where I hit my latest roadblock...

A few of the forum threads related to PylonTech batteries communicating with Growatt/MPP inverters suggested that an inverter Firmware update is often required to get things to communicate correctly. So, using the info and software provided on the Watts247 website, I attempted to update the firmware on my 'test' inverter. That's where things turned south... The firmware update didn't complete, and the inverter stopped turning on. I tried everything I could think of (different PC, different cable, different firmware version) to no avail. Finally had to ask Ian at Watt247 to send me a fresh CPU board, which should be on the way shortly (thanks Ian!).

So, I'll try to pick this back up once I have the new board installed.
 

Luthj

Photon Sorcerer
Joined
Jul 1, 2020
Messages
954
If you can identify which flash chip or microprocessor is used on the CPU board, there are often in place flash harnesses cheap. They simply allow you to directly flash the chip from the USB port.
 

schroederjd

Solar Addict
Joined
Nov 12, 2020
Messages
175
If you can identify which flash chip or microprocessor is used on the CPU board, there are often in place flash harnesses cheap. They simply allow you to directly flash the chip from the USB port.
I already sent mine back and have a new board on the way. Hopefully the new board works!
 
Top