-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we use raspberry pi 3 b+ and simulate the drone through bluetooth #42
Comments
I unfortunately personally don't have time at the moment to help with this kind of task. However, if you do manage to figure out how to do this, I would be very interested in hearing the results of it. If you are willing to provide this kind of code, that could even be something we add to this or another repository here. It would be very useful to have example transmit code for BT4 and/or WiFi NaN/Beacon transmission on Raspberry PI HW. Just FYI: For BT, if you run into problems with the fixed header values and the filter in the Android receiver app, the discussion here might be of use. |
Since you're using a RPi I think the best approach would be to try to leverage Bluetooth libraries for Linux. Have you looked at BlueZ (bluez link) ? I think if bluez works on the RPi and you follow the sample code here: example-advertisement link , you may able to get it (signs of life) to work. I would start with substituting the following:
I found this interesting as well: I haven't tried any of this above, but this would be my starting place if attempting to make this work under linux. Let us know how it goes. As Soren said, we would be happy to embrace this dev effort and add an additional repository under opendroneid called "transmitter-linux". Also, I would certainly recommend debugging with some some Bluetooth scanner like NRF Connect, |
Possibly the discussion here might be of some use also? If you manage to get bluez to output something, it should be possible to pick it up in the Android nRF Connect application and you can then start comparing against the example binary strings given in the issue, to ensure you send out the data in the correct format? |
One very delayed addition to this discussion. I managed to get at least legacy advertising to transmit something from an Ubuntu desktop machine to the Android receiver application. This only worked for me on Ubuntu 20.04.2 with kernel 5.8.0-63-generic. I tried also on 18.04.5 with kernel 5.4.0-77-generic but that would always fail with an advertising timeout (probably some kernel/driver/something mismatch). This was on a CometLake Z490 desktop with built in WiFi/BT. I did get it running also on a RaspberryPi4 running Debian/GNU 10 with RaspberryPi kernel 5.10.17-v8+. wget www.kernel.org/pub/linux/bluetooth/bluez-5.60.tar.xz Find the TestAdvertisement class and change the init function to contain only the following:
Then execute with “python3 example-advertisement”. I found it useful to have “sudo btmon” running in a separate shell to get a bit more debug output. The above just sends out a hard-coded location message and nothing else but is at least enough to prove that data is flowing. I pulled the example data from this discussion (which gives some instructions on how to configure the Android app nRF Connect to simulate the same). Despite btmon talking about Extended Advertising, it clearly cannot be using that (or then there is some other limitation somewhere) since whenever I tried to add more data than what fit in legacy advertising, it would throw an error at me. I don’t know if it is possible to get this example code to use the Long Range and Extended Advertising features. |
For WiFi Beacon, I found out the following. When using hostapd on Linux, it is possible to update the Information Element content of the beacon data by using the hostapd_cli interface. I got the following working on a RaspberryPi 4 (would probably work on Ubuntu also). The Pi cannot be connected to any WiFi networks: that seems to prevent it from going properly into the Access Point mode. The version of hostapd that by default gets installed by apt on Raspbian GNU/Linux 10 (buster) is too old (2.8-devel). I had to fetch the source code and compile it to get a version that supported the update beacon command.
(If some dependency is still missing, the full set seems to be: Create a configuration file with this content:
For testing purposes, it is enough to start the access point using the configuration file: In a separate shell, then start: That made the beacon visible in the Android receiver application. Clearly this is a very clumsy way of doing things and only servers to prove that it is possible to create a functional beacon and update the data that it is sending. An actual program of some kind would have to be written. There are C APIs for the set and update commands and when looking at the test code for hostapd, there is apparently also a Python interface: I probably won’t have the bandwidth any time soon to look further into that, but it would certainly be an interesting exercise at some point. |
There is now a simple application example available for Linux for transmitting Wi-Fi Beacon and Bluetooth 4 and Bluetooth 5 drone ID signals: |
I was trying to simulate the drone by using raspberry pi 3 b+ to run this application. I was able to successfully run the test application inside the Raspberry Pi OS. (have attached the screenshot for the same)
Now I am trying to figure out how can we connect this stream to get emitted in raspberry pi device Bluetooth. If anyone can help here, is very much appreciated
The text was updated successfully, but these errors were encountered: