diy solar

diy solar

Raspberry Pi Bluetooth Monitor

scottnichol

New Member
Joined
Nov 4, 2021
Messages
19
I've been trying to get a customized system working to monitor my Renogy Rover 40A charge controller using a Raspberry Pi and Grafana. I've had some success with other open source projects, but ultimately decided to take some of the best parts of other projects and customize them into a system that works well for myself and allows some extensibility. I've also tried to document the installation and setup process in detail that would allow anyone to get the system up and running.

The project is available for anyone to download via GitHub here:

https://github.com/snichol67/solar-bt-monitor

The system uses the following hardware and software pieces:
  • Raspberry Pi 3B+ (although any modern Pi with WiFi and Bluetooth should work)
  • Grafana for visualization of your charge controller stats
  • Prometheus for logging the data from the charge controller
  • gatt - a python library for connecting to Bluetooth devices
  • libscrc - a python library for creating CRC codes needed for the Bluetooth connection
My project details the installation and set up and it can typically be done in an afternoon. It also includes a sample Grafana dashboard so you don't have to create everything yourself.

Once installed, it can monitor the following parameters from your charge controller:
  • Battery
    • Percent Charge
    • Current
    • Voltage
    • Temperature
  • Load
    • Current
    • Voltage
    • Power
  • Solar Panels (PV)
    • Current
    • Voltage
    • Power
  • Controller Temperature
  • Charging Mode
  • Max Charging Power Today
  • Charging Amp Hours Today
  • Max Discharging Power Today
  • Discharging Amp Hours Today
  • Power Generation Today
  • Power Generation Total
The Grafana dashboard looks like this:
solar-bt-monitor.png

If anyone feels like downloading it and trying it out, I'd be happy to have some feedback. Also I would accept merge requests from anyone who wants to add configuration for additional data sources.

Thanks!
Scott
 
Hi Scott,
Congrats on the great project. I am working on something similar but not yet as elaborate as yours - I am busy getting the communication stable. And from this perspective I ran over the problem of the DALY Bluetooth adapter falling asleep after a certain time. So I decided to connect the Raspberry Pi directly to the UART connector of a DALY 4S Smart BMS. This gives the nice additional benefit, that I can use a GPIO to wake the BMS UART when necessary.
I wrote a small description and put it here.
 
I've been trying to get a customized system working to monitor my Renogy Rover 40A charge controller using a Raspberry Pi and Grafana. I've had some success with other open source projects, but ultimately decided to take some of the best parts of other projects and customize them into a system that works well for myself and allows some extensibility. I've also tried to document the installation and setup process in detail that would allow anyone to get the system up and running.

The project is available for anyone to download via GitHub here:

https://github.com/snichol67/solar-bt-monitor

The system uses the following hardware and software pieces:
  • Raspberry Pi 3B+ (although any modern Pi with WiFi and Bluetooth should work)
  • Grafana for visualization of your charge controller stats
  • Prometheus for logging the data from the charge controller
  • gatt - a python library for connecting to Bluetooth devices
  • libscrc - a python library for creating CRC codes needed for the Bluetooth connection
My project details the installation and set up and it can typically be done in an afternoon. It also includes a sample Grafana dashboard so you don't have to create everything yourself.

Once installed, it can monitor the following parameters from your charge controller:
  • Battery
    • Percent Charge
    • Current
    • Voltage
    • Temperature
  • Load
    • Current
    • Voltage
    • Power
  • Solar Panels (PV)
    • Current
    • Voltage
    • Power
  • Controller Temperature
  • Charging Mode
  • Max Charging Power Today
  • Charging Amp Hours Today
  • Max Discharging Power Today
  • Discharging Amp Hours Today
  • Power Generation Today
  • Power Generation Total
The Grafana dashboard looks like this:
View attachment 88674

If anyone feels like downloading it and trying it out, I'd be happy to have some feedback. Also I would accept merge requests from anyone who wants to add configuration for additional data sources.

Thanks!
Scott
This looks really great, I installed the armv6 versions of prometheus and grafana, that is working as far as I can tell.
I am stuck at,,,
/solar-monitor.py
Traceback (most recent call last):
File "/home/pi/solar-bt-monitor/./solar-monitor.py", line 74, in <module>
from prometheus_logger import prometheus_logger
File "/home/pi/solar-bt-monitor/prometheus_logger.py", line 16, in <module>
from prometheus_client import start_http_server, Gauge
ModuleNotFoundError: No module named 'prometheus_client'

Hope someone can help, I am close.
 
Last edited:
This looks really great, I installed the armv6 versions of prometheus and grafana, that is working as far as I can tell.
I am stuck at,,,
/solar-monitor.py
Traceback (most recent call last):
File "/home/pi/solar-bt-monitor/./solar-monitor.py", line 74, in <module>
from prometheus_logger import prometheus_logger
File "/home/pi/solar-bt-monitor/prometheus_logger.py", line 16, in <module>
from prometheus_client import start_http_server, Gauge
ModuleNotFoundError: No module named 'prometheus_client'

Hope someone can help, I am close.
Sounds like you got the prometheus server installed, however, did you install the prometheus client? Check this folder here:

/Volumes/pi/.local/lib/python3.9/site-packages

And look for a prometheus-client folder. If not, you might need to do this command:

Code:
pip install prometheus_client

I may have left that out of my build instructions. Let me know if it works for you!
 
This project looks awesome! I believe I got it installed correctly, however my charge controller uses a different app for monitoring and control called ChargePro 2.0. I did get as far as connecting to the Bluetooth interface but it went downhill from there. Do you have any suggestions for determining attributes/services used by another charge controller. github.com/Olen/VictronConnect looked like a possible starting point but I’m a newbee and could be heading in the wrong direction. Any help would be much appreciated.

Also, I have some updates to your install cheat sheet if you’d like them.

Thanks!
Dave
 
Last edited:
Just found this thread. I'm running a Pi4/SSD with Telegraf/Influx/Grafafana to monitor my system in a fifth wheel trailer.

I collect data from two JBD BMS units w/ESP32's, a Rover 40A via USB, an 8266 w/GPS & accelerometer and an 8266 w/DHT22. I display in a browser, on my phone or on a Pi3 w/touch display mounted in the trailer
 
  • Like
Reactions: TEJ
Just found this thread. I'm running a Pi4/SSD with Telegraf/Influx/Grafafana to monitor my system in a fifth wheel trailer.

I collect data from two JBD BMS units w/ESP32's, a Rover 40A via USB, an 8266 w/GPS & accelerometer and an 8266 w/DHT22. I display in a browser, on my phone or on a Pi3 w/touch display mounted in the trailer
id love to see pics and learn more about your setup.
Thanks,
Tim
 
Back
Top