Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANT BMS integration #5

Closed
6 tasks done
Louisvdw opened this issue Feb 4, 2021 · 95 comments · Fixed by #37
Closed
6 tasks done

ANT BMS integration #5

Louisvdw opened this issue Feb 4, 2021 · 95 comments · Fixed by #37
Labels
enhancement New feature or request

Comments

@Louisvdw
Copy link
Owner

Louisvdw commented Feb 4, 2021

Add the ANT-BMS communication to the driver.

  • SOC
  • Battery voltage
  • Charge/discharge current
  • Temprature
  • Min/max cell voltages
  • protection notifications
@Louisvdw Louisvdw added the enhancement New feature or request label Feb 4, 2021
@osantiano
Copy link

Would be great !

@JBecker32
Copy link
Contributor

Would like to see that too :-))

@pahorpet
Copy link

Hi, any news here?

@Louisvdw
Copy link
Owner Author

I have not started to look at the ANT BMS. I don't have an example of the BMS to do testing with and all other users that has one does not seem to be able to connect the BMS to their controllers or PC. If we can solve that it should be fairly simple as the ANT protocol is about 90% to what we use for the LLT/JBD BMS already.

I'm looking for anyone that can help as a sponser for hardware I can do test with.
Or if anyone has their ANT connected to a Pi or GX and is wiling to help with testing and technical debugging.

@JBecker32
Copy link
Contributor

Hi, any news here?

does your ANT BMS have a free serial interface? I have two of them but the serial is occupied by the internal BT module. The only external interface is that for the display.

@pahorpet
Copy link

Hi, any news here?

does your ANT BMS have a free serial interface? I have two of them but the serial is occupied by the internal BT module. The only external interface is that for the display.

300A version what I have have it the same, I have just ordered 450A version, so 7 days delivery, mean next week I should be able to check it.

@JBecker32
Copy link
Contributor

I will check the function of the display interface when I'm home after holidays in two weeks.

@liufuyang
Copy link
Contributor

Hi there. Looking forward to this. I am very new to the solar/battery business and I am waiting the ANT BMS and raspberrypi to arrive, perhaps later I can help give some tests. I currently have a victron mppt 100V/30A and it works well to a small bluetti power station and I am waiting to get the ANT BMS to build my own LTO battery pack, and I hope later it can be all wired onto the victron VRM page via the raspberrypi.

Also, I saw some of the BMS (like this MGod one) saying they have the so called UART/RS485 connection port. Does that means as long as a BMS having this type of connections then we can use this driver to connect it to VenusOS?

Thank you and sorry for asking so many questions :)

@Louisvdw
Copy link
Owner Author

@liufuyang if the BMS has a UART, RS485 or other serial connection port that only mean you can connect it to another device via that serial port for communication. But unfortunately each manufacturer implement their own protocol.
So to make a new BMS work with this driver we first need to write the code to implement their protocol and commands.

@liufuyang
Copy link
Contributor

I see. Thank you for the info. I asked the seller of the MGod BMS and they say Daly is their cooperating entity so I guess it will probably work. While I am waiting for the Ant to arrive I will just order a MGod as well as I feel they having a better service than Daly on aliexpress. Will probably get it after a month and if I ever test it I will let you know how it goes :)

@pahorpet
Copy link

I have not started to look at the ANT BMS. I don't have an example of the BMS to do testing with and all other users that has one does not seem to be able to connect the BMS to their controllers or PC. If we can solve that it should be fairly simple as the ANT protocol is about 90% to what we use for the LLT/JBD BMS already.

I'm looking for anyone that can help as a sponser for hardware I can do test with.
Or if anyone has their ANT connected to a Pi or GX and is wiling to help with testing and technical debugging.

Finally I am ready to test. ANT BMS connected via serial display interface to USB I have rpi to on.

@osantiano
Copy link

This guy did some work on ANT: https://github.com/juamiso/ANT_BMS (via Bluetooth)

@pahorpet
Copy link

An news here? I am ready to do some testing

@Louisvdw
Copy link
Owner Author

An news here? I am ready to do some testing

Hi @pahorpet. I need to finish a few pieces of work. I'll get a script to you to test as soon as I can.

@JBecker32
Copy link
Contributor

Hi Louis, you can send it to me too for testing. I still have the ANT lying around ....

@Louisvdw
Copy link
Owner Author

@pahorpet @JBecker32
I created a branch with the first changes to test the ANT.
Give it a test and see if you get a response. It should read the SOC, Voltage and Current.

@pahorpet
Copy link

pahorpet commented Aug 17, 2021 via email

@liufuyang
Copy link
Contributor

liufuyang commented Aug 18, 2021

My ANT bms should soon arrive today or tomorrow as well. I would like to help give it a test as well but I haven't installed our driver/plug-in before, so all I need is to follow the installation doc and see how to test that branch @Louisvdw mentioned above? And what do you mean by it should read "SOC, V, A", where do I expected to see the readings? (From some logs via ssh into Venus OS or they will already show up on Victron VRM pages?)

I am not sure yet how to test a branch but I guess one could ssh into Venus OS (just tried this earlier and it works) and would it be possible to install git there and pull this code directly to some directory to install the pulg in(like restarting the system to trigger it)?

@Louisvdw
Copy link
Owner Author

The best would be to follow the install steps to install an released version first. This will set everything up and set the file permissions.
Then you can copy the files from the branch over the existing install. You only need to update the *.py files in the dbus-serialbattery/etc/dbus-serialbattery/ directory. All the other files and folder does not change.

If it all works, then the battery will show up in the Remote Console of your GX device and SOC, V and A will be displayed. If not then look at the log files. See the troubleshoot section in the wiki.

@liufuyang
Copy link
Contributor

liufuyang commented Aug 18, 2021

Thank you. Sounds like something I can try. Do you or @JBecker32 @pahorpet perhaps knows how to wire the ANT BMS's serial display interface (4 pin or?) to the RS485->USB cable? I guess that is the suggested way to connect? The RS485->USB chip I have around is this one - which I used now to wire a Victron solar charger to Raspberry Pi and it works well. Do you know which pin on the BMS board is Rx/Tx/Gnd and so on? I am a bit unsure how to wire the BMS to the Raspberry Pi yet :)

@JBecker32
Copy link
Contributor

My ANT BMS has no RS485! The display interface you mention is certainly not RS485, but UART with 5V or even 3.3V level. An RS485<->USB adapter will not work!
This is the problem with the ANT, that it has no dedicated (wired) interface for such things like we want to do ... (and atm this is what also prevents me from trying the new code :-(()

@pahorpet
Copy link

So I give it a try today but without succes I was trying to install from USB, so put in the root folder and place in cerbo gx. And after connect the usb from BMS I have got but disconnect 5V. So I will give it another try next week again.

@liufuyang
Copy link
Contributor

I see. Sorry I mixed with RS485 with UART. The device I have at hands are these https://www.amazon.se/gp/product/B07TFSZ3ZP, so perhaps they are UART to USB? I used them on Victron Solar charger and it can connect. So perhaps Victron Solar charger has a UART output?

@liufuyang
Copy link
Contributor

liufuyang commented Aug 18, 2021

I still have some question for the installation process.

  1. Are we sure now that we will have to use an external USB stick to do this (on Raspbery Pi in my case)? If ssh login and downloading files can install the plugin then it would be perfect for me. In that case please neglect the question below.
  2. (As I can only find one USB stick around me, which has some files and movies saved in it) Does it require the USB stick to be formatted in some special format? I think the only USB storage I have now is used previously with Windows machines before (it has NTFS format), as when I just mount it on my Mac now I seem cannot write but only able to read from it. Perhaps I need to reformat it into something else or?

I tried to note down a few steps I will do later when the BMS arrives (also if I could somehow figure out how to wire the BMS to the Raspberry PI). Perhaps someone of you can check steps like these will install the plugin successfully?
liufuyang#1

And I actually also just tried those steps on the Venus OS (or Raspberry Pi) and also tried to restart the device. How can I check whether this plugin is loaded by the os? Is there some sort of logs I can use for verify?

I can see this file link is created, perhaps that means it is installed properly?

ls -al  /opt/victronenergy/dbus-serialbattery
lrwxrwxrwx    1 root     root            28 Aug 18 19:46 /opt/victronenergy/dbus-serialbattery -> /data/etc/dbus-serialbattery

Thank you :)

Ah... I missed the troubleshoot page... Let me see...

I can see our plugin is not mentioned in the file /data/log/serial-starter/current for me yet. Looks like now I just need to wait to test this until the BMS arrive and somehow wire it to the USB.

@JBecker32
Copy link
Contributor

JBecker32 commented Aug 18, 2021

I tried to understand the display interface of the ANT today, spying on the receive and transmit lines, but without success. This is certainly not using the documented ANT serial format. So for now I'm out as I do not have an ANT BMS with UART or RS485 interface ...

@Louisvdw
Copy link
Owner Author

That seem to be the problem with the ANT. To get a USB->serial connection to the BMS.

@langepil
Copy link

langepil commented Aug 19, 2021

I'm really not a professional, but is the USB Adapter for PC possibly the solution?

https://de.aliexpress.com/item/32826820690.html

I have such one at home, but unfortunately currently less time to test.

@Louisvdw
Copy link
Owner Author

That USB adapter for PC will work, yes. But it seems that most ANT BMS does not come with the required connection to use that adapter.

@pahorpet
Copy link

pahorpet commented Aug 25, 2021

I implement notification (alarms) also some history information like total Ah drawn and cycles as well. For me is now working great. if anything still missing what is nice to have I still can implement it. Sorry for zip I don't have git installed here.
The only ANT is active in this file
dbus-serialbattery.zip

@pahorpet
Copy link

Hi, so today I was able to test full charging and the limit CCL was changed but the system styl charging faster, do I have wrong setting?

@Louisvdw
Copy link
Owner Author

What are you CCL set at and what charge value do you see?
Do you have DVCC on?
image

And can you send a picture of your charge/discharge graph from VRM
image

@pahorpet
Copy link

Here is the screen shot.
the current was always more than 100A than it was killed by battery protection of high voltage.

2021-08-25_16h17_30
2021-08-25_16h18_47
2021-08-25_16h19_59

@Louisvdw
Copy link
Owner Author

You should normally switch SVS and STS Off. Except if you have extra voltage/temp measures. But that is not your issue.

Your CCL is at 200A and is set at 200A.
Your DCL is at 360A and is set at 360A.
So both of these are fine according to your settings. Did you expect another value?

@pahorpet
Copy link

pahorpet commented Aug 25, 2021

CCL is set to 2A as seen from graph but the charging is still 121-> over the limit, as well the voltage CVL 55.2 but on that point was 55.25. So it is charging maximal current possible til reach overvoltage protection in BMS it self and BMS shut it down
Screenshot_20210825-211455_Samsung Internet

You can see current voltage and limits at 16:02

@Louisvdw
Copy link
Owner Author

Louisvdw commented Aug 25, 2021

The current drops of just after 16:02. There is some delay for the inverter/charger to get to the setting when it is set. The inverter/charger does a ramp up/ ramp down to get to where it want to be.
For this reason I coded to Charge Current Control with an earlier clamp and also with smaller currents than your settings. I suggest you try is with my settings and see if it is better.
Remember that Lithium cells spike fast when they are full. That will pull the SOC up to 99% or 100% fast.
This will be when protection kicks in.

@pahorpet
Copy link

pahorpet commented Aug 25, 2021 via email

@Louisvdw
Copy link
Owner Author

I created a beta release 06.beta2 that include the ANT-BMS

@pahorpet
Copy link

pahorpet commented Aug 25, 2021 via email

@pahorpet
Copy link

pahorpet commented Aug 26, 2021 via email

@Louisvdw
Copy link
Owner Author

@pahorpet, what is the setting on your GX for the Battery Monitor? Can you see that the serial battery is selected?
The driver is doing it's job. It is posting the values and making the CCL changes. The issue has to be with a setting in your ESS setup if it is not reacting to that.
image

@pahorpet
Copy link

pahorpet commented Aug 28, 2021 via email

@Louisvdw
Copy link
Owner Author

Don't run it on VenusOS 2.8 yet. I will have to test and make some adjustments before it will run on V2.80 as some of the structures has changed and the file system is now read only as well

@pahorpet
Copy link

pahorpet commented Aug 30, 2021 via email

@pahorpet
Copy link

pahorpet commented Sep 9, 2021

Will it work to directly connect ANT to VE.Direct as it is 5V it should be working right, just connect TX,rx,Gnd. What device than it should be used instead of ttyUSB?

@Louisvdw
Copy link
Owner Author

VE.Direct is RS232 based, so you should be able to link it directly with a cable if the display out is also R232. I went through the thread and I could not find what the end result was if it is RS485 or RS232?
Just remember the do you cable as:
Gnd <--> Gnd
RX <--> TX
TX <--> RX
It will be picked up as a tty port, but not the ttyUSB (the name depends on how the Cerbo is configured internally), but all the settings is already configured so that the driver will pick up the VE.Direct port as well. You will see the port in the battery's Device -> Connection in Remote Console

@pahorpet
Copy link

pahorpet commented Sep 10, 2021 via email

@pahorpet
Copy link

pahorpet commented Oct 3, 2021 via email

@Louisvdw
Copy link
Owner Author

Louisvdw commented Oct 4, 2021

You can use dmesg to see the details of the last device you connected. So after you plug in the cable, run dmesg. The last would tell you what tty device was just connected too.

You can then look at the log for serial-starter and also dbus-serialbattery for that port.

@pahorpet
Copy link

Hi all, have anyone fighting with precision of SOC? After 100% charge is ok and it can go to zero, 3.05-3.50. But when im few days cycling in 30-60% the bms soc shows more than actual. When voltage already, drop to 3.05V it still show more SOC. I have calibrate the current se zor by external measurement to fit, but still the calculating is wrong, any idea? Thx

@Louisvdw
Copy link
Owner Author

It seems that many ANT users are struggling to connect the ANT to a GX device to get the driver running. Does anyone have some pictures about the wire connections and the details about which chip/cable works well that I can use to create a guide with?

@pahorpet
Copy link

pahorpet commented Nov 25, 2021

Sorry for long delay, the communication works well with official usb-ttl, also tested with ch340. Working well.
But bms need an external 5V to activate the communication, so cannot be directly connected to VE-direct

@pahorpet
Copy link

Wrong SoC reading of ANT BMS. The current is calibrated. But SoC is drifting during a time. Has anyone tested and had some setting that is running well?

@rdaguerre
Copy link

this repo work very well with AntBMS old version via UART display port <2021
https://github.com/syssi/esphome-ant-bms

@trisuliswanto
Copy link

ch change do you mention? (For me it is working the way I send it in the .zip)
Yes, sign of battery current is possibly 'wrong'. (BMS shows that Battery is delivering positive current when it is discharged. For the System view, battery current has opposite sign). Is easily changed in the driver.
For all the bitwise things I am to stupid to ma

Hi could you send me the PC software, I need the PC software,
3sulis12@gmail.com
or could you reupload it? because the link is broken.. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants