whfarms avatar image
whfarms asked

VE.DIRECT Doesnt Initalize

I have a MPPT 100|50 solar controller. I pruchased a VE.Direct cable. I cut one end off and attempted to wire it to my teensy 4.1 via an ADUM1201 optocoupler.

The end I cut off left me 4 wires Red, Black, Green, White. When I tested it with my multimeter RED=GRN and BLACK = +5V. I read a few articles and could not get a great understanding if the white or green would be transmit or receive. I have tried both combinations.

I downloaded some code written by Brendan McLearie from github. I set the code to use my serial 6 port. I am never able to connect.

I have switched TX and RX on both sides of the ADUM1201. I am at a loss. Is there some process that needs to be taken to "initialize" the VE.Direct output?

MPPT ControllersVE.Directarduino
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
whfarms avatar image
whfarms answered ·

Anybody have any help out there?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

captaintactful avatar image captaintactful commented ·

The ve direct works at a 1 second interval out of the box, you just need the right devices connected.

The usb to ve direct victron cable has isolation built in from what I've read. Needed for firmware updates. I found that out irritatingly.

This is what I've used to connect to my serial ports and parse into influx/grafana.

JST PH 2.0

To a 5v TTL to RS232 converter

I haven't bothered with opto isolation yet but you could use this i think,

RS232 opto isolation

The data comes in a bit too fast for my parser so I've had to limit the scope of the integers in the code.



also rs232 is what serial is

0 Likes 0 ·
whfarms avatar image
whfarms answered ·

I got it to read tonight. I changed to a very simple couple line code that simple says serial.available print

I was using code from Richard Peterson and Brandon Mclery(memory) that was recommended on these boards. That code refused to create a serial connection and is quite complex to read so troubleshooting it is very difficult for me.

I would like to try to get it working so the git repo could be updated as I feel it is probably regularly sought after. It seems to be the most complete (and complex) code to connect an arduino to a port.

I do have full isolation using a ADUM1201. I use the teensy 4.1 board that is 3v so I didn’t want to fry it with the 5 volt MPPT.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

whfarms avatar image
whfarms answered ·

VEDirect::VEDirect(HardwareSerial& port):


// Initialise the serial port that the

// VE.Direct device is connected to and

// store it for later use.



VEDirect::~VEDirect() {

// virtual destructor


uint8_t VEDirect::begin() {

// Check connection the serial port


if (VESerial) {


if(VESerial.available()) {



return 1;



return 0;


int32_t VEDirect::read(uint8_t target) {

// Read VE.Direct lines from the serial port

// Search for the label specified by enum target

// Extract and return the corresponding value

// If value is "ON" return 1. If "OFF" return 0;

uint16_t loops = VED_MAX_READ_LOOPS;

uint8_t lines = VED_MAX_READ_LINES;

int32_t ret = 0; // The value to be returned

char line[VED_LINE_SIZE] = "\0"; // Line buffer

uint8_t idx = 0; // Line buffer index

char* label;

char* value_str;

int8_t b; // byte read from the stream


while (lines > 0) {

if (VESerial.available()) {

while (loops > 0) {

b =;

if ((b == -1) || (b == '\r')) { // Ignore '\r' and empty reads


} else {

if (b == '\n') { // EOL


} else {

if (idx < VED_LINE_SIZE) {

line[idx++] = b; // Add it to the buffer

} else {

return 0; // Buffer overrun





line[idx] = '\0'; // Terminate the string

// Line in buffer

if (target == VE_DUMP) {

// Diagnostic routine - just print to Serial0;


// Continue on rather than break to reset for next line


label = strtok(line, "\t");

if (strcmp_P(label, ved_labels[target]) == 0) {

value_str = strtok(0, "\t");

if (value_str[0] == 'O') { //ON OFF type

if (value_str[1] == 'N') {

ret = 1; // ON


} else {

ret = 0; // OFF



} else {

sscanf(value_str, "%ld", &ret);



} else { // Line not of interest



line[0] = '\0';

idx = 0;




return ret;


void VEDirect::copy_raw_to_serial0() {



2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources

MPPT Product Page

MPPT Error codes

MPPT 150/60 up to 250/70 Manual

Additional resources still need to be added for this topic

VE.Direct protocol FAQ