HomeHome AutomationA simple trick to reduce ZigBee coordinator WiFi interference

A simple trick to reduce ZigBee coordinator WiFi interference

A simple tip to make the ZigBee stronger

If you are running a custom ZigBee coordinator (ie Sonoff Dongle Plus, CC2531 or ZZH) attached to your RaspberryPi board the general advice is to use a 1-2m extension lead to avoid the interference caused by WiFi. It’s sound advice, especially if you are running into issues when pairing new ZigBee devices. I have one more tip for you – disable WiFi entirely if you don’t need it, and do it in a smart way.

Smart disable WiFi script

Instead of running a command which blindly disables the WiFi, I needed something more flexible. I don’t need WiFi when I’m connected via Ethernet, but I’d like to keep it on when the LAN network isn’t available. This way, if I ever need to disconnect my Raspberry Pi from the LAN I won’t get stuck without headless access and the Raspberry Pi will attempt to connect to one of the SSIDs saved in the wpa_supplicant.conf. You can find out how to supply these here.

Sonoff ZigBee Dongle Plus

It’s a very simple process simply follow these steps:

  1. sudo apt-get install ethtool – (should be installed on default RasbianOS)
  2. sudo raspi-config – go to Advanced Options -> Network Interface Names – enable predictable names
  3. sudo nano /etc/rc.local – edit the file and add the script below before exit 0

If your other scripts and settings rely on MAC-based network names, replacing eth0 & wlan0 in the code above with corresponding interface names should do the trick. Advanced Linux users can take this further modify the IF statement to suit their needs (ie. acquiring s specific IP address before disabling WiFi to make sure the LAN network works as intended).

with rfkill

if sudo ethtool eth0 | egrep "Link.*yes" && sudo ifconfig eth0 | egrep "inet"; 
then
  sudo rfkill block wifi  
else
  sudo rfkill unblock wifi
fi

with ifconfig

if sudo ethtool eth0 | egrep "Link.*yes" && sudo ifconfig eth0 | egrep "inet"; 
then
  sudo ifconfig wlan0 down
  sudo ifconfig eth0 down
  sleep 5
  sudo ifconfig eth0 up  
fi

On your next reboot, RaspberryPi will disable WiFi if the Ethernet cable is connected. If you happen to boot the RaspberryPi without a LAN network, it will enable WiFi and provided, that you have specified the network credentials (via wpa_spupplicant.conf etc) will connect to the internet via WiFi.

If you need your wireless network available, you can always toggle it with the following commands:

sudo ifconfig wlan0 down    //disable WiFi (valid till next reboot)
sudo ifconfig wlan0 up      //enable WiFi
sudo rfkill block wifi      //disable wifi  (persists over reboots)
sudo rfkill unblock wifi    //enable wifi

There are a couple of other things to bear in mind:

  • Keep your coordinator away from routers
  • Use USB 2.0 ports over 3.0
  • Use 1-2m USB extension cable (USB2.0)
  • Keep the coordinator away from sources of EMF (HDDs, Microwaves etc)

Final thoughts

It’s a very simple script I have found in this thread and works like a charm for my automation server. As I don’t need WiFi for my DeskPi Pro case which hosts my automation server, it reduces the interference between the drive and my custom coordinator. Just note that EMF sources like drives, fans etc can still interfere with data networks – so keep the coordinator far away from these (don’t give up that extension cord just yet). Let me know how this worked out for you and if it helped you with your ZigBee interference in this Reddit thread.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

Tuya SDK for beginners: Intro to Tuya Cloud API

0
Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Nora – Google Assistant in NodeRED

0
Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

Sonoff Zigbee Bridge – review

0
Sonoff line up will soon include Sonoff Zigbee Bridge and more Zigbee sensors - here is the first look

DIY Smart Washing Machine – for about 15 bucks!

0
Learn how to add washing machine notifications to your Google Home on the cheap

Smart Home

SwitchBot S10: cleaning re-imagined!

0
SwitchBot S10 promises unattended vacuuming and mopping so you can focus on things you love and care for. Does it deliver?

Sonoff for households and gardens

0
ITEAD released two ZigBee devices to manage water in your household and gardens. Now you can monitor the flow and dispense water with Sonoff SWV and prevent water damage using the Sonoff Water Leak sensor with a twist.

I wish I had known about the SMLIGHT ZigBee/Thread Coordinators sooner!

0
SMLIGHT coordinators are the perfect choice for anyone just diving into ZigBee. SLZB-06 series is easy to use and comes with future-proofing Thread support.

Sonoff ZigBee Bridge U isn’t what you think!

0
I expected Sonoff ZB Bridge U to be a next gen ZigBee bridge with Matter support. Turns out, there is much more to talk about!

Aqara “Everything” M3 Hub

0
When I started my home automation adventure, the current problem was the number of ecosystems needed to outfit your smart home. Aqara M3 Hub has a long list of protocols to match that!