| Crates.io | a608_embedded |
| lib.rs | a608_embedded |
| version | 0.1.0 |
| created_at | 2026-01-04 17:00:23.3583+00 |
| updated_at | 2026-01-04 17:00:23.3583+00 |
| description | A no_std Rust library for interfacing with fingerprint sensors (R503, R307, AS608, ZFM-20) on embedded systems via UART |
| homepage | https://github.com/NightSling/a608_embedded_hal |
| repository | https://github.com/NightSling/a608_embedded_hal |
| max_upload_size | |
| id | 2022201 |
| size | 63,062 |
A no_std compatible Rust library for interfacing with fingerprint sensors (R503, R307, ZFM-20, etc.) on embedded systems using UART communication.
Add to your Cargo.toml:
[dependencies]
a608_embedded = "0.1.0"
embedded-hal = "1.0.0"
embedded-io = "0.7.1"
Basic usage pattern:
use a608_embedded::{FingerprintSensor, OK, NOFINGER};
// Create sensor with default password [0, 0, 0, 0]
let mut sensor = FingerprintSensor::new(uart, [0, 0, 0, 0]);
// Initialize sensor
sensor.init().unwrap();
// Capture fingerprint
loop {
if sensor.get_image().unwrap() == OK {
break;
}
}
// Convert to template
sensor.image_2_tz(1).unwrap();
// Search in database
if sensor.finger_fast_search().unwrap() == OK {
println!("Found finger ID: {}", sensor.finger_id);
}
new(uart, password) Create sensor with default address new_with_address(uart, addr, password) Create sensor with custom address init() Initialize and verify connection release() Release UART ownership
check_module() Check if sensor is responding verify_password() Verify password with sensor read_sysparam() Read system parameters set_sysparam(param, value) Set system parameter soft_reset() Perform soft reset
get_image() Capture fingerprint image image_2_tz(slot) Convert image to template (slot 1 or 2)
create_model() Create model from templates in slots 1 & 2 store_model(location, slot) Store template to flash memory load_model(location, slot) Load template from flash to slot delete_model(location) Delete template from flash empty_library() Delete all templates count_templates() Count stored templates read_template_page(page, bitmap) Read template bitmap for page
finger_search() Standard fingerprint search finger_fast_search() High-speed fingerprint search compare_templates() Compare templates in slots 1 & 2
get_fpdata(buffer, out) Download fingerprint data from sensor send_fpdata(data, buffer) Upload fingerprint data to sensor
set_led(color, mode, speed, cycles) Control LED state
finger_id Last matched finger ID confidence Last match confidence score template_count Number of stored templates library_size() Maximum library capacity data_packet_size() Current data packet size setting system_parameters() Full system parameters
OK (0x00) Success PACKETRECIEVEERR (0x01) Packet receive error NOFINGER (0x02) No finger detected IMAGEFAIL (0x03) Failed to capture image IMAGEMESS (0x06) Image too messy FEATUREFAIL (0x07) Failed to generate features NOMATCH (0x08) Fingerprints don't match NOTFOUND (0x09) No matching fingerprint found ENROLLMISMATCH (0x0A) Enrollment images don't match BADLOCATION (0x0B) Invalid storage location PASSFAIL (0x13) Password verification failed
See the examples/ directory for complete examples:
Sensor Pin MCU Pin
VCC (Red) 3.3V or 5V (check sensor specs) GND (Black) GND TX (Yellow) UART RX RX (Green) UART TX IRQ (Blue) Optional GPIO input (touch detection) 3.3V (White) 3.3V (for R503 LED power, optional)
Default UART settings:
MIT License
Copyright (c) 2024
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================================================