Issues reading VE.Direct serial output from MPPT 75/15 with ESP2866 (WeMos D1 R1 board)

Hi,

We want to use WiFi-enabled ESP2866 (WeMos D1 R1 board) to control some relays, and in addition, to provide us (re-send) output of VE.Direct via same WiFi connection we control relays. Everything is powered with Victron MPPT 75/15, using lead-acid battery and solar panel, i.e. sort of “off grid” power / device box.

Strangely, I can read VE.Direct output with ESP2866 correctly only if:

  • Using EspSoftwareSerial::UART (SoftwareSerial), but only with invert parameter set to true. Sadly, software serial does not seem stable enough, that is I lose some bytes (probably due to WiFi cpu usage, etc?).
  • Using HW SerialPort (D0 as RX), BUT with huge hack by using TWO UART->TTL MAX3232-based converters [see picture below], because otherwise I get garbage bytes into SerialPort.

Strangely, if I use same (single) UART-TTL converter to connect with PC (using random USB<->RS232 cable in addition), and connect VE.Direct with that UART-TTL headers, I can red VE.Direct output just fine.

Do I miss something? Maybe VE.Direct is inverted for a reason and I MUST use special cable? But why then it works with MAX3232 converted connected to PC…? I’m completely lost…

Here’s the hack I can use to avoid garbage bytes when using HW SerialPort of ESP2866:

P.S. I use same 19200 8N1 settings in ESP2866 and PC.

Use an oscilloscope to see what’s happening there.
As the VE.Direct is a permanent broadcasting port, you’ll see if needs to be inverted or not.

PS: Move it to DIY section, Q&A is for Victron’s equipment related questions. :slight_smile:

Sorry, I was pretty sure I selected DIY, probably miss-clicked or something.

Hey @Vincas

check GitHub - hoylabs/OpenDTU-OnBattery: Software for ESP32 to talk to Hoymiles/TSUN/Solenso Inverters, VE.Direct devices, battery management systems, and related peripherals to compare your solution with a knowing working one.

We have received official VE.Direct cable.

Have not found a way how to get anything (at least gibberish) from it with ESP.

It works if connected to PC using generic USB RS232 adapter, but not via RX pin of ESP8266, even using these TTL converter boards.

This is how it works with generic USB serial adapter (VE.Direct on the right):

I only need to connect GND, DTR and TX.

VE.Direct cable uses ADuM1201ARZ isolator chip, and it’s Vdd2 gets power when I connect VE/USB DTR pins, as if DTR is used as power source.

I’ve tried to connect VE.Direct’s DTR with WeMos board’s +3.3V or +5.0V but it does not work, i.e. RX of WeMos ESS2866 does not read anything, not even gibberish.

Maybe DTR needs to send something to be activated or smth…?

I have the feeling you are needlessly complicating things…

On your WeMos D1 R1 board, how is the serial port signaling? I have the feeling that it’s on a TTL level, right?

Victron VE.Direct port is communicating on a TLL level (3.3V or 5V, depending on hardware revision). And it’s galvanicaly isolated.

So, in that case, you don’t need to put any adapters between the VE.Direct port/connector and your WeMos module.
Just connect the TX of the VE.Direct port with the RX pin of the WeMos module. And of course the GND signal.

It should work and you should receive the VE.Direct frames/info without any problem, if you set the port speed correctly.

If that would have worked, I would not try these converters at all.

But it simply does not. MPPT 75/15 works on 5V, ESP2866 on 3.3V.

It works, alright… :smile:
As the communication is unidirectional, from 5V to 3V3, put a 10K resistor between the devices and that’s all. :wink:
You can adapt the value to your needs, but not less than 1K.
If it was from 3V3 to 5V, then it was a different problem, but from 5V to 3V3, a resistor is all you need.

Or, if you really want to be precise, make a level shifter with 2 resistors. Like the one below.

Thanks for suggestion, but 10k in series did not help.

My idea now is to try TXS0108E-based unidirectional level converter, to be on the safer/isolated side:

One side powered by 5V from Victron, other - by WeMos board’s 3.3V.

What about 1K ?

This is latest setup using TXS0108E-based no-name board from local shop:

ESP2866 get reads but again bytes are garbage, probably again inverted as discovered before.

Could use SoftwareSerial with invert=true but it’s unstable for reading as ESP is busy with WiFi, etc.

To setup SerialPort I just do:

SerialDebug.begin(19200, SERIAL_8N1);

Maybe somehow someway it enables it in inverted mode, I just don’t know…

Connected to Atmenga 328P.

It’s 5V, so gonna be good right?

Connecting raw TX from VE.Direct cable into Atmenga’s RX - does not read. Same as with ESP.

Using single UART->TTL converter - reads, but garbled bytes. Same as with ESP.

But why your board (WeMos) doesn’t have the GND connected to the Victron GND ???
GND is the reference for any signal !..
And Victron GND and 5V on VE.Direct are isolated from the rest of the Victron universe so it’s safe.

All GND’s are the same - lead-acid’s battery’s “-” terminal.

WeMos GND connects with Victron’s GND (checked using multimeter). Vicontr’s VE.Direct GND does not seem to be isolated.

Found some old post from 2019:

https://communityarchive.victronenergy.com/questions/7386/bluesolar-mppt-7515-vedirect-interface-outputs-uni.html

The 5V is probably high enough to cross the threshold for your RS232 interface to receive a high / low, but remember that TTL signals are inverted, so a TTL low is 1 and a TTL high is 0. That’ll explain the garbage.

So it confirms “invertion” of sorts. Using double TTL->UART converters somehow un-inverts.

Maybe I could setup MAX232 chip manually to convert levels and invert?

Another find:

I got it working now, using an inverter (74HC14D see here and here for details) before my MAX3232 converter.

https://communityarchive.victronenergy.com/questions/43442/vedirect-over-rs232-connection-not-usb-to-rs232-ca.html

The Victron isolated GND is different from the battery’s GND…
All your GNDs and your “construction” must be on the WeMos side, with WeMos side as the main source of GND.
You must leave the battery’s GND alone, the sole point of GND on Victron side must be the VE.Direct GND, otherwise there is no isolation.
Also, try to not take power from VE.Direct port, supply your converter from WeMos board.

Maybe this depends on the model.

Resistance from Ve.Direct GND and “-” is nothing. It’s not isolated. Or I am measuring wrong.

Victron is advertising all its VE.Direct ports to be isolated.
Maybe there is some other “bridge” somewhere, on the system…