#PVbrain 2 - "Make your solar installation smart"

268 messages · Page 1 of 1 (latest)

slender vortex
#

PvBrain-v2.0 is an open source/openhardware project to monitor/control SIMULTANEOUSLY :

  • Multiple inverters. (PIPsolar/Voltronic, Deye, Growatt, Sofar, Victron, etc...) and multiple BMS. (JKBMS, AntBMS, DalyBMS, SeplosBMS, Pylontech, etc...) ( In theory any inverter or BMS with ESPhome support can be used with the PVbrain2).

  • It also adds the possibility of controlling up to 32 relays allowing for example to control an Automatic Transfer Switch (ATS) (Offgrid<=>return to the network).

  • The PCB uses only crossover components or pluggable components in order to have easy setup/maintenance.

  • The MCU used is an ESP32S3 running ESPHome allowing communication over WiFi to Home_Assistant (HA) natively. (But MQTT can be added easily).

The main features are :

  • Direct communication and control with Voltronic/Pipsolar, DEYE, SOFAR, GROWATT inverters via direct Ethernet cable. (pvbrain has a built-in RS232 and RS485 => TTL)
  • The VEdirect for VICTRON models with an insulated adapter provided. Important settings can be set directly from HA (or the web server if enabled).
  • Monitor multiple BMS (tested with JKBMS but should work with antBMS, DalyBMS PaceBMS or SeplosBMS) with an insulated adapter provided.
  • Detect multiple AC sources (solar/network/other) (in order for example to do soft switching for the ATS part).
  • Monitor via a JSY193, JSY194T module (modbus) solar and network production.
  • Control up to 32x relays with two i2c extension SX1509, that is for ATS control or the reversing mode of a modern inverter. (Axpert max I & II for example)
  • The solar power diverter thanks to ROBOTDYN or SSR modules controlled in PWM.
  • Monitor your basement temperature/humidity/pressure with BME280 (you can set up alarms just in case).
  • Free I2C ports available for plugging in additional I2C sensors.
  • SPI port is also available.

Github : https://github.com/SeByDocKy/pvbrain2?tab=readme-ov-file

#

It will be possible to have CANbus and direct communication with inverters agregatting serveral BMS informations

next shell
#

Wow!! ok we are getting spolied by all these great new projects - ok theres no cats in this one but man man man thats a lot of work going on here 😉

slender vortex
#

yes .... a lot more than 8 months with 3-4 persons

#

A first batch of 20 cards is already on the way but most of them are already reserved in our discord channel 🙂

next shell
#

thats great

#

hope you can make some money back on it

slender vortex
#

we don't want

#

it's free ....

next shell
#

well cover the costs

#

is what i mean

slender vortex
#

and for our own requierements .....

next shell
#

nice work

slender vortex
#

If someone with this hardware want to contribute by adding the ESPhome part of its inverter/bms/etc... just create a PR

#

we will release some videos "how to build/setup" ....

next shell
#

subscribed

slender vortex
#

the main yaml code is only "aggregating" some package .... so super easy to add/remove an inverter/bms/etc...

#

Not all the code is writtent yet .... for the AC/DC powerdiverter, I need to write a small PID ESPhome code

#

but the hardware is already ok for it

#

The card at JLCPCB can odered with all connectors/etc.... already soldered

#

just need to clip ESP32 S3/wk2168/sx1509 on it that's all

next shell
#

looks like you have thought of everything 😉

slender vortex
#

not all but .... a lot of possibilities can be done ... You have 11 UARTs out of the box ... and with some addon card you can extend with 4 extra

#

If would be good if jessie or karendt can fully validate the Weika PR 🙂

#

All communications are done with isolated converters RS232/RS485 ot VEdurect

#

I would like to setup an online compilation/flashing server (why not with gitpod) for newbaby users ....

finite shale
#

Congratulations! Would be interested to see how to order boards for myself from JLCPCB?

slender vortex
#

There are all the gerber and bom files for

#

you can order the main board naked or assembled. Be aware WK2168 boards (x2) are required too

#

with JLCPCB, you need to order 5x board minimum 😦

#

In our first 20 orders, maybe (I say maybe) there will be 2 lefts available

#

I advised you, if you want to order at JLCPCB directly to order the "Main PCB with WK2168 and UART Isolator"

primal trout
#

Nice - but no CANBus? I am controlling a Goodwe hybrid inverter, BYD battery and a Jakiper battery with a 3-CANBus setup on ESPHome, happy to share the code.

slender vortex
#

There is CANBus

#

the top right ETH is for canbus

#

it support either ESP32can or MCP chip via SPI

#

@primal trout I updated the gith's readme to add the the CANbus support

#

The PVbrain 2 will be able to be a multi-BMS "jackie board"

slender vortex
#

Feel free to share your code for being included

primal trout
slender vortex
#

you mean to use both in same time ?

primal trout
#

My setup has 3 interfaces, one for each battery and the inverter.

#

I have another branch to merge data from multiple batteries and present to inverter as one interface - will clean it up a bit and post here.

slender vortex
#

whe make multiBMS agregation

slender vortex
primal trout
slender vortex
#

when you are writting 3 interfaces, you mean each of them is running a different protocol ? databaud, physical interface ?

primal trout
#

Correct.

#

This is the part in the yaml that combines the data: ```
bms_charger:
id: goodwe
canbus_id: can2
debug: true
protocol: sma
charge_profile:
- 0% -> 20
- 10% -> 100
- 85% -> 100
- 95% -> 50
- 100% -> 20
batteries:
- bms_id: byd_bms
heartbeat_id: 0x308
heartbeat_text: "GW5048ES"
- bms_id: jakiper_bms

slender vortex
#

so no agregation

#

Hummm very interesting

primal trout
#

You can't run the two batteries on one physical interface since they use overlapping messages.

slender vortex
#

this is why we tought to perform agregation first

primal trout
#

The component merges the data reported by each battery and sends to the inverter, plus you can control charge rate etc. from ESPHome/HA

slender vortex
#

that's exactly what we are looking for 🙂

#

which protocol ?

#

for pylon 1.2 ?

primal trout
#

One of them is using Pylon CAN protocol, the other is BYD, which is almost the same as the published SMA CAN protocol. The inverter can be set to either.

#

I reverse-engineered the BYD, but found the SMA was almost a match.

slender vortex
#

yes

primal trout
#

Not sure which Pylon version it is. CAN protocol is simpler than RS485.

#

I've been running it for nearly a year now, works well. I did it because I needed to expand the battery bank, and the BYD batteries I have are no longer available.

slender vortex
#

ok

#

You can be the right person to help us to make the smart bms transductor package

primal trout
#

I'll clean up the code (is not up to date with ESPHome dev) and document the charger component. Maybe next week.

slender vortex
#

great

primal trout
#

Docs for the monitoring side are already there - see the PR.

slender vortex
#

Originally we wanted to make smart old bms

#

by making the protocol translation from data extracted and agregated from different bms

#

like the peterboard can do but in practive with one BMS

slender vortex
#

got it

#

I saw your PR

primal trout
#

Obviously other protocols can be added. All the CAN protocols I looked at had similar approach, just different messages.

slender vortex
#

but for me was to extract data from classic CANbus protocols

#

not to translate bms info and cast them into

#

I am wrong ?

primal trout
#

Sorry, not sure what you're asking.

slender vortex
#

ok

#

For me when I saw your PR, i though it was to read canbaus data circulating via the bus

#

and send to HA for example

primal trout
#

It is. There is another branch that can combine that - no PR yet.

slender vortex
#

ha 🙂

#

ok

#

here what we want also

#

is to bridge infos from BMS (RS232/RS485), parse them agregate from multibms (not necessary the same brand/model of bms) and send to inverter via a selected protocol

#

Hope I am a bit more clear

primal trout
#

Yes, that is entirely possible. Doesn't matter if the source is CAN or RS485, the data is basically the same and can be aggregated.

slender vortex
#

great

#

so you can be the man 🙂

primal trout
#

That was the long term goal, just didn't get any traction from elsewhere, so did not proceed past getting my own setup going, so your work will help push things along.

slender vortex
#

We didn't tought to have multiple canbus interfaces

#

but

#

good news ...

primal trout
#

Could be a plug in board, with SPI plus I2C I/O expander for multiple CS.

slender vortex
#

we have some free SPI port where we can design addon card to be installed on the main board

primal trout
#

I used the MCP2515 (??) - have not used the ESP32 on board CAN.

slender vortex
#

we can plug either the TJA or the MCP2515 on the PVbrain 2

#

if you want multiple CANbus would be so via several MCP2515

primal trout
#

yep. The data throughput is not high, so it could handle quite a few I think.

slender vortex
#

ok ... I wil ask to bandit (who is the pcb designer to make this addon board)

#

There are only 2 or 3 free CS/GPIO if i remember well

#

I will ask

primal trout
#

But CS doesn't need to be an internal pin.

slender vortex
#

right

#

we have two SX1509

#

don't know if can be used as CS

#

not sure

#

after all pins of the S3 are exposed

#

so in worst worse case more CS can be used via dupont

finite shale
#

This discussion sent me on a little bit of a search, as I thought that CAN was a serial (UART) protocol rather than being most commonly interfaced using SPI. I discovered that DFRobot has made a CAN-USB/UART adapter, which looks quite neat, but taking a careful look at the board, it seems that the USB and UART interfaces are actually provided by an ESP32-S2 or S3! Seems like a little bit of overkill, but potentially opens up a whole lot of options, too!

slender vortex
#

FYI, there are 3 available GPIO/CS for the futur multi-CAN daughter board of the PVbrain 2

slender vortex
finite shale
slender vortex
#

for the PVbrain 2, we can install either the TJA1051 or the SN65HVD230 or the MCP2515

finite shale
#

Looks like they are quite different devices, though. TJA1051 assumes you have a CAN peripheral that can drive RX and TX, while MCP2515 implements the CAN peripheral itself, and is interfaced over SPI

#

SN65HVD230 is similar to the TJA1051, also needs a CAN peripheral in your microcontroller.

slender vortex
#

right

#

Personaly I will probably choose the MCP2515... I guess your changed the crystal with ?

primal trout
#

yes, the MCP2515 is a complete interface. The ESPHome driver supports 8, 12, 16 and 20MHz crystals for it.

slender vortex
#

best performances are obtained with 16Mhz ?

primal trout
#

I don't think it matters.

slender vortex
#

Ok

austere veldt
slender vortex
#

Gerber are on the git .... so up to 4 CANbus interfaces with this addon 🙂

sullen marlin
#

This is all really cool stuff. I'm currently using 3 separate esp32 boards in order to use their bluetooth interfaces to control my pv chargers, bms and pip hybrid inverter. This project looks like a really nice way to go. I see a lot of BMS brands mentioned but nothing about jbd/xiaoxiang. Does this work with any device that supports the esphome UART component or are there specific requirements for the multi uart extenders? I've currently got 4x jbd bms and 3x victron pv charge controllers. They work with serial or bluetooth but I settled on bluetooth because rigging up a bunch of uarts would be such a mess of wires. Your circuit board solves that problem nicely.

slender vortex
#

@sullen marlin No problem for JBD... since @gleaming saffron did also the ESPhome integration.... So can be added easily

#

the pvbrain 2 hosts 2 x WK2168 to get 8 extra UARTs

#

you can also installed up to 3 daughter board to have extra 3 x 4 UARts

sullen marlin
#

if anyone else is interested in some of these boards maybe we can organize a group buy from jlcpcb

slender vortex
#

we will receive 20 boards probably next week (they are on the shipping process).... 18 or 19 are already reserved in our (French) discord

#

What we did, we posted a "poll" who were interested .... then as soon as there is a muliple of x 5, we ordered

slender vortex
#

@primal trout I checked a bit your work.... that's great

#

I saw the bms_charger...

#

espeically this part

#
  id: goodwe
  canbus_id: can2
  debug: true
  protocol: sma
  charge_profile:
    - 0% -> 20
    - 10% -> 100
    - 85% -> 100
    - 95% -> 50
    - 100% -> 20
  batteries:
    - bms_id: byd_bms
      heartbeat_id: 0x308
      heartbeat_text: "GW5048ES"
    - bms_id: jakiper_bms```
#

are % SOC here ?

#

and corresponding number amperage ?

primal trout
#

Correct. The motivation was to slow the charge rate near 100% to allow the battery cell balancer a chance to work. The Jakiper BMS (I think it's a PACE) has fairly weak balancing current so needs time near full charge to work properly.

slender vortex
#

that's exactly what I wanted to do

#

its possible to add more levels inputs ?

#

and more .... can betteries inputs can be something else that canbus batterie ?

primal trout
#

That's certainly doable, just needs all BMS components to expose a consistent API.

slender vortex
#

Coz for former "non-smart" bms, like the old jkbms, what we have to do first is to extract from RS232 com the informations requiered for your module

primal trout
#

There is a daly_bms component already in ESPHome that uses a serial (RS485?) interface - that might be a good starting point.

slender vortex
#

There is the @syssi integration of the JKBMS

#

the Daly is RS232

#

for the JKBMS

finite shale
#

Would it not be possible to just refer to the entity(ies) that need to be adjusted? e.g. something like:

bms_charger:
  id: goodwe
  canbus_id: can2
  debug: true
  protocol: sma
  charge_profile:
    - 0% -> 20
    - 10% -> 100
    - 85% -> 100
    - 95% -> 50
    - 100% -> 20
  batteries:
    - bms_id: byd_bms
      heartbeat_id: 0x308
      heartbeat_text: "GW5048ES"
    - bms_id: jakiper_bms
      state_of_charge_id: some_float_sensor
      charge_rate_id: some_writable_number_entity

i.e. if the charge_rate_id is set, update the charge rate depending on the value of some_float_sensor by writing the relevant charge current to the some_writable_number_entity.

slender vortex
#

Yes can be something like this

light spear
#

Ttgo

primal trout
#

That would be doable, but involve a lot more work than just adding the necessary API to the existing BMS components. There are quite a few linear and binary sensors to deal with.

finite shale
#

Sounds like you are trying to define a battery: component/interface, then. Which is not unreasonable, but perhaps takes a bit more thought as to what features are required, compared to just defining an input and output entity for State of Charge, and Charge Current .

primal trout
#

Already defined. Batteries (or at least BMSes) have pretty standardised functionality. They report real time values - current, voltage, state of charge. They flag alarms (over/under voltage/current) and they report limits (min/max voltage and max charge/discharge current.) So the API, as implemented in the canbus_bms component, looks like this: ```
virtual float get_voltage() = 0;
virtual float get_current() = 0;
virtual float get_charge() = 0;
virtual float get_temperature() = 0;
virtual float get_health() = 0;
virtual float get_max_voltage() = 0;
virtual float get_min_voltage() = 0;
virtual float get_max_charge_current() = 0;
virtual float get_max_discharge_current() = 0;
virtual uint32_t get_alarms() = 0;
virtual uint32_t get_warnings() = 0;
virtual uint32_t get_requests() = 0;

#

Plus some flag definitions for alarms, warnings and requests.

#

Other stuff, like cell voltages, balancing status etc. are interesting in their own right, but not required for communication with an inverter/charger.

slender vortex
#

We received board today

urban grail
#

Oh yes , so happy therefore one is mine😁

digital patio
#

Me too 😄

jagged current
#

Any serial multiplexer boards for sale?

lapis light
jagged current
#

I mean, from @slender vortex

slender vortex
#

standone ?

#

in the git, you can find gerbers for the standalone MX board....

#

or you can purchase some in AE

#

larger

#

and without GPIO features

jagged current
#

Yes, standalone. Just the multiplexers.

#

Your red little board.

#

With 4 uarts

#

This one? Can't be purchased?

hushed scarab
#

Hello, would anyone be selling the populated boards ?

slender vortex
#

Are you in Europe ?

hushed scarab
#

UK

slender vortex
#

Not sure maybe there is one left in the first 20 batch

#

I am asking

hushed scarab
#

OK I would be interested, currently I have Growatt, Solis and Enphase inverters online together with Solax X1 AC and Canbus batteries so would nice to try it out

slender vortex
#

whaoohh

#

so eclectic setup

hushed scarab
#

yep, a little load shedding may be a possibility when over generation

slender vortex
#

everything is communicating via RS232 or RS485 or CANbus ?

hushed scarab
#

maybe with teh Pv brain I could do improved export control when batteries are full

#

some 485 bateries via CAN, a growatt via 232, enphase is IP however enphase is supported in HA so maybe able to push it back to PVbrain?

slender vortex
#

Yes you can always push back via HA sensors in ESPhome

#

what batteries you have ?

#

Pylontech ?

hushed scarab
#

Valence

slender vortex
#

what bms ?

hushed scarab
#

Valence U-BMS

slender vortex
#

there is a ESPhome support already ?

hushed scarab
#

Nope, not seen anything, I could possibly do a protocol conversion and present them as Pylontech if ESPHome would accept that

slender vortex
#

Ok

hushed scarab
#

Does PVbrain poll modbusTCP?

slender vortex
#

Actually no TCP but a W5500 can be installed via SPI

hushed scarab
#

OK, so what protocol would the W5500 use over Ethernet?

slender vortex
#

I don't know right now 😦

#

hummm seems there is a lot of work for your particular setup

hushed scarab
#

no worries, guess I could always use a couple of elfin ew10/11 back to back

#

Yep defo looks like a bit of work, but should be worth it if full control can be implemented

slender vortex
#

yes

hushed scarab
#

also if some of the work will help others it would be win win

slender vortex
#

I guess your need some intermediate device between RTU<->TCP

hushed scarab
#

at present all RTU devices are served up as TCP, so should be a matter of converting back to RTU at the PVbrain side

#

the elfin devices make that easily possible

slender vortex
#

I asked to @austere veldt if there is a left one .... seems the last but he is checking how much/how hard is it now to send something in UK with the online customs service

hushed scarab
#

OK thanks

slender vortex
#

you're the welcome

#

Ok tmr he will go to the postoffice to send first pre-ordered boards... He will ask there

#

of UK shipping

#

seems much moire work now 🙂

hushed scarab
#

OK thanks, otherwise another option could be for you supplier to ship minimum quantity to me if there is interest from others in the UK

slender vortex
#

We are the designers.... we just ordered a first batch for ourselves (and people around in our discord).... our role is not to make business with.... We gave all codes, gerber files in the git to let people to order by themselve.

finite shale
#

Out of curiousity, do you have an idea of how much the multiport UART boards actually cost? Even at your own quantities (20? 40?) vs minimum (5?)

#

Would be a useful addition for e.g. a Raspberry Pi or other SBC's that want more UARTs.

finite shale
#

Googling around suggests that the WK2168 IC itself costs around $5.2 in small quantities, so I'm guessing around $10-12 per board, without any markup.

slender vortex
slender vortex
#

click on open browser at lower right positition popup

slender vortex
#

PVbrain 2 with some addon cards....

austere veldt
#

Hi @hushed scarab for sending from France to UK there are papers to fill out for customs, I can do what is necessary, I just need your mail address. can you contact me privately?

hushed scarab
primal trout
slender vortex
#

Ho great 🙂

#

thx

slender vortex
#

Some users tested successfully the PVbrain with several Victron in VEdirect, Growatt inverter, PACEbms, antbms, SeplosBMS

finite shale
slender vortex
#

Ha yes very interesting

slender vortex
#

haha no ESPhome frriendly 😉

finite shale
#

No, for sure it isn't. Would probably run Linux, though

austere veldt
#

integration of WKs are now in ESPHOME

finite shale
#

Congratulations. That PR took a long time!

slender vortex
#

Just installed my own PVbrain2..... under control with :

#
  • 1 inverter (voltronic max 1 in RS232) and soon a Deye in modbus RS485
#
  • 4 x JKBMS (old model) in (isolated) TTL
#
  • 2 x SRNE solar charger in modbus RS485
#
  • 1 x JSY-MY-193 AC powermeter in modbus RS485 and soon the new DC powermeter JSY-MY-231
#
  • 1 x victron smartshunt in TTL/VE.Direct
#

and soon 1 x sofar grid inveter in modbus RS485

#

works flowless

#

my average looptime is about 85ms

#

in total of 580 entities

slender vortex
#

The multiBMS smart canbus package is in PR

slender vortex
#

Just added the incoming (first) CT clamp bidirectionnal DC powermeter, the JSY-MY-231

slender vortex
#

Just Pushed the YamBMS ( Yet another multi-BMS Merging Solution ) PR compatible with the PVbrain2 board.... A kind of "Jackyboard" but with the PVbrain2 for several BMS