Victron MPPT data using Arduino serial: Difference between revisions

From Sensors in Schools
Jump to navigation Jump to search
Line 68: Line 68:
         val = mySerial.readStringUntil('\r\r\n');
         val = mySerial.readStringUntil('\r\r\n');
         Serial.println(label + val);
         Serial.println(label + val);
  }
}
</syntaxhighlight>
= Arduino Code - Code - Reading Battery Voltage - V =
<syntaxhighlight lang="c++">
/* Connections:
    MPPT pin    MPPT        Arduino    Arduino pin
    1            GND        GND        GND
    2            RX          TX          -              do not use!
    3            TX          RX          7 (UNO)
    4            Power+      none        -              do not use!
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8); // RX, TX
String label, val;
void setup() 
{
  Serial.begin(9600);
  mySerial.begin(19200); // baud rate for MPPT
}
void loop()
{
  if (mySerial.available())
  {
        label = mySerial.readStringUntil('\t');     
        val = mySerial.readStringUntil('\r\r\n');
        // V = Battery voltage (mV)
        // VPV = Solar Panel voltage (mV)
        // PPV = Solar panel power (W)
        // I = Battery current (mA)
        // IL = Load Current (mA)
        if (label == "V"){
          Serial.println(label + val);
        }
   }  
   }  
}
}


</syntaxhighlight>
</syntaxhighlight>

Revision as of 22:28, 7 July 2023

Reading Victron MPPT Data

References

Parts Required

  • Victron BlueSolar MPPT 75/15 Retail SCC010015050R - $135 (Note that this unit is not Bluetooth enabled) [1]
  • JST Jumper 4 Wire Assembly - $2.75 [2]
  • Arduino Uno

Voltage considerations for different Victron hardware

  • Victron MPPT operates at 5V.
  • Arduino Uno also operates at 5V so no digital converter required.

VE.Direct Pinout

Serial Port Configuration - VE.Direct

Fritzing Circuit Diagram

Photos of Circuit


Arduino Code - Image

Serial Monitor - Example Output

Arduino Code - Code

/* Connections:
    MPPT pin     MPPT        Arduino     Arduino pin
    1            GND         GND         GND
    2            RX          TX          -              do not use!
    3            TX          RX          7 (UNO)
    4            Power+      none        -              do not use!
 */

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 8); // RX, TX

String label, val;

void setup()  
{
  Serial.begin(9600);
  mySerial.begin(19200);
} 

void loop() 
{
  if (mySerial.available())
   {
        label = mySerial.readStringUntil('\t');      
        val = mySerial.readStringUntil('\r\r\n');
        Serial.println(label + val);
   } 
}

Arduino Code - Code - Reading Battery Voltage - V

/* Connections:
    MPPT pin     MPPT        Arduino     Arduino pin
    1            GND         GND         GND
    2            RX          TX          -              do not use!
    3            TX          RX          7 (UNO)
    4            Power+      none        -              do not use!
 */

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 8); // RX, TX

String label, val;

void setup()  
{
  Serial.begin(9600);
  mySerial.begin(19200); // baud rate for MPPT
} 

void loop() 
{
  if (mySerial.available())
   {
        label = mySerial.readStringUntil('\t');      
        val = mySerial.readStringUntil('\r\r\n');
        // V = Battery voltage (mV)
        // VPV = Solar Panel voltage (mV)
        // PPV = Solar panel power (W)
        // I = Battery current (mA)
        // IL = Load Current (mA)
        if (label == "V"){
           Serial.println(label + val);
        }
   } 
}