Optical
Optical
508 dpi
14.4 mm x 13.2 mm
Up to 1000 templates
0.5 seconds
60mA (average), 100mA (peak)
3.3V to 5V
UART, I2C, SPI
21.5 mm x 16.5 mm x 4.5 mm
-20C to 50C
Applications
| The R307 Optical Fingerprint Sensor Module is suitable for a wide range of IoT applications, including |
Access control systems
Smart home systems
Wearable devices
IoT devices with biometric authentication requirements
Security systems
Identity verification systems
R307 Optical Fingerprint Sensor Module DocumentationOverviewThe R307 Optical Fingerprint Sensor Module is a compact, high-performance fingerprint recognition module designed for various IoT applications. It features a high-resolution optical sensor, advanced image processing algorithms, and a built-in microcontroller for rapid fingerprint recognition. This module is ideal for applications requiring secure biometric authentication, such as smart locks, access control systems, and wearables.Technical SpecificationsSensor Type: Optical Fingerprint Sensor
Resolution: 508 dpi
Image Area: 12.8mm x 18.2mm
Fingerprint Recognition Speed: < 1 second
False Acceptance Rate (FAR): < 0.001%
False Rejection Rate (FRR): < 0.1%
Operating Voltage: 3.3V - 5.5V
Communication Interface: UART, I2C, SPICode Examples### Example 1: Basic Fingerprint Enrollment and Verification using UART (Arduino)In this example, we will demonstrate how to enroll a fingerprint and then verify it using the R307 module connected to an Arduino board.Hardware Requirements:R307 Optical Fingerprint Sensor Module
Arduino Board (e.g., Arduino Uno)
Breadboard and jumper wiresSoftware Requirements:Arduino IDE (version 1.8.x or later)Code:
```c++
#include <SoftwareSerial.h>#define R307_RX 2
#define R307_TX 3SoftwareSerial r307Serial(R307_RX, R307_TX);void setup() {
Serial.begin(9600);
r307Serial.begin(9600);
}void loop() {
// Enroll a new fingerprint
Serial.println("Place your finger on the sensor to enroll...");
delay(2000);
uint8_t enrollBuffer[256];
int enrollSize = r307Serial.getBytes(enrollBuffer, 256);
if (enrollSize > 0) {
Serial.print("Enroll buffer: ");
for (int i = 0; i < enrollSize; i++) {
Serial.print(enrollBuffer[i], HEX);
Serial.print(" ");
}
Serial.println();
} else {
Serial.println("Enroll failed!");
}// Verify the enrolled fingerprint
Serial.println("Place your finger on the sensor to verify...");
delay(2000);
uint8_t verifyBuffer[256];
int verifySize = r307Serial.getBytes(verifyBuffer, 256);
if (verifySize > 0) {
Serial.print("Verify buffer: ");
for (int i = 0; i < verifySize; i++) {
Serial.print(verifyBuffer[i], HEX);
Serial.print(" ");
}
Serial.println();
if (memcmp(enrollBuffer, verifyBuffer, enrollSize) == 0) {
Serial.println("Fingerprint verified!");
} else {
Serial.println("Fingerprint verification failed!");
}
} else {
Serial.println("Verify failed!");
}
delay(5000);
}
```
### Example 2: Fingerprint Recognition using I2C (Raspberry Pi)In this example, we will demonstrate how to use the R307 module connected to a Raspberry Pi to recognize fingerprints.Hardware Requirements:R307 Optical Fingerprint Sensor Module
Raspberry Pi (e.g., Raspberry Pi 3 or 4)
Breadboard and jumper wiresSoftware Requirements:Raspbian OS (latest version)
Python 3.xCode:
```python
import smbus
import time# I2C bus number (Raspberry Pi 3 or 4)
I2C_BUS = 1# R307 I2C address
R307_ADDRESS = 0x28# Create an I2C bus object
bus = smbus.SMBus(I2C_BUS)def read_fingerprint():
# Send a command to read a fingerprint
bus.write_byte(R307_ADDRESS, 0x01)
time.sleep(0.5)
# Read the fingerprint data
fingerprint_data = bus.read_i2c_block_data(R307_ADDRESS, 0x02, 256)
return fingerprint_datadef recognize_fingerprint(fingerprint_data):
# Send a command to recognize a fingerprint
bus.write_byte(R307_ADDRESS, 0x03)
time.sleep(0.5)
# Read the recognition result
result = bus.read_byte(R307_ADDRESS)
return result == 0x00while True:
print("Place your finger on the sensor...")
time.sleep(2)
fingerprint_data = read_fingerprint()
if recognize_fingerprint(fingerprint_data):
print("Fingerprint recognized!")
else:
print("Fingerprint recognition failed!")
time.sleep(5)
```
### Example 3: Integrating with a Microcontroller (STM32) using SPIIn this example, we will demonstrate how to use the R307 module connected to an STM32 microcontroller to recognize fingerprints.Hardware Requirements:R307 Optical Fingerprint Sensor Module
STM32 Microcontroller Board (e.g., STM32F103)
Breadboard and jumper wiresSoftware Requirements:Keil Vision IDE (version 5.x or later)
STM32CubeMX (version 5.x or later)Code:
```c
#include "stm32f1xx_hal.h"
#include "r307_spi.h"#define R307_SPI_PORT SPI1int main(void) {
// Initialize the SPI port
MX_SPI1_Init();// Initialize the R307 module
r307_spi_init(R307_SPI_PORT);while (1) {
// Read a fingerprint
uint8_t fingerprint_data[256];
r307_spi_read_fingerprint(R307_SPI_PORT, fingerprint_data, 256);// Recognize the fingerprint
uint8_t result = r307_spi_recognize_fingerprint(R307_SPI_PORT, fingerprint_data);if (result == 0x00) {
printf("Fingerprint recognized!
");
} else {
printf("Fingerprint recognition failed!
");
}// Wait for 5 seconds
HAL_Delay(5000);
}
return 0;
}void r307_spi_init(SPI_HandleTypeDef hspi) {
// Initialize the SPI pins
hspi->Instance->CR1 |= SPI_CR1_CPHA | SPI_CR1_CPOL;
hspi->Instance->CR2 |= SPI_CR2_FRXTH;
hspi->Instance->CR2 |= SPI_CR2_DS;
hspi->Instance->CR2 |= SPI_CR2_FRF;
hspi->Instance->CR2 |= SPI_CR2_LSBFIRST;
}void r307_spi_read_fingerprint(SPI_HandleTypeDef hspi, uint8_t buffer, uint16_t length) {
// Send a command to read a fingerprint
uint8_t command[2] = { 0x01, 0x00 };
HAL_SPI_Transmit(hspi, command, 2, 100);// Read the fingerprint data
HAL_SPI_Receive(hspi, buffer, length, 100);
}uint8_t r307_spi_recognize_fingerprint(SPI_HandleTypeDef hspi, uint8_t buffer) {
// Send a command to recognize a fingerprint
uint8_t command[2] = { 0x03, 0x00 };
HAL_SPI_Transmit(hspi, command, 2, 100);// Read the recognition result
uint8_t result;
HAL_SPI_Receive(hspi, &result, 1, 100);
return result;
}
```
These examples demonstrate how to use the R307 Optical Fingerprint Sensor Module in various contexts, including Arduino, Raspberry Pi, and STM32 microcontrollers. Note that the code may require modifications to suit your specific application and hardware setup.