Suspected earth loop

Hello, I hope someone can point me in the correct direction to resolve this issue. I have a newish floor standing electric heater that is not used due to the horrendous difficulty in the user interface, so I thought to bypass this and use a simple plug in timer. This causes the heater to get very hot, so second thought was use an Arduino to cycle the heating element when it is on.

I decided on 4 settings; Initial warmup of 4 minutes; HI - 3min on 2min off; MED - 2min on 2min off; LO - 1min on 2min off. So far so good, just add a button to change setting, 3 LEDs red, yellow, green do display the current settings and a further red LED for heating on/off. The setting is initially read from EEPROM and written when the setting is changed with the button.

The code is very simple and works fine - until I connect up the swithcing relay to the mains. The heater works and cycles the current to the heater so it doesn't get too hot, BUT when it switches the setting gets changed, I suspect this is some sort of power glitch as the code works fine when not connected to the heater. Has anyone had similar problems?

Oh, yeah, that problem comes up almost once a day here. Please post a complete wiring diagram of your project, showing all the components and with all the connections, everything labelled. Images of your hardware and wiring are also appreciated.


Thanks aagh, good to know there is a lot of experience on the forum, here is the wiring diagram

I only had a dual relay so I used one side.

Is the relay just a relay or a module ? Can you show a photo or give a link to the module ?

I suspect 230V doesn’t have + and -

I don't see the connection between relay module GND and the 5 volt system GND.

You are using the relay in non-isolated mode, making its opto-isolators redundant. This may be making the interference you see more likely.

Normally the supply to the relay module would be separate from the logic board.

If you only connect the 5V and digital pins between Arduino and relay module, and remove the Vcc jumper, then the Arduino is only connected to the sending side of the opto-couplers. Well, that's true for most of the relay modules - perhaps you should identify the one you have.

The relay is an opto-isolated 5v dual relay board from switch electronics, see url below

The 230v does have + and - as it comes from the mains via the heaters dual pole switch

The relay gnd comes from the arduino

The relay has the jumper attached JD_VCC to VCC

Are you disabling some built in overheating protection with your system hack? Or is there a mechanical over heating protection...
Insurance companies might not like DIY stuff if your house burns down...
Maybe you also want to stay where your house is today...

So it is 230v DC you are getting?

There is still an over heat protection relay incorporated in the circuit, I have just replaced the timing circuits.

No its 230v AC

That may be your problem. The optoisolators can defend you from spikes when the relays are de-energized, but shared power/ground defeats this.

On reflection, I wonder if the heater's pulling enough current at startup to cause a dip on your 7805 output. It might be interesting to test your setup with something that uses rather less power.

No, not DC but the system has 230 and ground. Its not too much of a stretch to call them + and - just for brevity.

Not sure what the device in the top of the controls box is.

I would suggest:

  1. Add at least 1µF on the output of the Power supply.
  2. Connect all your grounds to one physical place (suggest the power supply common).
  3. Replace the Relay board with a commercial grade SSR (Solid State Relay)

Why SSR.

  • The Songle "hobby" relay and has a long history of failures. I would not rely on it for any heating device.
  • An SSR will turn on and off when the voltage on the mains is zero. This reduced much (if not all) the electrical switching noise. Especially in my home.
  • I would verify the heater has a overheat device to act as a failsafe. These are usually a two leaded silver device located in the heating element area.

I’m not familiar with this system. live neutral and earth, I understand, but you cannot call neutral ground because it is not. or maybe it is taken from 2x120v supply like in North America then there definitely no + or -, in which case neutral will be ground but it will be a separate wire. So I am not gonna comment further.

I sincerely apologize, I inadvertently called neutral ground. I hope I didn't cause anyone to do something dangerous.

That is how it used to be in North America, prior to about 1950. There was a transition from knob-in-tube wiring to two conductor, then fairly quickly to three conductor where one conductor is the safety ground.

OK, this is how you wire the relay module to make use of its isolation:

(Two relays or four, no matter. :grin:)

Now note - you can use the same 5 V to power the relays as the Arduino, but you need to keep the wiring to each part separate and keep the wiring to each part together as a bundle, the control wires and the "5V" to "VCC" as one bundle from the Arduino and the "GND" and "JD-VCC" powering the relays themselves, as another bundle direct to the output terminals of the 5 V power supply.

And you run a separate pair of 5 V and ground wires (such as "figure 8" cable or ribbon) from the output terminals of the 5 V supply itself to the Arduino.

The 5 V supply with transformer, bridge, capacitors and 7805 with heatsink is a trifle quaint. USB "phone chargers" which provide regulated 5 V DC at an Amp or more are pretty common nowadays, even in second hand/ "Op Shops".

Many thanks all for the excellent suggestions, I have a way forwards now! I think I will look at using a phone charger for the 5v, replace the relays with an SSR and separate out the earth wiring all connected together at the source.

To clear up any confusion our generators are connected in star configuration, this gives 3 phases of 230v and a common point which is neutural (earth at the generator). Your average house only recieves one of these phases through a 60A/80A fuse plus the 4th neutural wire, a third wire, local earth, is provided with a 3 foot metal spike in the ground. My house because it is large has two power supplies, both on the same phase to avoid lethal shocks. 115v isn't so dangerous (but can still kill you), 230v gives a nasty kick and can kill if you are unlucky, 415v which is the voltage across two phases is pretty lethal. see below for further explanation