Coder Social home page Coder Social logo

Comments (12)

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024 1

Thank you, and wow that was fast.

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

Hi, sorry for the delayed response. I've been able to reproduce the problem on my PI also and I'll try to have a fix for it soon.

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

The correct setup is Raspberry pi GPIO14 goes to MAX3232 TX and GPIO15 goes to RX

While trying to reproduce it I had the wires backwards and got the behavior you mentioned. After flipping them to be correct I was able to read data. Also what python/pymodbus version are you using?

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

I just double checked the wiring photos in that directory and they are correct.

This one is probably the easiest to compare against:
https://github.com/cole8888/SRNE-Solar-Charge-Controller-Monitor/blob/main/RaspberryPi-Examples/RaspberryPi-Top-View.jpg

from srne-solar-charge-controller-monitor.

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024

I'm using a USB connecter, and I did check and redo my wires. Pin 1 to my RX and pin 2 to my TX and pins 3 & 4 to ground. Pins 5 & 6 are power and not connected.

I just tried flipping the tx and rx to make sure and still the same.

FYI: Pins 5 & 6 give off battery voltage.

from srne-solar-charge-controller-monitor.

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024

So I got a bit of an update. I have for my pc the Solar Station Monitor software. With it I can connect if I set the device ID to 255. Still not working with the python script. Any ideas?

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

Address 255 is a special address that all charge controllers respond to no matter what their current address is.

Your controller must have a different address than mine. Ran into a similar thing with the Arduino versions and I fixed it there by forcing address 255, but I didn't realize the python version would also have this problem.

Try replacing the line with read_holding_registers with this:
response = modbus.read_holding_registers(256, 35, unit=1, slave=255)

from srne-solar-charge-controller-monitor.

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024

So adding the "slave" parameters fixed it. I would like to note that the code works without the "unit" parameters and that the "slave" needs to be your device ID.

response = modbus.read_holding_registers(256, 35, slave=1)

Thank you for your help, hope this helps others.

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

@Shadow-Genesis Just wondering, did this work when you set slave to 255 instead of 1? If it worked with 255 I'll update the program since it should work for all controllers.

from srne-solar-charge-controller-monitor.

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024

Both. My device is ID 1. And from what I read in the PDF that talks about how data is sent and received, 255 is a device ID that all respond to. Mostly for use with bluetooth adapters and remote displays. So in short from what I read, the device ID 255 is a plug and play ID

from srne-solar-charge-controller-monitor.

cole8888 avatar cole8888 commented on September 24, 2024

Ok, I'll update the script to use 255, should prevent issues in the future. Thanks!

from srne-solar-charge-controller-monitor.

Shadow-Genesis avatar Shadow-Genesis commented on September 24, 2024

I had been making since last night a python class that would handle the SRNE data, makes it cleaner for me. I just got a bit of code I think you may want to add.

deviceID=None response = self.modbus.read_holding_registers(26, 1, slave=255) deviceID = response.registers[0] response = self.modbus.read_holding_registers(256, 35, slave=deviceID)

its just a little auto device ID. I do not think it would work with more then one slave connected, but for one it should be fine

from srne-solar-charge-controller-monitor.

Related Issues (11)

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.