A lightweight Bluetooth Low Energy (BLE) Peripheral Simulator built with Node.js and TypeScript.
This tool turns any Linux machine (Debian, Ubuntu, Raspberry Pi) into a "Smart Logistics Sensor." It reads shipment data from a CSV file and broadcasts it over Bluetooth in real-time. This is ideal for developing and testing BLE Client applications (like React Native dashboards) without needing physical sensor hardware.
- CSV Playback: Streams real-world dataset rows (
Timestamp,Asset_ID,Temperature,Humidity,Status) sequentially. - Standard BLE Stack: Uses the
blenolibrary to interface directly with the Linux BlueZ stack. - Real-time Updates: Updates the characteristic value every 2 seconds (configurable).
- Simple Protocol: Broadcasts data as a comma-separated string (UTF-8), making it easy to debug and parse.
The simulation data (sensor_data.csv) is based on the Smart Logistics Supply Chain Dataset.
- Source: Kaggle - Smart Logistics Supply Chain Dataset
- Credit: ziya07
- OS: Linux (Debian/Ubuntu/Raspberry Pi recommended).
- Note: Windows/macOS support is experimental due to driver limitations.
- Hardware: A device with a Bluetooth 4.0+ Adapter (Internal or USB Dongle).
- Software: Node.js (v18+), npm.
-
Clone the repository:
git clone https://github.com/TruGanic/ble-sensor-simulator.git cd ble-sensor-simulator -
Install System Dependencies (Linux): Required for the Bluetooth C++ bindings.
sudo apt-get update sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev build-essential
-
Install Node Dependencies:
npm install
The easiest way to run the simulator is using the included helper script, which handles compilation and permissions.
chmod +x start_sim.sh
./start_sim.sh