Victron BMV 700 - WEMOS D1 Mini

Ok, I’ve spent some time re-learning some of this stuff and ended up reinstalling the whole software suite before I could managed to compile my original code.

So now I’ve got Arduino V1.8.9, ESP Core 2.5.2 & Blynk 0.6.1
I haven’t had time to upload anything new to my Wemos board and with that core number I’m sure it probably wouldn’t work anyway, I think the previous core version was 2.3.0 but I might just try it before downgrading back to 2.3.0.

I’ve got another board at my office and a BME280 so maybe I’ll recompile with that one to save breaking my operational board which is ok other than it crashes every few days.

The chap that was previously helping me did create another version of the code with the additional parts to check for internet connection and reboot if not available, I never tested this and it does not have the code for the temp sensor but I’ll post it here in case its any use.

#include <SoftwareSerial.h>
#include <SPI.h>
#define BLYNK_PRINT Serial //Jue
#include <ESP8266WiFi.h> //Jue
#include <BlynkSimpleEsp8266.h> //Jue
BlynkTimer timer;

char auth[] = ""; //Jue
char ssid[] = ""; //Jue
char pass[] = ""; //Jue
SoftwareSerial Victron(D7,D8); // RX, TX //Jue changed this
WidgetLED led1(V6);
char p_buffer[80];
#define P(str) (strcpy_P(p_buffer, PSTR(str)), p_buffer)
char c;
String V_buffer;  // Buffer to hold data from the Victron monitor
float Current;
float Voltage;
float SOC;
float CE;

String stringOne;
void setup()
  // Connect to WiFi network
  Serial.print("Connecting to ");
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");
  Blynk.begin(auth, ssid, pass); //Jue
  readVictronData(); // This will initially set Victron variables 
  timer.setInterval(5000, sendDatatoBlynk); // Send Data to blynk every 5 sec

// Main void loop that will continously be running
void loop() { 
  if (WiFi.status() != WL_CONNECTED) { // If wifi is not connected run reconnect() function

  if (Blynk.connected()) {  // Checking Blynk connection. If connected...
    led1.on();          // Turn on Virtual LED in app;        // Run Blynk
    readVictronData();  // Read Victron Data;        // Will make sure sendDatatoBlynk is called
   } else {
    Serial.println("Whoops blynk is not connected need to do something about that");;             // Turn of LED in app if connection to blynk is down
    CheckBlynkConnection(); // If Blynk connection is down, this will be called, should reconnect

void reconnect() {
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");  // As long as it is trying to connect print a . each 500ms to debugger
  Serial.println("WiFi re-connected");

void sendDatatoBlynk() {
  // These if statements make sure only to send data if data has been set in the main loop already

  Serial.println("I am called within sendDatatoBlynk function");
    Blynk.virtualWrite (V2,Current);  
    Blynk.virtualWrite (V1,Voltage);
    Blynk.virtualWrite (V4,SOC);
    Blynk.virtualWrite (V3,CE);

void readVictronData() {
  if (Victron.available()) {
    c =;
    if (V_buffer.length() <32) {
      V_buffer += c;
    if (c == '\n') {  // New line.
      if (V_buffer.startsWith("I")) {
        String temp_string = V_buffer.substring(V_buffer.indexOf("\t")+1);
        double temp_int = temp_string.toInt();
        Current = (float) temp_int/1000;
      if (V_buffer.startsWith("V")) {
        String temp_string = V_buffer.substring(V_buffer.indexOf("\t")+1);
        int temp_int = temp_string.toInt();
        Voltage = (float) temp_int/1000;
      if (V_buffer.startsWith("SOC")) {
        String temp_string = V_buffer.substring(V_buffer.indexOf("\t")+1);
        int temp_int = temp_string.toInt();
        SOC = (float) temp_int/10;
      if (V_buffer.startsWith("CE")) {
        String temp_string = V_buffer.substring(V_buffer.indexOf("\t")+1);
        int temp_int = temp_string.toInt();
        CE = (float) temp_int/1000;
      V_buffer=""; // Empty V_Buffer
  } else {  // If Victron not available reset software

void CheckBlynkConnection(){    // check if connected to Blynk server
    Serial.println("Not connected to Blynk server"); 
    Blynk.connect();  // try to connect to server with default timeout
    Serial.println("Connected to Blynk server");     

At least the Void Loop is a little bit tidier in this one.

Not much point in using WiFi.begin then Blynk.begin.
It would make more sense to use WiFi.begin, Blynk.config then Blynk.connect.


1 Like