batteread

Crates.iobatteread
lib.rsbatteread
version
sourcesrc
created_at2024-10-18 20:45:36.187053
updated_at2024-10-18 20:45:36.187053
descriptionRead status data from certain models of LiFePO4 Battery Management Systems over Bluetooth Low Energy. Tested with a battery made by li-gen.net.
homepage
repositoryhttps://github.com/felixwatts/batteread
max_upload_size
id1414818
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Felix Watts (felixwatts)

documentation

README

Batteread

Read status data from certain models of LiFePO4 Battery Management Systems over Bluetooth Low Energy

Tested with a 400ah 24v battery manufactured by https://www.li-gen.net/ and sold around the year 2022.

The BMS has a BLE interface. On top of that the NordicUART protocol is used for serial communication. On top of that there seems to be a proprietary request-response protocol which I have attempted to partially reverse engineer.

Currently the following data can be accessed:

  • State of charge (%)
  • Residual capacity (Ah)
  • Cycles (count)
  • Cell voltages (v)
  • Battery voltage (v)

Example

# use std::time::Duration;
#
# #[tokio::main]
# pub async fn main(){
    let mut battery_client = batteread::BatteryClient::new_default_name().await.unwrap();
    loop {
        let battery_state = battery_client.fetch_state().await.unwrap();
        println!("{battery_state:?}");
        tokio::time::sleep(Duration::from_secs(5)).await;
    }
# }
Commit count: 78

cargo fmt