0

I am working on a project for my university. I want to connect several Bluetooth barcode scanners (OPN2006) to a Raspberry Pi 3+ by using the Bluetooth SPP. I managed to make the connection to one device like this.

Edit file /etc/systemd/system/dbus-org.bluez.service:

ExecStart=/usr/lib/bluetooth/bluetoothd -C
ExecStartPost=/usr/bin/sdptool add SP

Connect device

pi@raspberrypi:~ $ sudo rfcomm watch hci0
Waiting for connection on channel 1
Connection from 38:89:DC:00:18:D4 to /dev/rfcomm0
Press CTRL-C for hangup

read data:

I wrote a short python program to read the received data.

import serial
ser=serial.Serial('/dev/rfcomm0')
while ser.isOpen:
    print(ser.read(28))

At the moment I'm trying to get two scanners connected to the same Raspberry using SPP and sending data. To connect the second scanner, I tried to use sudo rfcomm watch hci0 2 which resultet in waiting for connection on channel 2but it wasn't able to connect.

The goal would be to use a random scanner and connect it with the raspberry, without manual intervention on the Raspberry. There are several Raspberry's and also several scanners. The scanner reads a barcode and uses this information to read and save the Bluetooth address of the nearest Raspberry. Now the connection to the corresponding Raspberry is to be established. A total of up to 5 barcode scanners should be able to be connected to a Raspberry at the same time.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.