Severe RF interference using Ethernet shield

Hello,

We've been experiencing some broadband issues recently and after lengthy investigation with our provider's engineers, we have discovered excessive RF noise is being caused by my Arduinos and Ethernet shields, and this can cause broadband faults and connection dropouts.

I have created a basic lighting automation system and duplicated it for the upstairs and downstairs lighting circuits. They are in their own enclosure to keep upstairs and downstairs separate. It uses an Arduino Mega (clone) and Ethernet Shield (genuine Arduino) in each case, powered by an external power supply (one per Arduino). The Megas simply switch relay boards with digital outputs to operate the lights. This bit all works fine.

The network is standalone and uses an old Netgear router. There is a Raspberry Pi as an MQTT broker and two of these lighting control boxes I've just described. The MQTT commands are sent from an Android tablet until I sort out a hardware solution for this element.

The RF noise can be heard using a handheld radio tuned to 612KHz. I can even hear it in the car while driving away from the property!!

The noise is present when only both Arduinos are connected to the network. Individually they don't cause an issue and the noise is not present.

Unplugging either Arduino makes the noise stop immediately.

Using a different router (Zyxel) has no impact, the noise is the same and behaves the same.

Using a different transformer for the routers makes no difference.

Using different cables makes no difference.

Using different cable routes makes no difference.

I've seen another person's article describing a similar problem back in 2014 but there was no reply so I don't know if it was solved - link below

Can anybody shed any light on this???

Thanks in advance, code now added below...
Mark.

// Arduino IP 192.168.0.104
// Downstairs Lights Relay Controller

#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>

#include <MQTTClient.h>
#include <system.h>

/* ---------- DO NOT EDIT ANYTHING ABOVE THIS LINE ---------- */

//Only edit the settings in this section

/* MQTT Settings */
// Topic which listens for commands
char* subscribeTopic = "Lights/Downstairs"; 

//MQTT Server IP Address
const char* server = "192.168.0.2";

//Unique device ID 
const char* mqttDeviceID = "DownLightsMEGA"; 
IPAddress ip(192, 168, 0, 104);
byte mac[] = {
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};


/* ---------- DO NOT EDIT ANYTHING BELOW THIS LINE ---------- */


//MQTT
EthernetClient net;
MQTTClient client;

unsigned long lastMillis = 0;

//Connect to MQTT
void connect();
 
// pin assignments
  int vccA = 21;
  int relay1A = 37;
  int relay2A = 35;
  int relay3A = 33;
  int relay4A = 31;
  int relay5A = 29;
  int relay6A = 27;
  int relay7A = 25;
  int relay8A = 23;
  int groundA = 39;
  int vccB = 20;
  int relay1B = 36;
  int relay2B = 34;
  int relay3B = 32;
  int relay4B = 30;
  int relay5B = 28;
  int relay6B = 26;
  int relay7B = 24;
  int relay8B = 22;
  int groundB = 38;

//Setup pins, wifi, webserver and MQTT
void setup() 
{
  Serial.begin(9600);
  delay(200);
  Serial.println("Serial ready...");

  Serial.println("Configuration:");
  
  Serial.print("MQTT Server IP: ");
  Serial.println(server);
  
  Serial.print("MQTT Topic: ");
  Serial.println(subscribeTopic);
    
  Serial.print("MQTT Device ID: ");
  Serial.println(mqttDeviceID);

  Serial.println("Node IP Address: ***///still needs configuring to display this///***");
  
  
  // set pin modes
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(vccA, OUTPUT);
  pinMode(relay1A, OUTPUT);
  pinMode(relay2A, OUTPUT);
  pinMode(relay3A, OUTPUT);
  pinMode(relay4A, OUTPUT);
  pinMode(relay5A, OUTPUT);
  pinMode(relay6A, OUTPUT);
  pinMode(relay7A, OUTPUT);
  pinMode(relay8A, OUTPUT);
  pinMode(groundA, OUTPUT);
  pinMode(vccB, OUTPUT);
  pinMode(relay1B, OUTPUT);
  pinMode(relay2B, OUTPUT);
  pinMode(relay3B, OUTPUT);
  pinMode(relay4B, OUTPUT);
  pinMode(relay5B, OUTPUT);
  pinMode(relay6B, OUTPUT);
  pinMode(relay7B, OUTPUT);
  pinMode(relay8B, OUTPUT);
  pinMode(groundB, OUTPUT);

  // set pin intial states
  digitalWrite(LED_BUILTIN, LOW);
  digitalWrite(vccA, HIGH); // VCC pin set for relay bank
  digitalWrite(relay1A, HIGH); // Start with the relay switched off
  digitalWrite(relay2A, HIGH); // Start with the relay switched off
  digitalWrite(relay3A, HIGH); // Start with the relay switched off
  digitalWrite(relay4A, HIGH); // Start with the relay switched off
  digitalWrite(relay5A, HIGH); // Start with the relay switched off
  digitalWrite(relay6A, HIGH); // Start with the relay switched off
  digitalWrite(relay7A, HIGH); // Start with the relay switched off
  digitalWrite(relay8A, HIGH); // Start with the relay switched off
  digitalWrite(groundA, LOW); // Ground pin set for relay bank
  digitalWrite(vccB, HIGH); // VCC pin set for relay bank
  digitalWrite(relay1B, HIGH); // Start with the relay switched off
  digitalWrite(relay2B, HIGH); // Start with the relay switched off
  digitalWrite(relay3B, HIGH); // Start with the relay switched off
  digitalWrite(relay4B, HIGH); // Start with the relay switched off
  digitalWrite(relay5B, HIGH); // Start with the relay switched off
  digitalWrite(relay6B, HIGH); // Start with the relay switched off
  digitalWrite(relay7B, HIGH); // Start with the relay switched off
  digitalWrite(relay8B, HIGH); // Start with the relay switched off
  digitalWrite(groundB, LOW); // Ground pin set for relay bank

  Ethernet.begin(mac, ip); // initialize Ethernet
  
  client.begin(server, net);
  client.onMessage(messageReceived);

  connect();
}

void connect()
{
   while (!client.connect(mqttDeviceID))
   {
    delay(1000);
   } 
   client.subscribe(subscribeTopic);
}

void loop() 
{
  client.loop();
  
  // Make sure device is connected
  if(!client.connected())
  {
    connect();
  }
}

// Change the state of a relay based on the MQTT Message
void messageReceived(String &topic, String &payload) 
{
    String msgString = payload;
    Serial.print("Message received: ");
    Serial.println(msgString);
    
  if (msgString == "LEDON")
  {
    digitalWrite(LED_BUILTIN, HIGH);
  }
  else if (msgString == "LEDOFF")
  {
    digitalWrite(LED_BUILTIN, LOW);
  }
    if (msgString == "LIGHT17ON")
  {
    digitalWrite(relay1A, LOW);
  }
  else if (msgString == "LIGHT17OFF")
  {
    digitalWrite(relay1A, HIGH);
  }    
    if (msgString == "LIGHT18ON")
  {
    digitalWrite(relay2A, LOW);
  }
  else if (msgString == "LIGHT18OFF")
  {
    digitalWrite(relay2A, HIGH);
  }  
    if (msgString == "LIGHT19ON")
  {
    digitalWrite(relay3A, LOW);
  }
  else if (msgString == "LIGHT19OFF")
  {
    digitalWrite(relay3A, HIGH);
  }   
    if (msgString == "LIGHT20ON")
  {
    digitalWrite(relay4A, LOW);
  }
  else if (msgString == "LIGHT20OFF")
  {
    digitalWrite(relay4A, HIGH);
  }    
    if (msgString == "LIGHT21ON")
  {
    digitalWrite(relay5A, LOW);
  }
  else if (msgString == "LIGHT21OFF")
  {
    digitalWrite(relay5A, HIGH);
  }    
    if (msgString == "LIGHT22ON")
  {
    digitalWrite(relay6A, LOW);
  }
  else if (msgString == "LIGHT22OFF")
  {
    digitalWrite(relay6A, HIGH);
  }    
    if (msgString == "LIGHT23ON")
  {
    digitalWrite(relay7A, LOW);
  }
  else if (msgString == "LIGHT23OFF")
  {
    digitalWrite(relay7A, HIGH);
  }
    if (msgString == "LIGHT24ON")
  {
    digitalWrite(relay8A, LOW);
  }
  else if (msgString == "LIGHT24OFF")
  {
    digitalWrite(relay8A, HIGH);
  }
    if (msgString == "LIGHT25ON")
  {
    digitalWrite(relay1B, LOW);
  }
  else if (msgString == "LIGHT25OFF")
  {
    digitalWrite(relay1B, HIGH);
  }    
    if (msgString == "LIGHT26ON")
  {
    digitalWrite(relay2B, LOW);
  }
  else if (msgString == "LIGHT26OFF")
  {
    digitalWrite(relay2B, HIGH);
  }  
    if (msgString == "LIGHT27ON")
  {
    digitalWrite(relay3B, LOW);
  }
  else if (msgString == "LIGHT27OFF")
  {
    digitalWrite(relay3B, HIGH);
  }   
    if (msgString == "LIGHT28ON")
  {
    digitalWrite(relay4B, LOW);
  }
  else if (msgString == "LIGHT28OFF")
  {
    digitalWrite(relay4B, HIGH);
  }    
    if (msgString == "LIGHT29ON")
  {
    digitalWrite(relay5B, LOW);
  }
  else if (msgString == "LIGHT29OFF")
  {
    digitalWrite(relay5B, HIGH);
  }    
    if (msgString == "LIGHT30ON")
  {
    digitalWrite(relay6B, LOW);
  }
  else if (msgString == "LIGHT30OFF")
  {
    digitalWrite(relay6B, HIGH);
  }    
    if (msgString == "LIGHT31ON")
  {
    digitalWrite(relay7B, LOW);
  }
  else if (msgString == "LIGHT31OFF")
  {
    digitalWrite(relay7B, HIGH);
  }
    if (msgString == "LIGHT32ON")
  {
    digitalWrite(relay8B, LOW);
  }
  else if (msgString == "LIGHT32OFF")
  {
    digitalWrite(relay8B, HIGH);
  }
}

Unshielded Ethernet can be terribly RFI noisy, but I am wondering if there is some networking conflict being negotiated between your two Arduino's and perhaps your router. I would check to see if they aren't trying to access the same port, I would use fixed IP addresses instead of DHCP if you are using that. When things get stuck in a loop, with the same digital pattern recurring with regularity, it can have its own radio frequency signature. Good Luck
Jim

Do you also hear the noise on 2X the frequency, 1224kHz? What are you using for power to the Arduino boxes? Sounds like noise from a switching power supply. Try a different power supply.
Paul

@markhoops, your topic has been moved to a more suitable location on the forum. At the moment that you an upload code, it's no longer an Installation and Troubleshooting issue :wink:

HI sterretje,

Sorry, I didn't realise - code now added :slight_smile:

Thanks,
Mark.

Hi Paul,

Yes, these are powered by switching power supplies. They are from a well known auction site and originate from an eastern country.

The power supplies are however supplied in their own steel case with an earth terminal (which is connected!). I would need to check continuity to earth to be sure that it isn't just "somewhere to put the earth wire"!! If it is functional, it would be on the same earth as the rest of the property.

Yes, we can hear the noise at 1224kHz.

The noise disappears when the power is cut.
The noise also disappears when either network cable is unplugged.

Can you advise a preferred type of power supply and I'll look for or get hold of some?

Mark.

I have something similar, a 75 amp 12 volt PSU from MFJ. It is supposed to be low noise and has a steel case and is grounded to the station ground etc. But STILL has lots of noise on my HF receiver. Have to turn it off sometimes.
The 12 volt terminals on the front do NOT have any individual RF filtering and there are several type of terminals. The meters are not shielded for RFI.
So, basically, the PSU lives up to it's low noise, until you hook some wires to the output terminals.
A transformer power supply will be noticeably heavier than a switching power supply. Find one with similar volt/amp specs and try it.
Paul

Hi @Paul_KD7HB

Finally connected up a linear power supply (15mins ago) and there is no longer any RF noise! Hurray! Quite surprised by the severity of the noise generated by these small (12V 2 amp) switched mode PSUs - quite incredible.

So, I will allow it to soak and see if all remains calm and hopefully my broadband will also improve.

Thank you for the pointers, and to @radiosky for the DHCP suggestion however I was already using fixed IP's.

Best regards,
Mark :slight_smile:

Glad you found a solution and an education at the same time.
Paul

Why would the broadband be impacted by RF noise?

@Paul_B,

It was causing excessive FECs which eventually lead to Secondary Errors and the connection would drop out. Some FECs are normal but we had over 500 in a 5 minute test at the property, and only 25 at the pole 70m away after a 15 minute test!! The overhead line was replaced which improved this, but there were still too many.

We went away for a few days and switched the house off (other than the fridge and the router, we trust the fridge!) and the broadband supplier monitored our connection and the issue disappeared indicating that the remainder of the issue (ie not the FECs caused by the old overhead line) were caused by something internal to our property. So I went fishing with an AM radio and found these PSUs were noisy. The broadband supplier is monitoring us for another 4 days to see if they can detect a reduction in faults to a normal level.

I'm no expert as I confessed at the start of this thread, but it seems to make sense.

Hope this has helped
Mark