This repository contains a set of services designed to run on a Raspberry Pi 3B, focused on Bluetooth operations with ESP32 beacons. Each folder in this repo represents a systemd service, including its executable Python script and service configuration.
bluetooth_auto_connect- Purpose: Automatically pairs and connects the Raspberry Pi to nearby Bluetooth devices (such as ESP32 beacons) using a script called
auto_pair_v2.py. - Key Files:
auto_pair_v2.py: Python script for scanning and pairing.bluetooth_auto_connect.service: Systemd service definition to run the script automatically at boot or on trigger.
- Purpose: Automatically pairs and connects the Raspberry Pi to nearby Bluetooth devices (such as ESP32 beacons) using a script called
bluetooth_auto_restart- Purpose: A watchdog service that restarts the Bluetooth interface or services in case of failure or unresponsiveness.
- Key Files:
bluetooth_auto_restart.service: Systemd service file to periodically restart or monitor the Bluetooth stack.
bluetooth_beacons_scanner_v2- Purpose: Scans for nearby Bluetooth beacons (likely ESP32 devices broadcasting BLE signals), processes data such as RSSI, and prepares it for logging or transmission.
- Key Files:
bluetooth_beacons_scanner_v2.py: Scanning logic implementation.bluetooth_beacons_scanner_v2.service: Runs the script as a persistent service.
bluetooth_data_sender- Purpose: Sends scanned or processed Bluetooth data (like beacon identifiers, RSSI, or timestamps) to a remote server or local endpoint.
- Key Files:
bluetooth_data_sender.py: Sends collected data (likely over HTTP, MQTT, or another protocol).bluetooth_data_sender.service: Service file for enabling it on boot.
esp32_beacon_listener- Purpose: Specifically listens for Bluetooth packets or messages from ESP32-based beacons. May include filtering, formatting, or device identification.
- Key Files:
esp32_beacon_listener.py: Script for listening and handling messages from ESP32 beacons.esp32_beacon_listener.service: Service configuration.
- Raspberry Pi 3B with Raspberry Pi OS (Lite or Full)
- Python 3
bluetooth,bluez, andsystemdinstalled- Your user should have permissions to access Bluetooth
For each folder (service), follow these steps:
# 1. Copy the script and service file to appropriate locations
sudo cp your_service.py /usr/local/bin/
sudo cp your_service.service /etc/systemd/system/
# 2. Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable your_service.service
sudo systemctl start your_service.service
# 3. Check status
sudo systemctl status your_service.service๐ Repeat the above for each service (replace your_service with the name of the service file without the .service extension). ๐ง Example:
sudo cp bluetooth_auto_connect/auto_pair_v2.py /usr/local/bin/
sudo cp bluetooth_auto_connect/bluetooth_auto_connect.service /etc/systemd/system/
sudo systemctl enable bluetooth_auto_connect.service
sudo systemctl start bluetooth_auto_connect.serviceNotes
- Make sure your Python scripts have executable permissions:
sudo chmod +x /usr/local/bin/*.py- Services are designed to be modular; you can enable only the ones you need.
Let me know if you want the README in a file, or want me to modify or translate it.