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

Problem with software serial? #1

Open
jdrescher2006 opened this issue Nov 23, 2022 · 5 comments
Open

Problem with software serial? #1

jdrescher2006 opened this issue Nov 23, 2022 · 5 comments

Comments

@jdrescher2006
Copy link

First I want to say thank you for this solution and all your work.

My problem is that it just doesn't work, I am quite sure that I did everything right. The actual guess is that the esp8266 has a quite bad software serial and is not capable to receive the correct data from victron device (MPPT 75/15).

For debug purposes, I modified the code in function RecvWithEndMarker like so:
rc = victronSerial.read();
Serial.println("Daten empfangen!");
Serial.println(rc);

The output of this looks strange:
image

I am sure that I have the same hardware as you have. Here is my setup:
image

Do you have any idea what could be the problem?

@jdrescher2006
Copy link
Author

After a bit of investigating, I found two problems (maybe there are even more):

  • the software serial input (RX) buffer is set to 64 byte. This is by far not enough. I am testing with 256 byte at the moment. You have to set this value in the softwareserial library for the esp8266
  • hardware problem: the HC connection of the level shifter board must be connetced to the 5V output of the victron ve.direct connector

@jdrescher2006
Copy link
Author

So my current situation is the following:

  • I switched to a ESP-01 to get rid of the software serial. Now I am using the hardware serial.
  • I have a Victron Phoenix 500/24 which is working properly with the ESP-01.
  • My Victron MPPT 75/15 is still not working.

I am sure that the data flowes porperly from the 75/15 to the ESP-01. But for some reason the parsing is not successful. The data packet is much larger than from the Phoenix device, that may also cause problems.

@rin67630
Copy link

rin67630 commented Nov 22, 2023

Just a remark I had as I begun looking at your code.
Your need SoftwareSerial because you need a second UART to communicate with the device, right?
It is much more elegant to use the library Telnetstream for the user communication with the ESP over WiFi (you "print" to Telnet instead) which liberates the serial hardware UART to read efficiently from the Victron MPPT port.
After initialisation, the hardware UART is switched to D7 / D8 with the command Serial.swap()
That solves your timing/performance problem and you don't even need a cable to your ESP to read the data.

@rin67630
Copy link

rin67630 commented Nov 27, 2023

I have tested a version using Serial.swap() instead of SoftwareSerial.
The serial communication to the user happens over Telnet.
Works perfectly and is ways faster.
See my pull request.
Else you can see my fork here:
https://github.com/rin67630/esp8266-victron-mppt-solarchargecontroller-Telnet/tree/main
Regards

@rin67630
Copy link

rin67630 commented Dec 3, 2023

P.S. If you have reasons not to use Telnet and want absolutely to use serial communication, may I suggest to use Serial.swap() to let the hardware UART process the flow of data coming from the VE port and use SoftwareSerial to communicate with the user. The later is not demanding on Rx like the VE port is.

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

2 participants