Use a Raspberry Pi to add Bluetooth capabilities to a USB device.
bluetooth2usb.py receives data from a Bluetooth connection and writes that data to a connected USB device byte-for-byte.
It can be used to convert a simple USB printer to a Bluetooth capable one.
- Download and copy
bluetooth2usb.pyto your Raspberry Pi. - Modify the constant values
USB_DEVICE_ID_VENDOR,USB_DEVICE_ID_PRODUCT,BLUETOOTH_SERVER_ADDRESS,LED_PINat the top of the file as necessary. - Run
bluetooth2usb.py. - To run it on boot, follow the instruction at the official Raspberry Pi docs to install it as a
systemdservice. Example.servicefile can be found atbluetooth2usb.service. - Connect a USB device and a Bluetooth client to the Pi.
- Send Bluetooth data from the client to the Pi. The connected USB device should receive the same data.
- Slowly blinking (0.2 s on, 0.8 s off): Waiting for a USB device to be connected.
- Quickly blinking (0.1 s on, 0.1 s off): Waiting for a Bluetooth connection.
- Continuously on: Everything is connected and waiting for Bluetooth data.
- Quickly blinking twice while on: Received and wrote data.
