Skip to content
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

Migrated to PI 4, bad range? (USB3 2.4GHz interference) #430

Closed
vikdb opened this issue Jul 9, 2021 · 32 comments
Closed

Migrated to PI 4, bad range? (USB3 2.4GHz interference) #430

vikdb opened this issue Jul 9, 2021 · 32 comments
Labels
question Further information is requested

Comments

@vikdb
Copy link

vikdb commented Jul 9, 2021

Hi,

I've been using this custom integration for over a year and it just works perfect with my Xiaomi Mijia Bluetooth sensors.
But last week i did a migration from my pi3 to a pi4 and now it seems that the sensors upstairs are out of range..

I thought the raspberry 4 had better bluetooth range, not worse?
ANy ideas?

@Ernst79
Copy link
Collaborator

Ernst79 commented Jul 9, 2021

Did you also change to an SSD drive in stead of SD card at the same time? or any other hardware changes?

@vikdb
Copy link
Author

vikdb commented Jul 9, 2021

Yeah i upgraded my setup to a SSD, do i need to change something when migrating to a SSD?

@Ernst79
Copy link
Collaborator

Ernst79 commented Jul 9, 2021

SSD drives block the Bluetooth signal for some reason. It is a very common problem (I had it myself too). I've written something in the faq about this issue (https://github.com/custom-components/ble_monitor/blob/master/faq.md#my-sensor-doesnt-receive-any-readings-from-my-sensors-anymore-or-only-occasionally)

The solution is to use an extension cable between your PI and SSD drive, and place the SSD as far away from your PI. Somehow SSD drives interfere with the Bluetooth signal.

@vikdb
Copy link
Author

vikdb commented Jul 9, 2021

Ok i'll try it!

Its a shame, i really like my new case with the SSD on the bottom :(

@Ernst79
Copy link
Collaborator

Ernst79 commented Jul 9, 2021

Yeah, sorry 😢 Unfortunately, I'm pretty confident that this is the issue you are facing. You are not the first....

@Thrilleratplay
Copy link
Collaborator

@vikdb Try connecting the hard drive to a USB 2 port. Some users of the Govee BLE Thermometer/Hygrometer plugin did some debugging and research into a similar issue and found that USB3 can interfere with 2.4GHz wireless devices.

@Ernst79 Ernst79 added the question Further information is requested label Jul 11, 2021
@Ernst79
Copy link
Collaborator

Ernst79 commented Jul 14, 2021

I assume your issue is solved with these tips. Feel free to reopen if you still encounter issues.

@Ernst79 Ernst79 closed this as completed Jul 14, 2021
@kaizersoje
Copy link

I am having a similar isssue. I have connected the SSD via an 1m extension cable to the Pi. If I move the BT sensor in the same room as the Pi, I am able to receive the data. However, if I move the sensor to the place it used to be, the Pi is unable to receive the data.

Anything else I can do?

@Ernst79
Copy link
Collaborator

Ernst79 commented Feb 5, 2022

Try to move the SSD around, it might be better in another position. If that doesn’t work, try to disable WiFi and connect the pi via a LAN cable. Other options are using an external Bluetooth adapter, with antenna

@kaizersoje
Copy link

The Pi is connected via LAN. How do I disable the Wifi?

@Ernst79
Copy link
Collaborator

Ernst79 commented Feb 5, 2022

First hit in google

https://raspberrytips.com/disable-wifi-raspberry-pi/

if you are on Home Assistant Os, it might not work. You can use this

https://community.home-assistant.io/t/quick-question-how-to-i-turn-of-the-wifi-radio-on-my-rpi3-using-hassio/78955/3

@Magalex2x14
Copy link
Collaborator

Some attention should be paid to the quality of the USB cable. The cable must be shielded and twisted pairs. If it does not have ferrite cores, then you can buy ferrite clamps:

They are not expensive, and it is useful to install them on the power cord too.
You can move on further only with an external usb-bt adapter. Close to ideal, I personally see the setup with a raspberry and an SSD on a short wire, installed inside a common metal case, and an external bt adapter on a usb extension cord.

@kaizersoje
Copy link

First hit in google

https://raspberrytips.com/disable-wifi-raspberry-pi/

if you are on Home Assistant Os, it might not work. You can use this

https://community.home-assistant.io/t/quick-question-how-to-i-turn-of-the-wifi-radio-on-my-rpi3-using-hassio/78955/3

I am not able to figure out where to find the config.txt file. I have the SSH addon installed.

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Feb 6, 2022

The addon does not have access to this part of the file system, as far as i know. You need ssh access to the host OS.

The following method may be easier - gracefully turn off the raspberry, remove the SD card, insert it into the card reader and connect it to Linux or Windows machine (macOS can't read SD card of such a format, but you can use virtual machine in this case), ignore the warnings asking you to format the disk and look for a partition called hassos-boot (it's a FAT32 partition).
config.txt is at the root of this partition:

@kaizersoje
Copy link

kaizersoje commented Feb 6, 2022

Thx @Magalex2x14. Well, I have migrated my installation to a SSD. But I did connect my SSD to a Windows machine yesterday but it did not get recognised. Tried the same with my Mac as well. (But then as you mentioned, it did not get recognised). Tried the missus' PC and it worked.

Anyways, I made the change to config.txt but no success with the integration.

Probably have to get the ferrite clamps.

@Magalex2x14
Copy link
Collaborator

Consider also to install external usb bluetooth dongle - it will work significantly better than the built-in one. Even a simple one without a full-sized antenna, such as the Asus USB-BT400. Even installed without a USB extension cable (but better with one, like a one- or two-meter USB-A male to USB-A female). And ferrite clamps, yes.

@kaizersoje
Copy link

Thx. I'm assuming it does not matter whether it's a BT 4.0 or 5.0 adapter.

@Magalex2x14
Copy link
Collaborator

Yes, BT LE support has been around since the Bluetooth 4.0 specification.

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Feb 7, 2022

One of the key points when choosing an adapter is the software support of its chip in linux. With the BT 5 adapter, you are more likely to run into such a software issues, than with BT 4.0... The HomeassistantOS image uses not so old kernel, so this probability is small, but still not zero.

@kaizersoje
Copy link

Thx again @Magalex2x14. I have ordered an adapter. Will provide further update.

@kaizersoje
Copy link

Hi @Magalex2x14, I have plugged in the adapter to the Pi. I also changed the adapter to be used in the Integration options page. It still does not seem to find the sensor. Do I need to disable the BT on the actual Pi?

@Magalex2x14
Copy link
Collaborator

No, it's not necessary. And it will not give a tangible reduction in energy consumption. You can simply uncheck it in the integration settings so as not to create an extra CPU load.

Did you plug it directly into the raspberry, or is it already with a USB extension cable?

@kaizersoje
Copy link

Plugged directly to the Pi

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Feb 8, 2022

I'll try to shed more light on the situation.

Apparently, interference in the 2.4GHz region occurs due to the use of USB3 peripherals. The problem occurs not only with Bluetooth, but also with WiFi. It's easy to google. Lots of posts on reddit. There are many posts on the Intel website (they even had an article on this topic). Synology NAS even have the "Downgrade USB 3.0 device to reduce interference of 2.4G signal" option.

Judging by what I see, the source of broadband noise is RPi USB3 interface itself, the interface cable, USB3-SATA adapter (or other device), and SSD itself. Based on this I would go the following way:

  • abandon the built-in wifi and bluetooth (consider the possibility of installing external WIFI antenna or an external adapter if needed)
  • use an extremely short wire for an external SSD
  • a metal case for the RPi, preferably a shared one for the RPi and SSD
  • use an external BT-adapter, taken away from the raspberry and SSD
  • use high-quality shielded USB cables with the installation of ferrite clamps

If not possible to use an external BT-adapter, and there is no way out other than using the built-in one, then yes, as @Ernst said, you need to take away the SSD and SATA adapter from the raspberry and try to shield it. And rely on luck...
Personally, I would go the way I described, because it gives a greater likelihood of success.

P.S. just few links:
https://community.synology.com/enu/forum/2/post/122739
https://www.macobserver.com/tmo/article/usb-3.0-hard-drives-can-cause-wi-fi-interference
https://www.reddit.com/r/PS4/comments/602ite/psa_usb_30_devices_can_cause_interference_with_bt/
https://www.reddit.com/r/PS4/comments/60qwz1/external_usb_30_hard_drives_and_controller_signal/
https://www.intel.com/content/www/us/en/search.html?ws=text#q=usb3%20interference&sort=relevancy

Pay special attention to this document - it describes methods of dealing with the problem:
https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/usb3-frequency-interference-paper.pdf

@kaizersoje
Copy link

This is is my current setup -
RPi4 in a metal case, SSD in a plastic case attached via a small USB cable, BT adapter attached to the Pi via a USB extension cable.

Wifi has been disabled on the Pi as well.

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Feb 9, 2022

So, to no avail, as far as I understand?

You need to try to localise the source of noise. Without special equipment, this problem is solved only by trial and error, experiments. Armed with aluminum foil, I would start trying to shield the elements of the system. For example, here is a link to a forum with amazing illustrations (pay special attention to the presence of electrical contact with existing shielding elements, household aluminum foil can be conductive on one side only):
https://forum.openmarine.net/showthread.php?tid=3062

Just for note, in addition to foil, there are also special aluminium and copper shielding tapes and special spray paints with metal powder, designed specifically to solve shielding problems.

You need to deal with shielding. As mentioned above, a lot depends on the cables (don't forget the ferrite clamps). After making sure of the quality of the cables, and, perhaps, having tried different options, as I wrote above, I personally would try to box up the raspberry and the SSD into some kind of a metal case (shared for both devices). Like this one:
image
I understand that this can be difficult or even unacceptable (at least, you need to think about cooling, plus the problem of dimensions, and so on). There can be a ready-made options with the ability to install an SSD. I can't recommend specific. The preference must be given to all-metal with as fewer holes as possible (many small holes are acceptable, remember the metal mesh shield on the microwave door, but you should not abuse it anyway - the size of the holes and distance between them matters, here it is necessary to read the specialized literature about electromagnetic shielding).

More related links:
https://www.rshtech.com/blog/how-to-avoid-the-usb30-and-24-ghz-devices-interference-2
https://www.bluetoothandusb3.com/solutions-for-bluetooth-usb-adapters-step3
https://www.bluetoothandusb3.com/solutions-for-bluetooth-usb-adapters-step5

I don't know how else to help. The problem is not so simple. And there can be many solutions - it all depends on the specific situation...

@kaizersoje
Copy link

Hi @Magalex2x14, thanks for taking the time to explain all this. I have ordered some ferrite clamps. I connected the BT adapter using a USB2 extension cable. But that hasn't made any difference.

If the clamps don't work, I will get try out something else.

@kaizersoje
Copy link

Hi @Magalex2x14. I got the clamps and put them on the cables connected to the SSD as well as the cable connecting the BT adapter. This has resolved the range issue. Thx once again.

@Magalex2x14
Copy link
Collaborator

Glad I was able to help 👍
Tell us, what is the RSSI attribute value of the sensor, the reception of which was impossible without ferrite clamps?

@Magalex2x14 Magalex2x14 changed the title Migrated to PI 4, bad range? Migrated to PI 4, bad range? (USB3 2.4GHz interference) Feb 20, 2022
@Magalex2x14 Magalex2x14 pinned this issue Feb 20, 2022
@kaizersoje
Copy link

@Magalex2x14 the rssi sensor is recording around -83dBm.

@kaizersoje
Copy link

kaizersoje commented Apr 28, 2022

Hi @Magalex2x14, I am still getting range issues. I have connected the SSD drive using a short shielded USB3 cable with a ferrite clamp. Connected the BT adapter to the RPi using a USB2 extension cable.

Any other suggestions?

PS: I have moved the sensor a bit closer to the RPi and am getting a rssi value of -77.7 dBm.

@djkroko
Copy link

djkroko commented Feb 9, 2023

For me, it was the Aluminum Case i bought.
Without Case Pi BLE range was over 2 Floors.
With Aluminum Case i couldnt get a Connection to a Sensor on the same Floor 3 Meters away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants