diy solar

diy solar

For those of you looking to monitor your ANT-BMS with Pi3 via Bluetooth.

Yep my MPP LV5048 is connected to the same Pi3 via USB to Serial converter. I use jbalance's package to pickup the data and send to Influx. I also have a couple of Epever Triron3210N's I pull data over the RS-485 to Wi-fi boxes (ebox-wifi-01) for those I use 1st gen Pi with Ethernet connected and wi-fi USB adapter connected to the charge controller.
 
Is there any possibility of getting the data from the ANT BMS onto the rPi via a wired connection?
 
It might be possible, but would involve de-soldering the bluetooth chip and connecting a Serial TTL device.
1588856223401.png


The other BMS I have is a JBD based. It has the module external so its easy to unplug and connect the serial device to TX RX and Ground.1588855927542.png
 
would involve de-soldering the bluetooth chip and connecting a Serial TTL device.
Eh, not worth it then. What I have in mind would put the Pi in easy cable distance from the BMS, and wired connections tend to be more reliable, but... The concept for the system is coming together nicely, now to convince the CFO...
 
Great! Thanks for this guide - going to try and set this up tonight.

With regards to a wired connection, would it not be possible to use a serial TTL connection going to the display port? It's got TX RX VCC and GND? Guess the trouble would be if it uses the same info format as the bluetooth chip?

It would also be useful to modify your python code to instead use MQTT for sending info - can then easily be integrated with programs like Home Assistant for controlling multiple things based on battery info.
 
Okay, so finally got this working (spent most of the weekend learning how to code python!) Basically I couldn't get node-red to run the files because it's installed in a docker container. I'm sure there is a way - I couldn't find it. So instead I changed your program to post the values to MQTT. I still need to add it as a service and figure out how to connect to bluetooth on startup, but this is running well so far. I also added some error handling as I now run it on a 5 second loop and somehow it gets dodgy data every couple of hours and was crashing.

I've attached my file - you'll need to edit it for your MQTT server settings. I'm sure there are lots of things that could be done better... learning here! You'll also need to install paho mqtt for python 2.7.
 

Attachments

  • getbms-ant_mqtt-example.txt
    4.4 KB · Views: 279
This is great! I've managed to get hold of the address codes for a Renogy DCC50S as the comms port is RS485. My plan was to pull the stats, pub to MQTT and put into HA/Grafana. Ive setup HA, nodered and MQTT, am currently testing the RS485 connection and this is the next step. Thank you!!
 

Part 1 finished today. Working on Part 2.
Great project... was exactly what I was looking for to get my bms data online... Thanks for sharing! I was running a nissan leaf battery at 6P14S with just the single bms for the whole battery, and no remote monitoring... I now have a single bms running on 14s am planning on converting the rest of my cells to series with 6 separate bms.. the remote monitoring now is great for peace of mind... and not having to make a trip into my power shed to use my phone to log into the bluetooth... every other function in my power shed has been online for a while now.. the bms is the last to go...
curious... has anyone figured out the checksum calculation that is being used on these frames... or have some documentation that covers that
I have tried the typical modbus 16bit crc but doesn't seem to be it...
 
I also tried to calculate the CRC but without success.
Here are some links I have around :

Did anyone success with the AntBMS checksum protocol?

Here are some packets:

AA55AAFF021D102A102A1027102A102A1028102810281026102910281029102C00000000000000000000000000000000000000000000000000000000000000000000000000000000000064025317C0025306110008C78E0008572000150015001400140014001401010003E8001701000000000D102C09102610280D00000073006F02A70000000011620B00
AA55AAFF021D102A102A1027102A102A1028102810281026102910281029102C00000000000000000000000000000000000000000000000000000000000000000000000000000000000064025317C0025306100008C78E0008572100150016001400140014001401010003E8001701000000000D102C09102610280D00000073006F02A70000000015620B00
AA55AAFF021D102A102A1027102A102A1028102810281026102910281029102C00000000000000000000000000000000000000000000000000000000000000000000000000000000000064025317C0025306110008C78E0008571F00150016001400140014001401010003E8001701000000000D102C09102610280D00000073006F02A7000000000D620B00
 
Okay, so finally got this working (spent most of the weekend learning how to code python!) Basically I couldn't get node-red to run the files because it's installed in a docker container. I'm sure there is a way - I couldn't find it. So instead I changed your program to post the values to MQTT. I still need to add it as a service and figure out how to connect to bluetooth on startup, but this is running well so far. I also added some error handling as I now run it on a 5 second loop and somehow it gets dodgy data every couple of hours and was crashing.

I've attached my file - you'll need to edit it for your MQTT server settings. I'm sure there are lots of things that could be done better... learning here! You'll also need to install paho mqtt for python 2.7.
This is nice. I'm adopting it and I'll edit it to also post to emoncms.

Run it as service with option of restart. That way if it fails because Bluetooth is down, the service manager, systemd, will always restart it. I can help with that.
 
This is great Chad. I was able to get this mostly working with my AntBMS. I have a 24V system, so I've made a few changes to accommodate.
However, for some reason, my col1 (SoC) always reads 0. The value gets printed when I run from terminal, but doesn't seem to be getting to the database.

Also, I have 4 battery packs, each with a BMS, Do you think I could manage from one RaspberryPi? Can you provide some info on how you added the additional BMSs in your code.

Thanks
 
Chad, Again... This is fantastic.
Thanks for the help... It helped immensely in getting a set-up working on one of my AntBMS.
My next step is to get it working with all 4 of my AntBMS. Since it looks like you have a system working with 3 BMSes, It would be great if you could provide info on your set-up:
Like... When you switch between BMS'es, did you do it in Node-RED or in your python script? Are you using a different database for each BMS, or just adding data from each to a single database. also, did you need to build in delays to accommodate the switching? any info on your multi-BMS set-up would be appreciated.

Thanks
 
Hi all, Chad used parts of the code I wrote and posted in GitHub. https://github.com/juamiso/ANT_BMS

I have the ANT BMS running since July 2019 in combination with a Raspi 3B+ connected via Bluetooth. It is pretty robust I must say! Via the python control script the Raspi sends the data I want to log directly to an influxdb server (local network but running in another computer). And this other computer runs grafana and I can monitor from anywhere very useful stuff. See:

1606128379440.png
1606128460401.png
1606128706806.png
 
Hi Juanmax,

I have had a Raspberry pi 3B+ connected to my four LV2424s and a separate one connected to one of my four AntBMSes for the last two months. I've also found it to be very robust.
,
Thanks for your effort on this if it's the basis for what Chad had done.

My next step is to get all 4 of my Ant BMSes connected to the Raspberry Pi. I was wondering if all 4 BMSes can be bound to the Pi at the same time and if there are any issues switching between them to populate the dadabase. I've read about many people having issues binding multiple BT devices. Just trying to avoid pitfalls other have solved for.

Thanks
 
How do you connect the bms? I am not asked for my password:

[bluetooth]# pair AA:BB:CC:B1:23:45
Attempting to pair with AA:BB:CC:B1:23:45
Failed to pair: org.bluez.Error.ConnectionAttemptFailed
 
ok. it works, but connect not

info AA:BB:CC:B1:23:45
Device AA:BB:CC:B1:23:45
Name: BMS-ANT20S
Alias: BMS-ANT20S
Class: 0x001f00
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Serial Port (00001101-0000-1000-8000-00805f9b34fb)


connect AA:BB:CC:B1:23:45
Attempting to connect to AA:BB:CC:B1:23:45
Failed to connect: org.bluez.Error.Failed
 
Back
Top