GithubHelp home page GithubHelp logo

Comments (6)

livello avatar livello commented on June 16, 2024

@TioRuben trying to understand how your code works. As I understand it, the blue tooth does not display messages about the connection status to AntBMS. Moreover, I did not quite understand how the data that comes with the BMS is used.

from vedirect-antbms.

TioRuben avatar TioRuben commented on June 16, 2024

@livello Sorry, surely I must update README for the code to be more understandable. Let me explain what I've done:

  • I've a setup with two Victron MPPTs and a AntBMS BMS to charge an 18650 battery pack in 7s50p configuration with solar power
  • I'd like to monitor everything with EmonCMS

So I've mounted an ESP32 configured with Serial1 and Serial2 connected to VE Direct ports from MPPT. Serial 0 kept for debugging. Bluetooth is configured in "classic" mode to read data from AntBMS Bluetooth classic serial port. The code is pretty much inspired from the BT Classic example of Espressif. It connects to bluetooth device, sets the PIN and connects to SPP service on the BMS. If you connect to this service, then you can send the "magic word" (0xDB, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0A) and the bms responds with a data packet, containing all useful information (temperature, battery voltages, SOC and so on).

First of all, maybe the manufacturer has changed some of his parameters (usually the bluetooth address is the one in the configuration for all the bms). Then you can try with some Android app to connect to SPP service and send the magic word this app can send messages in hex format. If it replies with some information (unintelligible for humans), then the BMS can be compatible with my code. If it doesn't, the BMS will be incompatible with my code.

If the magic word works, maybe is a connection issue. In the first tests of my code, I encountered the problem that ESP needs to be really really close to the BMS (no more than two/three meters away), if not, the connection fails.

If anything of above works, try to run just only the bluetooth portion of code, and add some printfs after this line printf("%s",bmsData); If it doesn't print anything, add some more printfs inside the gapCallback and sppCallback methods, inside of each case statement, and see if it tries to connect to BMS.

Finally, I see the your BMS is 17-24, mine is 7-16, so maybe the data packet changes. If you get action inside SPP callback, but don't get any bmsData, try to debug this method to see if the packet comes in different format.

Hope this helps with your project, regards

from vedirect-antbms.

livello avatar livello commented on June 16, 2024

@TioRuben Thank you very much for such a comprehensive answer!
I managed to connect to AntBMS and even get the status once. After that, the connection is terminated and a reboot is required to reconnect.

`W (5303) BT_APPL: new conn_srvc id:26, app_id:1

"C":15,"SOC":100,"BV":502,"BI":0,"P":0,"TM":26,"TB":27,"T1":26,"T2":25,"V1":3332,"V2":3333,"V3":3332,"V4":3332,"V5":3333,"V6":3559,"V7":3333,"V8":3332,"V9":3332,"V10":3332,"V11":3333,"V12":3333,"V13":3333,"V14":3334,"V15":3334,"V16":3328,"AT":15000000,"AR":14802734,"AC":2563169,"T3":25,"T4":25,"VMX":3559,"VMN":3332,"VMD":3347,"CHGS":1,"DCHS":1,"BALS":0

W (5933) BT_APPL: bta_jv_rfc_port_to_cb(port_handle:0x2):jv handle:0x0 not FOUND

W (5943) BT_RFCOMM: port_rfc_closed RFCOMM connection in server:0 state 3 closed: Closed (res: 19)
`

I forked your code and made some experiments 5d0ae4b

from vedirect-antbms.

livello avatar livello commented on June 16, 2024

esp_spp_disconnect(param->data_ind.handle);

I commented this line. Instant blackouts are gone. But I can not get the information from the bms again. Single reading only.

I experimented with resending the magic word. But it was not possible to receive a repeated response from the BMS.
e3049d2

from vedirect-antbms.

livello avatar livello commented on June 16, 2024

I've found 2 more magic words that works for my bms:
livello@faf7251

There is the project for raspberry pi.
I've one. I'm going to check it:
https://github.com/JohnBerg60/bms-mqtt-broker/

from vedirect-antbms.

livello avatar livello commented on June 16, 2024

https://github.com/JohnBerg60/bms-mqtt-broker/ works like a charm with my antbms! Having raspi 4 or even a notebook for control charge and monitoring status is overkill.

image
image
image
image

from vedirect-antbms.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.