Raspberry Pi Bluetooth Monitor

scottnichol

New Member
Joined
Nov 4, 2021
Messages
17
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
 

KaFun

Solar Enthusiast
Joined
Feb 8, 2021
Messages
46
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.
 

Freemilk

New Member
Joined
Jun 20, 2022
Messages
1
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:

scottnichol

New Member
Joined
Nov 4, 2021
Messages
17
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!
 
Top