Skip to content

alexjomin/victron-display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Victron Display

Introduction

This is an experimental repo. My goal is to parse the VE.Direct protocol from Victron with TinyGo on a Raspberry Pico.

See specifications of the protocol here

I want to have a display in my van to see :

  • Battery voltage and current
  • Solar panel Voltage and Current
  • Current State of the MPTT Controller
  • Maximum power
  • Minimum and maximum voltage

Roadmap:

  • Parsing VE.Direct protocol
  • Connect to the MPTT
  • Flashing the pico nano with firmware
  • Refactoring to avoid heap allocations
  • Add a display
  • Add a button
  • Testing
  • Optimizing and reliability

Basic concepts

Hardware

flowchart LR
    MPTT(Victron MPTT) --> R[Rasp Pico];
    R --> LCD;
Loading

Software

flowchart LR
    R["serial data"] --> P[Parsing];
    P -- "map[string]string{}" --> Frame;
    Frame -- "struct{}" --> State;
Loading

Hardware

Socket

You will need a JST PH 4 female socket to connect your Victron device to the Raspberry

Microcontroller

In this POC I used a Rasbberry Pico, cheap and well supported by TinyGO: https://tinygo.org/docs/reference/microcontrollers/pico/

Flash the pico

tinygo flash -target=pico main.go

Testing the VE.Direct parsing lib

go test -v ./vedirect

It relies on a dump of my SmartSolar 100/20

Build and track heap allocation

More info available here.

As you may see, I had to modify a bit my usual gopher habits to reduce the number of heap allocations, in order to optimize the memory management of the microcontroller.

Here some adjumemts

  • no pointer in "constructor like" method (aka New() (*myStruct, err))
  • passing by value instead of reference in method :
    • ex func (m *myStruct) myMethod error --> func (m myStruct) myMethod (m myStruct, err error)
tinygo build -o firmware.uf2 -target=pico -print-allocs=. 2> >(grep victron)

Pico Pinout

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published