a608_embedded

Crates.ioa608_embedded
lib.rsa608_embedded
version0.1.0
created_at2026-01-04 17:00:23.3583+00
updated_at2026-01-04 17:00:23.3583+00
descriptionA no_std Rust library for interfacing with fingerprint sensors (R503, R307, AS608, ZFM-20) on embedded systems via UART
homepagehttps://github.com/NightSling/a608_embedded_hal
repositoryhttps://github.com/NightSling/a608_embedded_hal
max_upload_size
id2022201
size63,062
Sushant Pangeni (NightSling)

documentation

https://docs.rs/a608_embedded

README

================================================================================ A608 Embedded Fingerprint Sensor no_std Rust Library

A no_std compatible Rust library for interfacing with fingerprint sensors (R503, R307, ZFM-20, etc.) on embedded systems using UART communication.

================================================================================ FEATURES

  • Full no_std support for embedded systems
  • Zero heap allocation - uses fixed-size buffers
  • Generic over any UART implementation using embedded-io traits
  • Complete fingerprint sensor protocol implementation
  • Support for R503 LED control

================================================================================ SUPPORTED SENSORS

  • R503 (with LED control)
  • R307
  • ZFM-20
  • AS608
  • Other compatible sensors using the same UART protocol

================================================================================ DEPENDENCIES

Add to your Cargo.toml:

[dependencies]
a608_embedded = "0.1.0"
embedded-hal = "1.0.0"
embedded-io = "0.7.1"

================================================================================ QUICK START

  1. Create a UART instance for your platform
  2. Create a FingerprintSensor with the UART and password
  3. Call init() to verify connection and read system parameters
  4. Use the sensor methods to capture and match fingerprints

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);
}

================================================================================ API REFERENCE

INITIALIZATION

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

SYSTEM COMMANDS

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

FINGERPRINT CAPTURE

get_image() Capture fingerprint image image_2_tz(slot) Convert image to template (slot 1 or 2)

TEMPLATE MANAGEMENT

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

FINGERPRINT MATCHING

finger_search() Standard fingerprint search finger_fast_search() High-speed fingerprint search compare_templates() Compare templates in slots 1 & 2

DATA TRANSFER

get_fpdata(buffer, out) Download fingerprint data from sensor send_fpdata(data, buffer) Upload fingerprint data to sensor

LED CONTROL (R503 only)

set_led(color, mode, speed, cycles) Control LED state

PROPERTIES

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

================================================================================ ERROR CODES

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

================================================================================ EXAMPLES

See the examples/ directory for complete examples:

  • examples/esp32_example.rs - ESP32 using esp-hal
  • examples/stm32_example.rs - STM32 using stm32-hal2

================================================================================ WIRING

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:

  • Baud rate: 57600
  • Data bits: 8
  • Stop bits: 1
  • Parity: None

================================================================================ LICENSE

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.

================================================================================

Commit count: 0

cargo fmt