opendroneid / transmitter-linux

Example Open Drone ID Linux transmitter for Bluetooth and Wi-Fi.
Apache License 2.0
48 stars 26 forks source link

transmitting bluetooth 5 on Raspberry Pi 4 #4

Closed planewave closed 2 years ago

planewave commented 2 years ago

Hi there

I have tried this on my Raspberry Pi 4 with ubuntu 20.04 when I do sudo ./transmit 5 p I got

Command 0xA returned error 0xC
Command 0x39 returned error 0x1
Supported Low Energy Bluetooth features:
        Features: 0x3f 0x00 0x00 0x08 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          LE Data Packet Length Extension
          Remote Public Key Validation
Command 0x36 returned error 0x1
The transmit power is set to 0 dBm
Command 0x35 returned error 0x1
Command 0x39 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1
Command 0x37 returned error 0x1

are these errors typical? is the BT5 Long Range + Extended Advertisements transmitting normally?

thanks

kspons commented 2 years ago

Readme says "When tested on a Raspberry Pi 3B and 4B, the Extended Advertising HCI interface commands are not supported (option 4 and option 5 p). Probably due to the HW/driver only supporting BT4 Legacy Advertising. The older BT4 Legacy non-Extended Advertising HCI commands (option l) worked okay." try with a transmit option other than 5 p

planewave commented 2 years ago

Oh, I see. Can I use some USB BT5 dongles to send the message? do you have any successful cases using USB BT dongles? or a list of BT5 modules that are working well?

friissoren commented 2 years ago

I have not tried any Bluetooth dongles. I don't see why that should not work though.

If you manage to find a suitable dongle that supports BT5 etc. and you can confirm that it works, please do drop a note here. We can update the documentation then.

planewave commented 2 years ago

I bought a BT5 USB adapter from Amazon. The brand is ONVIAN and the chipset is RTL8761B. This time I use a PC with Ubuntu 20.04 I received the following output from the terminal:

❯ sudo ./transmit 5 p
Supported Low Energy Bluetooth features:
        Features: 0xbd 0x5f 0x66 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          LE Data Packet Length Extension
          Extended Scanner Filter Policies
          LE 2M PHY
          Stable Modulation Index - Transmitter
          Stable Modulation Index - Receiver
          LE Coded PHY
          LE Extended Advertising
          Channel Selection Algorithm #2
          Connection CTE Request
          Connection CTE Response
          Antenna Switching During CTE Transmission (AoD)
          Antenna Switching During CTE Reception (AoA)
The transmit power is set to 0 dBm
Received unknown event: 0x3E
Received event with invalid opcode 0x200A. Expected 0x2039
Received event with invalid opcode 0x2039. Expected 0x203C

It looks working normall, but not sure about the meaning of invalid opcode. How can I verify it is indeed transmitting the OpenDroneID? Using a andriod receiver? Sadly, the opendroneid-wireshark-dissector doesnot support BT5 yet.

planewave commented 2 years ago

additional testing results: I have installed the OpenDroneID app on a Google Pixel 6a. it can detect both 4 and l but cannot get anything for option 5 p it supports BT5 long-range and extended advertising, but I cannot confirm if the BT adaptor has an issue or the phone has an issue.

friissoren commented 2 years ago

Probably the transmitter works as intended but I am not sure what those error codes are. I don't have the PC I originally tested the BT5 Long Range mode on anymore, so I can't dig into this.

There is an incomplete list of Android phones available and at least the Pixel 6 has been marked to not support BT5 Long Range.

Maybe you could try to check if any of your friends/family have one of the phones on the list that is known to support receiving BT5 Long Range and ask them to install the receiver app and test against the Bluetooth dongle transmitter?

It is actually strange that the Pixel 6 doesn't support receiving the signals, since the Android feature flags does claim that it supports both the Long Range and the Extended Advertising modes. Possibly the driver SW doesn't listen to primary and/or secondary advertisements on the Coded PHY but only on the regular 1 Mbit PHY.

planewave commented 2 years ago

tested with a Samsung Galaxy A21s and Oneplus 7(T?), both can detect BT5. Great work, thanks.