Kotlin/Native server to manage attendance on a raspberry pi 4B from a python server managing biometric sensors and camera.
Also made a Youtube Video talking about this project
- Raspberry pi (Used in this project is 4B 8gb variant)
- R307 fingerprint scanner with UART to USB Converter
- ssd1305 OLED Display
- Raspberry pi camera
- 4x4 matrix membrane keypad
- Jumper cables and power adapter
Required OS for Raspberry pi: Debian GNU/Linux 12 (bookworm) aarch64
- Clone the repo at the home directory
git clone https://github.com/shub39/RpiAttendance- Install uv package manager
- Setup the server environment
# Setup
cd RpiAttandance/sensor_server/
uv venv
uv pip install
sudo apt update
sudo apt upgrade
sudo apt install pip python3-opencv python3-numpy cmake
sudo apt install libkms++-dev libfmt-dev libdrm-dev # might require more...
uv pip install rpi-libcamera -C setup-args="-Dversion=unknown"
uv pip install -r requirements.txt- Setup the cronjob to run server on reboot, file
cronjob.sh
- Download the binary from releases to the home directory
- Setup cronjob
- Install android app on a device in the same network as the Raspberry Pi
To build the project from source, you can use the following Gradle commands:
- Build the native server:
./gradlew :server:linkReleaseExecutableLinuxArm64 - Build the Android app:
./gradlew :androidApp:assembleRelease - Run the Desktop app:
./gradlew :desktopApp:run
sensor_server: throughly tested python server to manage the sensors using fastapicore: shared kotlin models and interfaces throughout the projectserver: Kotlin/Native server, the main server to connect with the client app. Manages connection to thesensor_serverand database. Processes business logicclient: UI and logic for the client appandroidApp: Build module for the Android AppdesktopApp: Build Module for the Desktop App, Also for hot reload
graph TD
subgraph "Client Apps"
androidApp[Android App]
desktopApp[Desktop App]
end
subgraph "Shared Code"
client[client module]
core[core module]
end
subgraph "Server Side"
server[server module]
sensor_server[sensor_server]
db[(Database)]
end
androidApp --> client
desktopApp --> client
client --> core
client -- Ktor RPC --> server
server --> core
server -- FastAPI HTTP --> sensor_server
server --> db
- Framework: Kotlin Multiplatform
- UI: Jetpack Compose for Multiplatform for building the UI for Android, and Desktop.
- Server: Ktor for the server-side application, with Kotlinx RPC for type-safe remote procedure calls between the client and server.
- Database: Room for the local database on the server.
- Dependency Injection: Koin for dependency injection.
- Asynchronous Programming: Kotlin Coroutines for managing background threads and asynchronous operations.
- Serialization: Kotlinx Serialization for serializing and deserializing data between the client and server.
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.