A Python-based monitoring system for solar power systems, collecting data from AC currents, battery status, charger, and inverter states, and storing it in InfluxDB.
- Real-time monitoring of AC currents (line in, charger, inverter)
- Battery status monitoring (voltage, current, SOC, charge, capacity)
- Controller state monitoring (inverter and charger)
- Data storage in InfluxDB with configurable polling interval
- Python 3.7+
- InfluxDB 2.x
- Raspberry Pi (for GPIO control)
- Adafruit ADS1115 ADC (for current sensing)
- JBD BMS (for battery monitoring)
- Clone the repository:
git clone <repository-url>
cd solar-monitoring
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Copy the configuration template and edit it:
cp config.ini.template config.ini
# Edit config.ini with your InfluxDB credentials
The system uses a configuration file (config.ini
) with the following sections:
url
: URL of your InfluxDB instanceorg
: Your InfluxDB organization nametoken
: Your InfluxDB authentication tokenbucket
: Name of the bucket to store data
interval
: Polling interval in seconds (default: 60)
To start the monitoring system:
python data_collector.py
The system will run continuously, collecting data every configured interval and sending it to InfluxDB. Use Ctrl+C to stop the system.
The system collects and stores the following measurements:
AC_Currents
: AC current readings- Fields: line_in, charger, inverter
Battery
: Battery status- Fields: voltage, current, soc, charge, capacity
Controllers
: Controller states- Fields: inverter (0/1), charger (0/1)
- AC Current Sensors: Connected to ADS1115 ADC
- Battery Management System: Connected via UART
- Inverter Control: Connected to GPIO 21
- Charger Control: Connected to GPIO 12
This project is licensed under the MIT License - see the LICENSE file for details.