Need help for bluetooth low energy (on Raspberry and ESP32)
Hi, I've got a Raspberry Pi 3 with Buster and I was trying to keep a BLE connection with my ESP32 (with the script I had before it connected just for the reading and then it disconnected) when I found this thread: https://www.linuxquestions.org/quest...ng-4175615328/.
So I ran this script: Code:
tmux new-session -d -s ServerFault 'sudo bluetoothctl -a |& tee /run/shm/BLUETOOTH_OUTPUT' I tried to do Code:
tmux kill-server (the output is "no server running on /tmp/tmux-1000/default") I don't know how could that command change something on ESP32, but the only commands I remember I ran other than that one are just those: Code:
sudo hciconfig hci0 reset |
Bluetooth is a pain. It was an IBM ultra-secure (= nobody can connect with you except by Divine Intervention or immense setup pain on your part).
That said, if you're using a Pi and turning bluetooth off to save current, that may not be wise. Everyone writes their own bluetooth stack and they're nearly all crap. To transfer, bluetooth needs
I would get out your mobile phone and check. You should be able to see and transfer to both devices, There's bluetoothctl on my system which is less crap than anything else I've tried. I needed bluetoothctl to set up and something else to transfer files. bluetoothctl is console mode, and of course you need root for this stuff. |
I don't know if I have written the right code for the ESP32, but it worked for like 2 months. But in a few days I have a test at the university on it and I wanted to edit the raspberry script to add this thing.
I mean, the script worked(ED...). The thing that the ESP32 sent was a detection of temperature and humidity. And using gatttool in a non-interactive mode from the raspberry Pi I could read them in every cycle the script did. But it connected to the device just for the moment of the reading and I thought "if someone that is not my Raspberry connects to my ESP32, the raspberry would stop to receive data!", so I wanted to ensure that there would be a fixed connection between the two devices. But, as I told, after trying that commands I found in that thread I can't access the data anymore. So I messed up with the bluetooth configuration of the ESP32 in some way from the raspberry. I don't have anymore the module to reprogram the ESP32, so I wanted to undo whatever I did from the raspberry. I tried to connect the devices by bluetoothctl and it works with connect, trust and pair but I can't access uuid that the raspberry needs to read (it shows "UUIDs has unsupported type"). And since neither the phone can read it I think it's something I changed on ESP. Sorry if I bothered you, but I don't know what to try. Thank you for the reply anyway! |
I've been through College. Fancy me trying to get through hardware engineering with my design: The input HEMTs on my two prototypes blew because I didn't hadn't any anti-static storage space; The pcbs couldn't be prototyped because the 74HCAUC devices were too $%£&@! small to be hand soldered, so I had one device working between the two. I designed the pcb with a lot of earth as shielding and capacitance which was supposed to be a component in the circuit, but the pcb manufacturer took it out. I got spare input devices but the techie was afraid to try soldering them on, etc. etc. I couldn't complain because the report went to external examiners!
You can be amazing with that kind of a torch under your backside. The thing about bluetooth is, Nobody, but nobody can connect to it as it should operate. It requires input on both ends. Don't lose your cool; I would purge everything you messed with and set it up as it worked. If that fails, point out that it did work, although it doesn't now, and you know why, but ran out of time to fix it. It won't cost you muchin marks. Highlight the unreliability of bluetooth, and it's unsuitability to the uses it's being put to. Highlight also that you broke the first rule of maintenance "If it ain't broke, don't fix it!" but that was done in the interests of developing a better product and these events are not unusual. Waffle about security and show you understand the principles. You'll be fine. 50% they won't even turn it on. They'll buzz through it during the Christmas hangover period. You have to be straight up for summer papers, but you can be frank & funny in the mid terms. I included this bit in the final mid-term :) https://drive.google.com/open?id=1dL...V5AgNVCO3KkaHF |
Moderator Response
Moved: This thread is more suitable in <Linux - Embedded & Single-board computer > and has been moved accordingly to help your thread/question get the exposure it deserves.
|
# bluetoothctl
That's the tools to setup connections. You can set some connections as trusted, thus making them persistent -ish. As long as scanning is enabled, the agent is on, and other quirks. the > command line has a help command to list options. It's not too complex outside of having to type MAC addresses of the device over and over. List it, connect to it, trust it, ... ... ... Kind of annoying, but it works. Just notice-ing that your orignal command did use bluetoothctl. And probably recorded a script of what was done using it. Which would be erased the next time you ran that command. Option 2, use a gui environment with a bluetooth agent (gui) to make it simple. A couple clicks and done. |
All times are GMT -5. The time now is 02:23 PM. |