diy solar

diy solar

JK BMS CAN bus comms now possible for inverters that support Goodwe and Pylontech batteries

Quick question,
What is the voltage on the vbatt pin on the rs485 connector?

I wonder can the esp32 be powered from it?
It's the full 52V on that pin. Be careful! If it accidentally touches the digital pins it'll surely fry something. I'm surprised they even made this decision to have a high voltage on such a tiny pin.

You could use a step down DC-to-DC converter from AliExpress or borrow a USB port from a nearby inverter or something.

 
It's the full 52V on that pin. Be careful! If it accidentally touches the digital pins it'll surely fry something. I'm surprised they even made this decision to have a high voltage on such a tiny pin.

You could use a step down DC-to-DC converter from AliExpress or borrow a USB port from a nearby inverter or something.

Ah good to know, just was thinking having 5v there would be too easy
 
Ah good to know, just was thinking having 5v there would be too easy
I am currently using an isolated 48V => 5V DC-DC converter. Search for VRB4805S-6WR3 - This part works perfectly for me. I avoid non-isolated converters for this amount of drop-down, as a component failure (transistor or oscillator) will send full pack voltage to the ESP32, and potentially to the inverter. Isolated converters prevent this from happening.

Just note that the power supply must have low output ripple to avoid problems. RS485 would not read correctly due to high error rates with another converter I previously tried.
 
Just note that the power supply must have low output ripple to avoid problems. RS485 would not read correctly due to high error rates with another converter I previously tried
Yep, you need good clean power, don't forget to add a suitably small inline fuse with the DC-DC converter in case it fails short circuit.
I power mine from nearby raspberry pi USB port, that is powered from a UPS.
 
Last edited:
I have one built up on a breadboard, Using the faker data, and CAN board plugged in.
I am noticing it Lagging a bit at the very start in sending the CAN messages and looking for wifi at the same time, causing the watchdog to kick in and reboot the system.
Disconnecting one of the CAN Data wires briefly allows the WIFI to connect/do its thing and then there are no issues after that,
Ive tried different IO Pins,
I wonder can a delay be added somehow in the yaml to not start the CAN for 30 seconds or until the wifi has stabilized?

edit:
Its not the wifi, I figured out how to not use the can until the wifi is connected, It still seems slow (eg 1 individiual message per second) unplug one of the data lines (or the power), and it catches up and plugging it back in doesnt annoy it.

Edit 2
Connected up another CAN board, and esp32.. It seems to have gone away. The original CAN board wasnt connected to anything.
 
Last edited:
Connected up another CAN board, and esp32.. It seems to have gone away. The original CAN board wasnt connected to anything.
That is correct the ESP32 has a bug if there is no second device on the CAN bus to acknowledge the packets it keeps trying to send them and eventually causes a WDT reboot.

I have a workaround I'm testing were I detect there is no inverter and stop sending CAN data, retries every 60s to see if inverter is online.

This seems to workaround the bug and stops the ESP32 from WDT reboots when there is nothing connected to the CAN bus.
 
Hi,

I have set up Pateron to help fund future development.
Additional info will be published to "Be in the know" Pateron membership levels and above like:

What development is coming soon
Development that has been completed and is in Alpha/Beta testing
Get early access to Alpha/Beta code for testing (in those tiers)
Polls to determine future features etc.
Help fund goals to purchase additional hardware like:

Early stages are under way to support multiple BMS, but need funding to purchase additional hardware, please consider supporting me if you would like to see this functionally, early access code with be made available in the Alpha testers membership once funding goals are reached: https://www.patreon.com/Uksa007Codedevelopment

Let me know what you think?
 
Last edited:
Hi, firstly I cant thank you enough for this project, it has been something on my wish list for sometime!

However, I am having a few issues getting the ESP to connect to internet whilst running your code. I have flashed the new ESP as instructed, but could only get it to connect via a static IP (this took hours to fix). I have attempted to flash you code to the ESP, both with your wifi settings and the manual setup, but cannot get any luck with it.

Have you any suggestions or ideas? Apologies if this is the wrong place, please direct me on if appropriate.

For info, our network in the house is setup with Unify Access Points, incase that has an effect.

Thanks
 

Attachments

  • Battery Code-original.png
    Battery Code-original.png
    29.7 KB · Views: 22
  • Logs.png
    Logs.png
    36.6 KB · Views: 23
Have you any suggestions or ideas?
Do you have it connected to an Inverter, it won't work unless an inverter is connected.
There is an early access beta version available that works around no inverter(CAN bus requires 2 devices to work).

You shouldn't need a static IP unless you don't have DHCP on your network.
If you are not getting an IP then it may not connecting to WIFI correctly.
You will probably need to flash the code via serial port the first time, after that OTA should work.
What do the logs say when connected via serial port?
run esphome logs esp32-example-can.yaml select serial port

Have you configured your wifi and domain setting correctly in secrets.yaml eg:

Code:
# Your Wi-Fi SSID and password
wifi_ssid: "Wifi-SSID"
wifi_password: "Password"
domain: ".mylocaldomain.com"
 
Last edited:
Bonjour
je tente en vain depuis tout l'après midi à utiliser ce projet mais je dois avouer que je suis totalement nouveau dans esp home.
j'ai reussi a installer home assistant et esp home sur machine virtuelle, j'arrive a connecter un esp32 et faire sa config de base mais je seche quand un commentaire mettre le programme et surtout lequel choisir

j'ai testé

esphome :
nom : esp32-exemple
esp32 :
carte : esp32dev
cadre:
Type : arduino
# Activer la journalisation
enregistreur :
# Activer l'API de l'assistant domestique
API :
chiffrement:
clé : "bHJYhPoZJFdSgpuugz9vjvh/DxdXUy142Vx+hjJ2zGk="
ota :
mot de passe : "c4b9da4e99bac97d1b17173c250d5c83"
Wifi:
ssid : !secret wifi_ssid
mot de passe : !secret wifi_password
# Activer le hotspot de secours (portail captif) en cas d'échec de la connexion wifi
ap :
SSID : "Esp32-Exemple de point d'accès de secours"
mot de passe : "0AGHKTIbxPl1"
composants_externes :
- source : github://syssi/esphome-jk-bms@main

je pensais que ca téléchargerais le code directement sur github mais apres avoir flashé l'esp32 j'ai ce log

si quelqu'un pouvait avoir l'ammabilité de m'aider

merci d'avance
 

Attachments

  • log esp32.jpg
    log esp32.jpg
    48.2 KB · Views: 8
Bonjour
je tente en vain depuis tout l'après midi à utiliser ce projet mais je dois avouer que je suis totalement nouveau dans esp home.
Hi,
Sorry don't speak french:

You need to use esp32-example-can.yaml if you want to communicate with inverters over CAN bus.

Do you have it connected to an Inverter, it won't work unless an inverter is connected.
There is an early access beta version available that works around no inverter(CAN bus requires 2 devices to work).

You will probably need to flash the code via serial port the first time, after that OTA should work.
What do the logs say when connected via serial port?
run esphome logs esp32-example-can.yaml select serial port

Have you configured your wifi and domain setting correctly in secrets.yaml eg:
Code:
# Your Wi-Fi SSID and password
wifi_ssid: "Wifi-SSID"
wifi_password: "Password"
domain: ".mylocaldomain.com"
 
The ESP device is not on the network properly according to home assistant. I am having the worst time with ESPhome and home assistant I just cannot get my devices to stay on the network. It is pissing me off royally.
 
The ESP device is not on the network properly according to home assistant.

Do you have it connected to an Inverter, it won't work unless an inverter is connected, the ESP32 has a bug that causes WDT reboot if no other devices on CAN bus to ACK the packets.
There is an early access beta version available that works around no inverter(CAN bus requires 2 devices to work).

What do the logs say when connected via serial port?
run esphome logs esp32-example-can.yaml select serial port

Can you ping the ESP32?
 
Last edited:
Hi,

first sorry for my english it's google translate

I have just taken everything from 0 and I have managed to transfer the program to ESP32.
when i plug into the usb port i get this log

when I am on wifi I have esp 32 online but I have no feedback.
even connects to the can of the inverter

I specify that I tried a basic installation (without program) on the esp32 and I have a communication in usb and wifi

thanks in advance
 

Attachments

  • logs_jk-bms-can_logs.txt
    54.1 KB · Views: 8
  • log 2.jpg
    log 2.jpg
    56.4 KB · Views: 8
Do you have it connected to an Inverter, it won't work unless an inverter is connected.
There is an early access beta version available that works around no inverter(CAN bus requires 2 devices to work).

You shouldn't need a static IP unless you don't have DHCP on your network.
If you are not getting an IP then it may not connecting to WIFI correctly.
You will probably need to flash the code via serial port the first time, after that OTA should work.
What do the logs say when connected via serial port?
run esphome logs esp32-example-can.yaml select serial port

Have you configured your wifi and domain setting correctly in secrets.yaml eg:

Code:
# Your Wi-Fi SSID and password
wifi_ssid: "Wifi-SSID"
wifi_password: "Password"
domain: ".mylocaldomain.com"
Thanks for your response (sorry for the delay).

So I managed to get it connected to the network (static IP only though. I have briefly tried it plugged in between the JKBMS and my inverter (Sofar HYD6000-ES). The inverter has a strange setting when using Pylontech, asking whether it is a US2000 or US3000. Not sure which is best to select, so I have tried both.

The inverter alarms out, stating no BMS is connected.

On Home Assistant, I can activate the ESP, but all other buttons are greyed out. I hope to have a proper look this Saturday due to time constraints, and attempt to log it.

All I have altered in the code is the battery size and voltages etc. My pins are connected to RX2 and TX2, D22 and D23.

I have approx 1.6-1.7v coming off the CANH/CANL line, so I know my connection there is good.

Any thoughts?
 

Attachments

  • Home Assistant Issue.png
    Home Assistant Issue.png
    77 KB · Views: 10
when I am on wifi I have esp 32 online but I have no feedback.
even connects to the can of the inverter

[16:39:55][main:328]: No rx can 0x305 reply. Rebooting...

The inverter is not responding, check the wiring to TJA1050 and the inverter.
Check the inverter is configured for CAN communications.
 
The inverter alarms out, stating no BMS is connected.
Without any logs I can only guess that the inverter is not connected correctly.
Check the wiring to TJA1050 and the inverter.
Check the inverter is configured for CAN communications.

What do the logs say when connected via serial port over USB?
run esphome logs esp32-example-can.yaml select serial port
 
Merci pour votre réponse (désolé pour le retard).

J'ai donc réussi à le connecter au réseau (adresse IP statique uniquement. Je l'ai brièvement essayé branché entre le JKBMS et mon onduleur (Sofar HYD6000-ES). L'onduleur a un réglage étrange lors de l'utilisation de Pylontech, demandant s'il est un US 2000 ou un US 3000. Je ne sais pas quel est le meilleur choix, j'ai donc essayé les deux.

L'onduleur émet une alarme indiquant qu'aucun BMS n'est connecté.

Sur Home Assistant, je peux activer l'ESP, mais tous les autres boutons sont grisés. J'espère avoir un bon aperçu ce samedi en raison de contraintes de temps et tenter de le connecter.

Tout ce que j'ai modifié dans le code, c'est la taille de la batterie et les tensions, etc. Mes broches sont connectées à RX2 et TX2, D22 et D23.

J'ai environ 1,6 à 1,7 V provenant de la ligne CANH/CANL, donc je sais que ma connexion est bonne.

Des pensées?


ça marche pour moi j'ai eu le même problème c'était les broches Gpio 16 et 17 qui sont inversées sur le schéma donc pas de données.

merci beaucoup pour l'adie apporté et surtout pour ce programme

juste deux dernières questions.
1- mon onduleur solaire actuel considère la batterie comme un bien.
y aurait-il un moyen pour moi de le faire passer pour un pylontech car je pense que cela me permettrait d'avoir plus d'informations, nottement d'afficher la tension de chaque cellule

2- est-ce que quelqu'un sait comment modifier le programme pour qu'il diffuse en mqtt car je suis sous jeedom

MERCI
 

Attachments

  • tx rx gpio pin.jpg
    tx rx gpio pin.jpg
    166.8 KB · Views: 21
Google translate:
Hey

it works for me i had the same problem it was Gpio pins 16 and 17 which are reversed on the schematic so no data.

thank you very much for the adie brought and especially for this program

just two last questions.
1- my current solar inverter considers the battery as a good.
would there be a way for me to make it pass for a pylontech because I think it would allow me to have more information, in particular to display the voltage of each cell

2- does anyone know how to modify the program so that it broadcasts in mqtt because I am under jeedom

I have updated the pins on the diagram.
1) The beta version has the option to pick pylon, all the cell voltages are not sent to the inverter(not an option for protocol), just the max and min cells.

2) You can enable MQTT in the ESP code, it is not recommended or supported as the amount of data that needs to be sent over MQTT can cause the ESP to crash.
 
Last edited:
Back
Top