A Rust utility for transmitting database data from a Raspberry Pi to a remote server automatically.
Pi_Transmit is designed to facilitate the seamless transfer of database information from a Raspberry Pi device to a designated server. This tool is particularly useful for IoT applications, remote monitoring systems, and data collection scenarios where periodic data uploads are required.
- Automated database synchronization
- Configurable transfer schedules
- Secure data transmission
- Error handling and retry mechanisms
- Persistent connection management
- Clone this repository to your Raspberry Pi
- Install Rust and Cargo if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Configure the
config.inifile (see Configuration section) - Build and run the project using Cargo
The config.ini file contains essential settings for the application. Place this file in the root directory with the following sections:
[server]
ip = 0.0.0.0 ; IP address of the remote server
port = 7878 ; Port number for the connection
max_retries = 3 ; Number of retry attempts on connection failure
retry_delay = 2 ; Delay (in seconds) between retry attempts
[connection]
persistent = true ; Whether to maintain a persistent connection
keep_alive_interval = 30 ; Interval (in seconds) for keep-alive signals
connection_timeout = 60 ; Connection timeout in seconds
auto_reconnect = true ; Automatically reconnect if connection drops
[transmission]
continuous = true ; Whether to transmit data continuously
transmit_interval = 0.5 ; Time between transmissions in seconds
buffer_size = 65536 ; Buffer size for data transmission
batch_size = 10000 ; Number of records to transmit in one batch
send_mode = batch ; Transmission options batch or individual
[database]
path = /home/pi/Pi_TCP/src/data_acquisition.db ; Path to the source SQLite database file
pool_size = 3 ; Data pool size to ensure resilience for database locks
timeout = 30 ; Database lock logic
busy_timeout = 5000 ; Database lock logic
[http]
data_endpoint = /data
keepalive_endpoint = /keepaliveTo build and run the application:
For development, from the root directory run:
cargo build
cargo runFor production run, from the root directory run:
cargo build --release
cargo run --releaseFor running as a background service, you can create a systemd service file or use:
nohup cargo run --release > output.log &Check the log output for detailed information about any errors encountered during transmission. Common issues include:
- Network connectivity problems
- Database access errors
- Server connection failures
- Transmission interruptions
Copyright 2025 CS 462 Personal Data Acquisition Prototype Group
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at