Bluetooth rant

A few months ago I started my Home Assistant journey with a Raspberry Pi 3B I already had.
Bought some RF, Wifi and Bluetooth stuff and even though there is a learning curve with HA, eventually I got all of my stuff to work.
Recently upgraded the rig to work with an old 128Gb SSD to avoid future problems with possible corrupt SD-card(s). One minor thing was that the Pi 3B didn’t like booting from it without an extra power adapter for the SSD. So every time the Pi lost power I had to plug the adapter in to make it boot.
Didn’t like that so I started looking for deals on a Pi 4B and eventually found one.
So I put it in an aluminum housing for better cooling, reinstalled everything and discovered none of my 4 Mija bluetooth (temp + hum) sensors work.
Turns out the housing really blocks bluetooth, but I like the case and bought a tiny USB BT 5.0 dongle (Realtek rtl8761b chip) and after some trouble to get it to work it found a total of 1 (!) sensor…
So I took the Pi out of its case just to see if onboard Bluetooth would detect them and it detects 3 out of 4 this way. My Pi 3B detected all 4 of them before…
Turns out there are some good BT dongles out there, but they cost about as much as a new Pi 4.
I have an ESP32 board laying in a drawer, so maybe I’ll try that route later, but my reading online has made me believe the Bluetooth on there is even worse…
Still can’t believe the Bluetooth on the 4B is actually worse (in terms of range) than the one on the 3B.
My overall conclusion is that although the sensors are really cheap, Bluetooth is a rabbit hole I wish I never got pulled into.
In case you’re still reading: sorry for wasting your time, but sometimes things just get under my skin…

Bluetooth uses 2.4GHz RF, just like Zigbee, and WiFi. On my RPi4, booting off of a Startech USB3.1 to SATA SSD adapter, I noticed that my Conbee2 Zigbee devices no longer were working. It turns out that the USB3 signals were generating enough RF interference to mess with the 2.4GHz Zigbee radio. The solution is to add USB extension cable to move the Conbee2 USB dongle away from the RPi, and to use the USB2.0 ports for it. Once I did this, the problems were resolved. I found this information searching here in the community.

I wonder if you add a USB extension cable, to move your Bluetooth dongle away from the RPi, if it might have an easier time communicating with the BT devices?

I don’t have an USB extension cable right now, but I might try that sometime.
Strange though that Wifi never gave me problems (like ever), but if you say it affected your Zigbee this way I guess I’m just lucky when it comes to Wifi.

Just wish they would make the same sensors but with RF 433mhz or 315mhz. They would be more reliable, go through walls like they aren’t there and the battery would probably last longer too. Who knows, maybe I’ll try to build some myself whenever I have/make time for it :wink:

For the moment I’m gonna try the esp32 board, just to test if Bluetooth is really that bad on it…
Thanks for your suggestion though, I would have never thought of USB3 interference.

1 Like

I would try the USB extension cable as a first low frustration step. Also, I think you on the bleeding edge with a Bluetooth 5.x adapter drivers and Linux, that support seems pretty young. I realize the rpi4 has 5.0 built in, but I would trust their drivers more than 3rd party right now, if moving to an external bluetooth adapter I would opt for a 4.x hardware where the drivers are ‘aged’.

If you try the esp32 route, I will be interested to hear your experience. I was thinking that might be an interesting route, however I too read some pretty vocal rants about lack of success with bluetooth and wifi coexisting on esp32’s. After reading those and a beer, I realized the issues better. The esp32 probably shares RF and antenna components between bluetooth and wifi that a device like the rpi probably does not do, combined with the esp32 trying to deal with lower power envelop, that sound like not a good eviro. Especially for apps like the BLE advertising type that we all are trying to do with these bluetooth sensors. BLE advertising is pretty fragile and spectrum consuming without overlaying additional possible hardware and power constraints of the esp32. Good hunting!

I use Xiaomi temp sensor and Miscale with esphome on an esp32. Works well, but it is in a hallway with the devices in the bathroom through a wall.

You might need a couple of esp32’s depending on location, but they are cheap.

So yeah, tried the esp32 route the simple way (with ESPHome) and it worked… kinda
I had to change advertising format on the sensors, but besides that it was as easy as ESPHome usually is.
Then there is a catch, a pretty big catch actually: the interval frequency.
I remember having the same issue before with ESPHome on a P1 meter (energy/gas meter in the Netherlands), so maybe it’s just ESPHome. Then again it may be the esp32 sharing RF with Wifi and Bluetooth as mentioned all over the internet :wink:
Either way, the update frequency is totally erratic and always longer then I would expect of a sensor that advertises at least once every 10 secs.
Ordered some USB extension cables and gonna try that tomorrow, enough tinkering for 1 evening…

Another option is to use a Pi Zero W as a dedicated BLE gateway instead of the ESP. I did that for presence detection by scanning BLE beacons in our cars when they leave / arrive on the driveway. The Bluetooth reception quality of the Pi Zero W is surprisingly good.

Yes agreed, I found a happy place with the raspberry pi… I use this simple c program on a rpi 3b in a 1800 sq ft ranch house with 20 ble sensors around, two in fridge and freezer. It collects about 400 packets per hour from each of the twenty sensors. Been running nonstop for six months.

It’s okay that the esp32 isn’t the solution to my Bluetooth problem as I never bought it for that.
But to me it is typical to see Bluetooth implemented so bad once again.
I live in a 1-person apartment, so really not big at all and I expected Bluetooth (even shitty implementations) to work over these short distances…

I know the Pi 3B’s Bluetooth is better (I mentioned that in the OP), but I thought I upgraded in every way buying a Pi 4B. Apparently not in the Bluetooth department :frowning:
Now I can buy a Pi Zero W or use my old Pi 3B as a dedicated Bluetooth monitor, but doesn’t that sound counter intuitive when I just bought the 4B ?
I appreciate the suggestions of course, I just never thought of adding an extra device just to have my sensors work (which they already did in the old setup).

Since I already have bought the USB dongle, I’m gonna try that with the extension cable tonight, but if that doesn’t work I guess I’ll just downgrade to my Pi 3B and accept that booting of an SSD is a bit problematic…

For anybody interested: I ended up fine-tuning the esp32 and (at least temporarily) using that because the USB extension only had a tiny effect on the reception of my Bluetooth 5.0 dongle.
To be fair, it’s the kind of dongle that’s marginally larger then the USB connector, so how good can reception be ? Also, it has the rtl8761b chip and although everything seems to be working it might be having a driver issue since I had to install that myself… (and I’ve been known to not always get things right…)
Thanks for everyone who tried to help me cope with my Bluetooth frustrations.
Bluetooth still sucks though :wink:

2 Likes

I personally had all the exact same issues with bluetooth and zigbee on rpi4 8gb running ssd over usb 3. Zigbee solution is extension cable. For bluetooth, nothing seemed reliable

I was trying to find a reliable way to integrate switchbot. thats when I decided to write an ESP32 mqtt switchbot bridge. Switchbot MQTT BLE ESP32
it is super reliable now

The bluetooth on the esp32 is actually quite good and one covers my entire house, with better connections the closer you are obviously

Depending what you are trying to achieve there are quite a few esp32 bluetooth options and projects on HA forum and github

1 Like