Coder Social home page Coder Social logo

cole8888 / srne-solar-charge-controller-monitor Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 1.0 30.52 MB

Read data from SRNE solar charge controllers.

Python 12.08% C++ 39.34% CSS 0.97% JavaScript 21.34% HTML 26.27%
arduino raspberry-pi solar solar-energy solarpanels solarpower charge-controller diy modbus srne

srne-solar-charge-controller-monitor's Introduction

SRNE-Solar-Charge-Controller-Monitor

Read data from SRNE solar charge controllers via modbus over RS232.

This repository contains several example programs for reading data from SRNE solar charge controllers using Raspberry Pi, ESP32, ESP8266 and Arduino Nano / Uno.

Based on the modbus manuals, this should also work with some Renogy controllers, but I don't have one to test with. Also, verify the wiring is compatible with your controller.


Example Setups:

Here are some example programs to get started. If you follow the setup instructions in the readme files of each directory, you should be able to talk to your controller. If you are just getting started, don't use the MQTT ones.


Web-Interface and MQTT

I've included an example web interface you can use in combination with the MQTT-enabled example programs. To use it, you will need to setup an MQTT broker such as Mosquitto or use a cloud broker. You will also need to set all the appropriate settings in the chosen program and the index.js file.

Web-Interface-Screenshot

I also included my custom web interface which I am using for my setup. It has the ability to read data from and control smart plugs flashed with Tasmota.


My Current Setup:

The setup I use is a customized version of the ESP32 Example, I also designed a custom PCB. Have a look at My-Current-Setup if you want some inspiration for your own setup!

ESP32 PCB Image


Troubleshooting:

If you notice lots of timeouts, or other errors, try some these steps before creating an issue:

  • Try a different power supply and USB cable. My ML2440 does not respond when I use one of my USB power bricks, but it does with another.
  • Try increasing the modbus timeout value.
  • Try using a shorter cables and moving them away from interference.
  • Verify you are using straight cables and not ones that reverse from one end to the other.
  • Try using HardwareSerial instead of SoftwareSerial. I've found HardwareSerial is more reliable, configure the program to use it if you are having problems.

If these don't help or if you need clarification, feel free to create an issue and I'll see what I can do!


Other notes:

srne-solar-charge-controller-monitor's People

Contributors

cole8888 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tokyokamera

srne-solar-charge-controller-monitor's Issues

[QUESTION]

Hi! Thank you so much for your python code :) I'm using it to read my ML4860 Solar Controller.
I removed the mqtt and the CC1 lines.

Just some questions,
How do you know how many registers to read?
And which registers refers to a value (eg r.registers[7] is Panel Voltage)?
Also, whose temperature do you refer in CPUTemperature().temperature? the raspberry pi?

1 Arduino only

As a newbie, I would like to ask how to use only 1 arduino to read the battery voltage and the charging state status of the SRNE? How will I connect it to arduino? Thank you very much for your help.

pyModbus

I was trying to use the python script for the raspberry PI to monitor my charger controller again, been without it for a long time now.

As I was setting up the script on my PI, only editing for my port/device, I ran in to error.

Traceback (most recent call last): File "/home/USER/SRNE.py", line 17, in <module> from pymodbus.client.sync import ModbusSerialClient as ModbusClient ModuleNotFoundError: No module named 'pymodbus.client.sync'

FIX: Change "pymodbus.client.sync" to "pymodbus.client"

Publishing data

I'm using the Python version, I was getting a bunch of errors and code crashing from the mqtt. I read your description of the project and saw that it send the data off to another device. I don't have it setup with a second device., so maybe an error due to me not having it setup that way.

Traceback (most recent call last): File "/home/USER/SolarComms/SRNE.py", line 82, in <module> client = connect_mqtt() File "/home/USER/SolarComms/SRNE.py", line 73, in connect_mqtt client.connect(broker, port) File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) File "/usr/lib/python3.9/socket.py", line 843, in create_connection raise err File "/usr/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

Also, thank you! I was about to pull my hair out trying to get it to work.

Software srne ml2420

Hello, I tried to update the ml2420 through an app and the installation failed. Is there any way to enter the original software?

Problems with the modbus

I use the Raspberry Pi 3B+, after configuring and executing the script the following error message appears:
Failed to read data, reconnecting... 'ModbusIOException' object has no attribute 'registers'
Sent to topic ML4860

I use the original USB converter PL2303 (but also a FTDI232 and a CH340). At least the PL2303 works on the computer with the manufacturer's software SolarStationMonitor. Do you have an idea what it could be?

Can't read data, help please.

Hello I'm trying to use the python script for the raspberry pi again, used it last year it worked great. When I go to read any data from my ML2420 I get errors. I connect over a USB serial cable and I have the bluetooth adapter and it works fine.......

My code, the same other then a debug line I added.
def run(): if False: #I added this if as a DEBUG response = modbus.read_holding_registers(26, 1, unit=0) print(response) while True: try: # Read 35 registers from the controller starting at address 0x0100 (Decimal 256) until 0x0122 (Decimal 290) response = modbus.read_holding_registers(256, 35, unit=0) if(JSON_OR_TEXT == "TEXT"): printDataText(response) else: print(convertToJson(response, False)) time.sleep(DELAY_BETWEEN_REQUESTS) except Exception as e: if(JSON_OR_TEXT == "TEXT"): print("Failed to read data, reconnecting...", e) else: print(convertToJson(None, True)) reconnectModbus() time.sleep(DELAY_BETWEEN_REQUESTS)

I get the error "Failed to read data, reconnecting... 'ModbusIOException' object has no attribute 'registers' "
And when I do my debug I get "Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)"

I really could use the help right now.

<0°C temperatures dont work.

image

Something is wonky with the temperature readouts when the temperature gets to <0.

Was not able to test this at the time I wrote this program because it was summer time.

I have only checked the Arduino version, I'm not sure if the python version also has this problem, but I assume it does.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.