{"id":16162370,"url":"https://github.com/sunsided/serial-sensors-proto","last_synced_at":"2026-03-03T22:02:22.895Z","repository":{"id":246798089,"uuid":"823288141","full_name":"sunsided/serial-sensors-proto","owner":"sunsided","description":"A simple wire format for transmitting MEMS sensor data and friends","archived":false,"fork":false,"pushed_at":"2024-07-08T16:38:33.000Z","size":218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T08:33:55.945Z","etag":null,"topics":["embedded","protocol","rust","sensors"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/serial-sensors-proto","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunsided.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-EUPL","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,"publiccode":null,"codemeta":null}},"created_at":"2024-07-02T18:39:10.000Z","updated_at":"2024-07-08T16:38:36.000Z","dependencies_parsed_at":"2024-07-08T20:34:20.017Z","dependency_job_id":null,"html_url":"https://github.com/sunsided/serial-sensors-proto","commit_stats":null,"previous_names":["sunsided/serial-sensors-proto"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fserial-sensors-proto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fserial-sensors-proto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fserial-sensors-proto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fserial-sensors-proto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/serial-sensors-proto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241418356,"owners_count":19959736,"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","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":["embedded","protocol","rust","sensors"],"created_at":"2024-10-10T02:29:53.901Z","updated_at":"2026-03-03T22:02:22.852Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serial-sensors-proto\n\n\u003e A simple wire format for transmitting MEMS sensor data and friends.\n\n[![Crates.io][crates-image]][crates-link]\n[![Docs][docs-image]][docs-link]\n[![Build Status][build-image]][build-link]\n[![Safety Dance][safety-image]][safety-link]\n[![codecov][codecov-image]][codecov-link]\n![MSRV][msrv-image]\n[![EUPL 1.2 licensed][license-eupl-image]][license-eupl-link]\n\nThe approach is twofold:\n\n- The protocol is a little bit extensible in sensor and data types and supports 1-, 3- and 4-dimensional readings.\n- Data packets are serialized using [bincode](https://crates.io/crates/bincode) first, then byte-stuffed\n  using [corncobs](https://crates.io/crates/corncobs) (i.e. using Consistent Overhead Byte Stuffing, COBS).\n\nOn the receiving end, the entire process runs in reverse.\n\nApart from supporting some generic sensor types such as accelerometers, magnetometers, gyroscopes etc.,\nthe format has some capabilities for self-description. If implemented, the sensor maker and name, as well as linear\nnormalization factors can be sent over the wire once or periodically, allowing for automatic and sensor-agnostic\nconversion on the host.\n\n---\n\nSee [stm32f3disco-rust](https://github.com/sunsided/stm32f3disco-rust)\nand [serial-sensors](https://github.com/sunsided/serial-sensors)\nfor an example. Here's an example screenshot from that project, showing sensor data as it streams in:\n\n![An example output from serial-sensors TUI](https://raw.githubusercontent.com/sunsided/serial-sensors/0d508a05291f4f7ca1f014dbd6de228dd9e03413/readme/picture.jpg)\n\nThe device-side code can be as simple as this:\n\n```rust\nfn example() {\n    let value = AccelerometerI16::new(Vector3Data { x: 1, y: -2, z: 3 });\n    let frame = Version1DataFrame::new(u32::MAX, 12, 0, value);\n\n    // Serialize into a transmit buffer.\n    let mut buffer = [0_u8; 48];\n    let buffer = serialize(frame, \u0026mut buffer).unwrap();\n    assert_eq!(buffer.len(), 21);\n\n    // ... send the buffer over the wire ...\n\n    // Deserialization the received buffer.\n    let data = deserialize(buffer).unwrap();\n    assert_eq!(data.version, Version1);\n    assert_eq!(data.data.global_sequence, u32::MAX);\n    assert_eq!(data.data.sensor_sequence, 12);\n    assert_eq!(data.data.sensor_tag, 0);\n\n    let data: AccelerometerI16 = data.try_into().unwrap();\n    assert_eq!(data.x, 1);\n    assert_eq!(data.y, -2);\n    assert_eq!(data.z, 3);\n}\n```\n\n[crates-image]: https://img.shields.io/crates/v/serial-sensors-proto\n\n[crates-link]: https://crates.io/crates/serial-sensors-proto\n\n[docs-image]: https://docs.rs/serial-sensors-proto/badge.svg\n\n[docs-link]: https://docs.rs/serial-sensors-proto/\n\n[build-image]: https://github.com/sunsided/serial-sensors-proto/workflows/Rust/badge.svg\n\n[build-link]: https://github.com/sunsided/serial-sensors-proto/actions\n\n[safety-image]: https://img.shields.io/badge/unsafe-optional-success.svg\n\n[safety-link]: https://github.com/rust-secure-code/safety-dance/\n\n[msrv-image]: https://img.shields.io/badge/rustc-1.71+-blue.svg\n\n[license-eupl-image]: https://img.shields.io/badge/license-EUPL_1.2-blue.svg\n\n[license-eupl-link]: https://github.com/sunsided/serial-sensors-proto/blob/develop/LICENSE-EUPL\n\n[embedded-hal]: https://docs.rs/embedded-hal/\n\n[codecov-image]: https://codecov.io/gh/sunsided/serial-sensors-proto/graph/badge.svg?token=ysTw27B78y\n\n[codecov-link]: https://codecov.io/gh/sunsided/serial-sensors-proto\n\n[cc]: https://contributor-covenant.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fserial-sensors-proto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Fserial-sensors-proto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fserial-sensors-proto/lists"}