diy solar

diy solar

Monitoring MPP/Clone systems with freeware Pi/Grafana

BarkingSpider

Carbon Lifeform
Joined
Apr 14, 2020
Messages
440
Location
Silicon Valley, CA
I’ve been using Pi Zero micro computers to monitor all kinds of equipment over the years as they are low cost and incredibly flexible. Here is what I have just added to monitor my MPP 3048 pair 240v split phase system with BYD LifePO4 cells. Let me know if you are interested. Its all freeware and the parts are available on Amazon. See my link in my signature for other solar equipment I have solutions for.

Its reasonably technical and you will need to get your hands dirty, but the realtime graphs and alerts are so worth it. You can check your system on any internet device such as a phone/tablet or PC. I will post the code to github shortly.

1B597961-CC13-422A-AEBD-EE00DCD2DC0D.png
 
Last edited:
What is the physical interface and protocol on the MPP unit?
Did you have access to the data specification, or did you have to hack it old school style?
 
You connect to the USB interface on the MPP with a $3 PL2303–USB cable.

John Blance from New Zealand has already written a great python library to extract the raw info from the MPP. Its called mpp-solar

You load that info onto a Raspberry Pi running Linux via the USB cable and import it into a Prometheus database.
That is read by Grafana and you look at it with a web browser.

If you can get the MPP PC WatchPower software to work before hand, thats a great start. It uses the same protocol.

Ill post a cheat sheet with all the code you need shortly. The cell level information is taken from a Chargery BMS16T, that is not from the MPP.
The code to get info from the Chargery is already at my GitHub site.
 
You connect to the USB interface on the MPP with a $3 PL2303–USB cable.

John Blance from New Zealand has already written a great python library to extract the raw info from the MPP. Its called mpp-solar

You load that info onto a Raspberry Pi running Linux via the USB cable and import it into a Prometheus database.
That is read by Grafana and you look at it with a web browser.

If you can get the MPP PC WatchPower software to work before hand, thats a great start. It uses the same protocol.

Ill post a cheat sheet with all the code you need shortly. The cell level information is taken from a Chargery BMS16T, that is not from the MPP.
The code to get info from the Chargery is already at my GitHub site.
Cool -

I am already fully engaged with Grafana, Prometheus, InfluxDB, Python, etc......
Sounds fun.
 
There isnt a WatchPower binary for ARM6 or ARM7 hardware on the Pi. So no.
You could be adventurous and use docker if your up to it.
You can always use Grafana on the pi to get the great statistics from the MPP (and clones) units, see my github page.
 
Hello BarkingSpider,

I recently got an MPP clone that features both an USB cable connection and a an RS232 (IIRC).
I have a RPi3b that I use to read voltage and a shunt to have some rudimentary state of charge for my small bank.
mi_inverter.jpg

Before I go install graphana, prometheus and libraries... What's the bare minimum I can install to see if my inverter is actually "readable"/compatible ?

I'm guessing I should check the mpp-solar python library, but I'm not entirely sure if this will work through USB. At the moment I don't have an RS232 converter so I simply plugged the standard USB cable.

------------------
Edit:
Oops, I was too anxious and didn't read ahead. Apparently some mpp units *do* work with USB to USB. So I guess I should simply .... try. "Simply" is a figure of speech :LOL:
screenshot.6717.jpg

Thanks!
 
Before you do anything else, you need an RS232 adaptor like this one. https://www.amazon.com/gp/product/B00F31TVC4/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

Then you need to get WatchPower working to test the connection as a sanity check, any PC running Windows will do. If you cant get that working your odds are very low to do anything else. Do not skip this step! This tests your cable is working and that your MPP unit is supported. lt also allows you to use WireShark to sniff the serial connection to find out whats happening.

Then do a fresh minimal OS install on a Pi (a dedicated zero works great with Grafana, I use a small USB hub with it, see pic) You connect the MPP grey cable as in the pic below. The other USB cable in the pic is monitoring a Chargery BMS, ignore that.

Then, on the fresh, dedicated Pi, install mpp—solar exactly as he describes on his github page. From the errors above, I can see it was not installed correctly. You can then run the mpp test commands to check output.

Contact the owner directly on github, he is very helpful.

Its not a simple plug and play task, you need to understand what you are doing. But once its working its been very reliable.

58473493-387B-48C4-8EF9-B7D7431213EB.jpeg
 
Last edited:
You will want to remove all traces of Python 2.x from your system to ensure its only using Python v3. This is the biggest cause of problems. Use google to find out what commands to run to do that.

Its key you install mppsolar correctly, first make a fresh install directory, and as root:

# python3 -m venv .
# source bin/activate
# pip install -e "git+https://github.com/jblance/mpp-solar.git#egg=mpp-solar"

# bin/mpp-solar -h
# bin/mpp-solar -p /dev/ttyUSB0 -c QPIGS

If you get any errors, stop and fix those before you continue.
My USB port whas USB0, yours may be different, use command ‘dmesg | grep USB’ to find out.

# How to address each unit in a split phase setup
mpp-solar -p /dev/ttyUSB0 -c QPGS0
mpp-solar -p /dev/ttyUSB0 -c QPGS1

Good luck, stick at it, its worth the time and effort.
You did get WatchPower on Windows working first to test the connection didnt you?
 
Last edited:
Okay... No. I haven't tried the watchpower software beforehand.
I've been looking for an old USB to serial adapter I had lying around somewhere. I finally found it but I wasn't able to get the driver for it. I don't remember what chip does it have.

I've been able to locate a reseller near home that has a different adapter that features the prolific pl2303 chip. It's a bit pricy (my country's economy has the ability to induce depression and sadness).
I will try to borrow one for the test. (this is the hard part)

My inverter came with a watchpower CD, so I have a feeling that the inverter clone uses the same software as the MPP ones.
Also, I have "scavenged" an RPI Zero from an abandoned gardening project. I'm hoping to be able to get this going. Thanks for your help!
 
Good luck with the serial adaptor, it needs to be true RS232 compatible to work. Get the PiZero working and look at the syslog when you insert it to see what type Linux thinks it is. Use the ‘dmesg’ command to do that. A pi Zero works great for this project, its what I am using.
 
@iceledoar BarkingSpider notes mention the binaries aimed at Pi4 so I think it will work fine


@BarkingSpider
I'm kind of stuck. I've been following your cheatsheet to some degree. I wanted to mention a few things.
- Lines 83 and 84 seems that you copy some files with securecopy from a device in your home network. Not sure what it is or if it is needed.
- Line 123, you issue a change directory with a [6,7] expression that my shell does not like.
- Line 125, adding prometheus and node exporter to systemctl was not as trivial as I thought. I was able to do so with a friend's help , though.
- Line 145: I opened the url from another computer and shows something. Seems to work!
- Line 154: same! Seems good.
- Line 157: Same! I was able to login. I was also able to create the data source and test it successfully.
- Line 160: You lost me here! I no longer follow what am I supposed to import or how.
- Line 161: I......m not sure what a JSON file is ? I feel like I'm missing something. I'll check the rest of your guide to see if I should have done something else before this step.


Thanks for the help! I know my linux is so-so



EDIT: Ok. I continued reading and got that sorted out!. I can see the rpi resources successfully, even after reboot!

I'm having trouble with mpp-solar. I have a different output now so I think it's an improvement.
screenshot.4502.jpg
screenshot.4503.jpg
screenshot.4504.jpg
screenshot.4505.jpg


One last edit for today. I Forgot to reboot after adding solar to the groups for dialin. Now I'm getting something different:
screenshot.4506.jpg

I'm a bit lost now. Is the mpp-solar not able to speak to my inverter or is the tty not working? Maybe both? something else?
Thanks for your imput. I won't hammer any more replies nor edits! Don't worry
 
Last edited:
The last error is because you need to run mpSolar as root. Run ‘sudo bash” then you are permanently root.

I will post you a JSON file to import into Grafana on my github site ASAP. This will give the Renogy report ready made.

Copy the JSON text, then ...
Look at the plus sign on the left of the Grafana home page and select import.
Then paste the JSON text into the 'panel json' text box and hit Load

The report will then appear in the dashboard section.

To export any page you make look for 'Share' icon at the top of any Grafana report and export JSON.

I will respond in a moment as soon as the JSON is uploaded.
Dont worry about asking questions, this process will document the process and help others do the same.
 
Last edited:
Being root fixed one problem, the next issue you maybe is mpp_solar is not installed correctly, it cannot see it's own library files that it needs.

Your really close!
 
Here is my json MPP (mpp_solar) report for Grafana. Copy the text from the file link below and paste it as described below.


Copy the JSON text, then ...
Look at the plus sign on the left of the Grafana home page and select import.
Then paste the JSON text into the 'panel json' text box and hit Load

The report will then appear in the dashboard section.
 
Back
Top