Victron MPPT data using Arduino serial: Difference between revisions

From Sensors in Schools
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


= References =
= References =
* [https://www.caravanersforum.com/viewtopic.php?t=63614 Arduino reads Victron MPPT]
* [https://www.youtube.com/watch?v=w-9kYkSuCwc Reading Victron MPPT controller data using Arduino]
* [https://www.romlea.nl/Arduino%20MPPT/Page.htm Example code]


= Voltage considerations for different Victron hardware =
= Voltage considerations for different Victron hardware =
Line 8: Line 9:
* Arduino Uno also operates at 5V so no digital converter required.
* Arduino Uno also operates at 5V so no digital converter required.


[[File:Screenshot 2023-07-01 at 8.57.49 pm.png | 900px]]
 
 
= Arduino Code - Image =
 
 
 
= Arduino Code - Code =
<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);
}
 
void loop()
{
  if (mySerial.available())
  {
        label = mySerial.readStringUntil('\t');     
        val = mySerial.readStringUntil('\r\r\n');
        Serial.println(label + val);
  }
}
 
</syntaxhighlight>

Revision as of 06:04, 3 July 2023

Reading Victron MPPT Data

References

Voltage considerations for different Victron hardware

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


Arduino Code - Image

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);
   } 
}