Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few questions #2

Open
jschultz opened this issue Jun 28, 2019 · 28 comments
Open

A few questions #2

jschultz opened this issue Jun 28, 2019 · 28 comments

Comments

@jschultz
Copy link

Great work, I look forward to making use of it.

Can you help me with a couple of things?

  1. I bought the following RS485 adapter but found it didn't work at all - that is I could see no data on the interface. I tried using Linux and Windows, including the eSmart software, but nothing. This made me pretty much give up until I saw your work. Can you suggest what the problem might be, or should I just start again with a different adapter?

  2. The application I want to make of this is to control the operation of a heat pump hot water system that draws about 1000W. Having access to the battery voltage and charging current should give me some idea of whether the panels are producing excess power. But can you suggest some way to estimate how much power is being dumped? Or any other clever algorithm that would allow me to run the HWS for a maximum of time while keeping the batteries charged?

Many thanks!

@Domingorp
Copy link

Same issue here with the USB adapter. I've tried 2 different ones. They work on Windows using the monitoring app, but not on the Raspberry pi. I had an EPever and adapters worked on those, but this esmart3 is a challenge.

@skagmo
Copy link
Owner

skagmo commented Jun 28, 2019

Hi guys. One important point is that the eSmart3 doesn't send any data by itself. Data gets polled from the host/computer, and the eSmart3 responds. If you try this without the stock software you must send a message like REQUEST_MSG0 in esmart.py.

jschutlz: Regarding your second question, the simplest way would be to use the load output on the eSmart3 to control a relay, and set a high disconnect voltage. A more robust way would be to use a coulomb counter to keep track of battery SoC and only run the heat pump when SoC is above e.g. 90 % with some hysteresis. If your load draws more power than you charge you can't keep your batteries fully charged. You need to duty cycle the load and reserve some of the battery capacity.

@xixou2
Copy link

xixou2 commented Jun 30, 2019

Try with the FTDI adapter:

https://www.youtube.com/watch?v=K7rz3_kU4IE

@Domingorp
Copy link

Domingorp commented Jul 2, 2019 via email

@jimbriam
Copy link

  1. that is I could see no data on the interface. I tried using Linux and Windows, including the eSmart softwar

i believe the problem with that rs485 adapter in the ebay link is that the pinout on the rj45 side is NOT correct for the esmart3. In order for that particular rs485 adapter to work you would need to re-terminate the rj45 connector.

eSmart3 RJ45 pinout:

1: A
2: B
5,6: Ground
7,8: 5V out (for powering isolated RS-485 interface)

Epever RJ45 pinout:
1 - No connected
2 - VCC
3, 4- RS-485 A
5, 6- RS-485 B
7, 8- Ground

References:
https://adamwelch.co.uk/2017/12/build-your-own-rs485-to-wifi-adapter-for-epever-solar-charge-controllers/#more-2794

@jschultz
Copy link
Author

Brilliant, that's exactly the kind of thing I thought might be the problem. I guess I can replace the RJ45 connector.

Can I ask how you got those pinouts from the link? I can see you might work out the Epoever pinout from the page's description of how to repurpose a network cable, but I can't see any reference to the esmart pinouts.

@jimbriam
Copy link

can see you might work out the Epoever pinout from the page's description of how to repurpose a network cable, but I can't see a

The esmart3 Pinout is provided on page 14 of the user manual (end of section 3, before section 4) as well as the readme.md of this project.

@Domingorp
Copy link

Hi guys. One important point is that the eSmart3 doesn't send any data by itself. Data gets polled from the host/computer, and the eSmart3 responds. If you try this without the stock software you must send a message like REQUEST_MSG0 in esmart.py.

jschutlz: Regarding your second question, the simplest way would be to use the load output on the eSmart3 to control a relay, and set a high disconnect voltage. A more robust way would be to use a coulomb counter to keep track of battery SoC and only run the heat pump when SoC is above e.g. 90 % with some hysteresis. If your load draws more power than you charge you can't keep your batteries fully charged. You need to duty cycle the load and reserve some of the battery capacity.

For the life of me, I can't get this to work. I've tried everything I can think of, but still nothing. The EPEver is a lot easier to communicate with, but this is a real challenge (for me.) I can see the data light blinking on the USB adapter, but a blank terminal screen. SKAGMO, can you be a little more specific and provide instructions on how to get the data displayed on the terminal screen? I know many people here will appreciate it.

@skagmo
Copy link
Owner

skagmo commented Jan 6, 2020

@Domingorp To determine if this has to do with the RS-485 wiring, try installing a serial terminal such as Cutecom ("sudo apt install cutecom" in Linux).

  • Open port at 38400 baud
  • Select format "Hex" under Input
  • In the input field, type aa010101000300001e32 and press enter.
  • This command polls data from the eSmart. You should receive binary data if it works (not human readable).

First step now is to figure out if this works. This is as low level it gets without looking at the wiring.

@Domingorp
Copy link

@Domingorp To determine if this has to do with the RS-485 wiring, try installing a serial terminal such as Cutecom ("sudo apt install cutecom" in Linux).

  • Open port at 38400 baud
  • Select format "Hex" under Input
  • In the input field, type aa010101000300001e32 and press enter.
  • This command polls data from the eSmart. You should receive binary data if it works (not human readable).

First step now is to figure out if this works. This is as low level it gets without looking at the wiring.

Ok, it worked at 9600.

@skagmo
Copy link
Owner

skagmo commented Jan 7, 2020

Ok, it was supposed to be 9600, but it was at least a good sanity check to see that it didn't work at 38400 ;)

You mention a "data" LED blinking. If you have the same FTDI dongle as suggested, it should rather have "TX" LED and a "RX" LED. Is only TX blinking, or both TX and RX?

How do you run it?

  • Place "esmart.py" and "esmart_test.py" in the same folder
  • Edit "/dev/ttyUSB0" in "esmart_test.py" to match the port of your FTDI interface
  • "chmod +x esmart_test.py"
  • "./esmart_test.py"

Text should start appearing. If it does not, or you get error messages, we need to troubleshoot further.

@Domingorp
Copy link

Domingorp commented Jan 7, 2020 via email

@jschultz
Copy link
Author

jschultz commented Jan 8, 2020

jschutlz: Regarding your second question, the simplest way would be to use the load output on the eSmart3 to control a relay, and set a high disconnect voltage. A more robust way would be to use a coulomb counter to keep track of battery SoC and only run the heat pump when SoC is above e.g. 90 % with some hysteresis. If your load draws more power than you charge you can't keep your batteries fully charged. You need to duty cycle the load and reserve some of the battery capacity.

My aim is to do something simple and cheap. So what I have now is one Raspberry Pi using code based on your work (https://github.com/jschultz/esmart-tools) communicating by IP with a second (distant) Raspberry PI that in turn communicates with the controller from the hot water system to obtain information the current temperature of the water. I then use a simple finite state machine to turn the hot water on and off based on these data. It being summer right now (in the southern hemisphere) I have plenty of sunlight and the temperature doesn't drop too much at night. The test will come with winter.

But, to go back to my first question, I had thought that the way the esmart would dump excess power would be by moving the PV voltage away from the maximum power point. If that were the case then the PV voltage data from the esmart could be used to make a rough calculation of how much power was being dumped and thus whether there was sufficient reserve to start the hot water system. But that doesn't appear to be the case - even when the controller is in CF (float) mode and full sun on the panels, the PV voltage is no different from when the controller is charging as hard is it can. So instead I just made the logic start the HWS when the batteries are at full voltage and the charging current is lower than some threshold.

@skagmo
Copy link
Owner

skagmo commented Jan 8, 2020

@Domingorp Alright, that's strange. At least the requests gets sent, and you seem to get data back. Start by placing a few print-lines around the code.

I don't know how familiar you are with Python, but make sure that you match the indention level where you insert the code. E.g., on line 87, insert 7 tab characters before you write "print...". You can not use spaces instead of tabs to get the same apparent indention level.

  • esmart_test.py line 25: "print('Started')"
  • esmart.py, new line after line 52: "print('SOF')", and uncomment "else:" and "print c"
  • esmart.py line 87: "print('Received packet')"

Paste what you get in the terminal.

@Domingorp
Copy link

Domingorp commented Jan 8, 2020 via email

@skagmo
Copy link
Owner

skagmo commented Jan 9, 2020

Ok, can you share the screenshot?

@Domingorp
Copy link

Domingorp commented Jan 9, 2020 via email

@skagmo
Copy link
Owner

skagmo commented Jan 9, 2020

Ah, I just meant that you could share the screenshot (image), not a remote VNC session. Or you could just copy-paste the text content of the terminal window.

@Domingorp
Copy link

Domingorp commented Jan 9, 2020 via email

@skagmo
Copy link
Owner

skagmo commented Jan 9, 2020

Sure, that's probably faster. You can send the details to web(at)skagmo(dot)com.

@skagmo
Copy link
Owner

skagmo commented Jan 9, 2020

Logged in to your RPi now. Cloned the repository and ran it, and it works :) I can see you had an esmart3.py file on you desk with content similar to an older version of esmart_test.py, but not the actual library esmart.py. Maybe that was the issue? For the future, run "git clone https://github.com/skagmo/esmart_mppt.git" to get the whole folder structure to your computer. Or click "Clone or download" and then "Download ZIP".

@Domingorp
Copy link

Domingorp commented Jan 10, 2020 via email

@skagmo skagmo mentioned this issue Jan 10, 2020
@mr-biz
Copy link

mr-biz commented Jul 11, 2020

Hi,
I am really grateful for all of your work Skagmo.
This is my first attempt at python and using your script with a pi and Homeassistant is a big improvement on the MyGreen app.
My question is in the esmart.py script there is a line: DEVICE_MODE = ["IDLE", "CC", "", "FLOAT", "STARTING"]
That when I was using with Mosquitto for MQTT messaging that was causing errors due to the "" value between CC and FLOAT.
I checked esmart3 and it said that it was CV. I changed the line to DEVICE_MODE = ["IDLE", "CC", "CV", "FLOAT", "STARTING"]
Is my correction correct or is something else going on?

@jschultz
Copy link
Author

@TeacherBiz I believe you are correct. At least that is the same change I made in my own project (based on @skagmo 's at https://github.com/jschultz/esmart-tools

@skagmo
Copy link
Owner

skagmo commented Jul 13, 2020

Hi @TeacherBiz . Thank you for the heads up. I assume that position/state was blank because my charger settings/voltage thresholds were set in a way so the charger would never enter CV state, but go directly from CC to float. But it definitely makes sense that there is a CV state in-between there!

@jschultz
Copy link
Author

To continue the discussion regarding USB-RS485 adapters, I have had some strange things happen:

For some time I have been using a cheap USB-RS485 adapter sold as being suitable for eSmart that I bought on ebay (I'd post a link but it doesn't seem to be available any more). This unit has worked fine with 40A and 60A esmart chargers charging 12V and 24V batteries, using a Raspberry Pi. However, when I upgraded my system to 48V, the adapter started outputting spurious incorrect characters. But where it gets even stranger is that if I use a laptop computer instead of the Raspberry Pi it once again works fine.

So I thought the problem must be the cheap adapter and by using a different one I'd get it all working again. I tried to re-wire a different adapter I bought by mistake that seemed to be for an Epever unit (as discussed above in this thread) but never managed to receive a single byte from the eSmart.

So I went and bought a simple adapter like the one recommended by @skagmo in the README file for this project. And once again I get the strange behaviour that it works fine when connected to my laptop but returns spurious characters through the Raspberry Pi.

So I'm no electronics expert but it seems to me that there must be some voltage level exceeding tolerances that makes the RS485 adapters misbehave in the particular circumstance of an eSmart running a 48V system and a Raspberry Pi. Maybe the earth potential between the two devices has drifted too far apart? I'm out of my depth here but I'd really like to get my system working again.

Any ideas?

@phortx
Copy link

phortx commented Apr 19, 2022

Hello everybody,

I'm currently trying to read my iPanda MPPT Explorer via RS485.

As far as I understand this devices works the same as the eSmart3 and thus I'm trying to use that script. However it doesn't work. I understand how the communication works and changed some bytes but didn't change anything.

I simply never get a response at all, while sending data seems to work.

I'm using the exact same USB adapter as @jschultz mentioned initially, but I removed the RJ45 plug and replaced it with a RJ45 keystone so I can patch the wires correctly. This runs via the USB 2 Port of a Raspberry Pi.

It is absolute possible, that I've wired the adapter wrong. I'm not sure how to debug that. I've connect a RJ45 keystone to the other side of the patch cable and beeped the pins with my multimeter. Seems correct. However it really confused me that the yellow wire was GND, while the black wire was B and the red wire was A. Maybe I'll try to swap them.

Do you guys have any idea, or any relevant information that could help me get this running? I'd be very thankful and glad to donate a coffee to the one who helps me to get any information out of this thing :D

@mr-biz
Copy link

mr-biz commented Apr 19, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants