{"id":28499501,"url":"https://github.com/hacknus/acs37800-rs","last_synced_at":"2025-08-25T07:33:26.699Z","repository":{"id":215447458,"uuid":"738963822","full_name":"hacknus/acs37800-rs","owner":"hacknus","description":"Platform-agnostic rust driver for the ACS37800 current sensor.","archived":false,"fork":false,"pushed_at":"2024-03-08T06:27:14.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T14:44:50.725Z","etag":null,"topics":["acs37800","driver","embedded","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hacknus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-04T13:06:40.000Z","updated_at":"2024-01-04T13:08:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ed8925c-4412-4bf5-9a91-703681aa0339","html_url":"https://github.com/hacknus/acs37800-rs","commit_stats":null,"previous_names":["hacknus/acs37800-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hacknus/acs37800-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknus%2Facs37800-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknus%2Facs37800-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknus%2Facs37800-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknus%2Facs37800-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hacknus","download_url":"https://codeload.github.com/hacknus/acs37800-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknus%2Facs37800-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272024578,"owners_count":24860528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acs37800","driver","embedded","rust"],"created_at":"2025-06-08T14:36:29.825Z","updated_at":"2025-08-25T07:33:26.660Z","avatar_url":"https://github.com/hacknus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ACS37800 Rust Driver\n\n[![crates.io](https://img.shields.io/crates/v/acs37800.svg)](https://crates.io/crates/acs37800)\n[![Docs](https://docs.rs/acs37800/badge.svg)](https://docs.rs/acs37800)\n[![Rust](https://github.com/hacknus/acs37800-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/hacknus/acs37800-rs/actions/workflows/rust.yml)\n\nThis is a platform-agnostic rust driver for the [ACS37800](https://www.allegromicro.com/en/products/sense/current-sensor-ics/zero-to-fifty-amp-integrated-conductor-sensor-ics/acs37800) current sensor.  \nFully supported in `#![no_std]` environments.\n\nFeatures:\n- [X] test DC mode\n- [X] test averaging  \n\nTODO:\n- [ ] test AC mode\n- [ ] over/under voltage\n- [ ] phase delay\n- [ ] flags\n\n## Example\nTo implement this driver, consult the example:  \nPut this into your `cargo.toml`:\n```toml\n[dependencies]\nacs37800 = { git = \"https://github.com/hacknus/acs37800-rs\" }\n# required for the register configs to_u32_le() function\nmodular-bitfield-to-value = {git = \"https://github.com/hacknus/modular-bitfield-to-value\"}\n```\nAdd the following imports:\n```rust\nuse acs37800::registers::*;\n\n// required for the to_u32_le() function.\nuse modular_bitfield_to_value::ToValue;\n```\n\nConfigure the I2C bus in the `main()` function as follows:\n```rust\nlet scl = gpiob.pb6;\nlet sda = gpiob.pb7;\nlet i2c1 = dp.I2C1.i2c(\n    (scl, sda),\n    i2cMode::Standard {\n    frequency: 100.kHz(),\n    },\n    \u0026clocks,\n);\n```\nand to use the driver, implement the driver as shown below:\n```rust\n{\n\n    // set up current sensor in DC mode with averaging and certain gain\n    let mut current_sensor = Acs37800::new(i2c, 96)\n        .with_r_iso(1_000_000)\n        .with_r_sense(16_900);\n    acs37800.set_oversampling_1(122);\n    CurrentTask::delay(Duration::ms(100));\n    acs37800.set_oversampling_2(512);\n    CurrentTask::delay(Duration::ms(100));\n    acs37800.set_dc_mode(511);\n    CurrentTask::delay(Duration::ms(100));\n    acs37800.set_gain(7);\n    CurrentTask::delay(Duration::ms(100));\n    acs37800.select_i_and_p_avg();\n    CurrentTask::delay(Duration::ms(100));\n    \n    loop {\n        let voltage = acs37800.get_voltage_rms();\n        let current = acs37800.get_current_avg_1_sec();\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknus%2Facs37800-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhacknus%2Facs37800-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknus%2Facs37800-rs/lists"}