1

I am wiring up a light show for my pickup truck.

I have installed various high power spotlights and light bars into a dedicated relay/fuse box in the engine bay. These relays are wired into a switch panel in the dashboard and work beautifully using the manual switches.

I have subsequently set up a brain...

  • An Arduino Uno R3, programmed with 3 different light sequences;
  • An 8 bank 5v relay module, driven from Digital Out Pins 6 to 12, each relay on the module fires a separate light (via the existing relays in the engine bay).
  • A 4 Channel RF receiver, provides Digital In Pins 3 to 5, to select one of the three sequences, and Digital In Pin 2 Interrupt as a stop/reset button.

I have set this up to start a sequence from an RF button, and programmed the Arduino to fire the relays, including strobe, which was working great on the LED's I attached while testing.

However, when I wire them up to bridge the switches on the dashboard (in turn firing the relays in the engine bay), the Arduino receives a positive signal on INPUT_PULL Pin 2 after a couple of flashes. I think this is something to do with an interference caused by the back EMF from the relay coils in the engine bay, possibly striking the relay module causing it to fire the interrupt pin 2 and causing a reset.

Looks like I need a snubber. I think the best answer is to install a flyback diode across the coil on the relay in the engine bay, but have been trying to figure out how I can wire these up within the blue box, without dismantling the relays installed in the engine bay. I thought maybe I could connect general ground to the manual switch (long route of achieving the same circuit), which helped but after a few more flashes the Arduino gets a signal to reset again. I have lots of diodes and RC Snubber circuits from Amazon which I was going to try, maybe across the Module Relay contacts.

This is a circuit for one of the eight lights.

Please advice how I can reduce this interference using snubbers or some other modification, ideally within the blue box.

Thanks

Circuit

UPDATE:

I have managed to get a working setup by removing the resistor and the 5v feed to the RF Relay. Also adding a Diode from earth to the top side of the Module Relay connector. See updated circuit below. Seems to be working, though I'll have a go at adding RC Snubbers as suggested.

enter image description here

10
  • I don't see how the "relay for light 1" relay can interfere with the Arduino, other that the change in load generating some noise on the 12V DC. I think the real problem is running 8 relays from the 5V created by the UNOs voltage regulator. Especially with a noisy 12V input. I don't think the UNOs power supply circuit is made for automotive. I'd get get one of those phone chargers for cars, and use that to power the UNO and relay board.
    – Gerben
    Jul 12 at 15:04
  • I have one of those, was running it off of a 5v USB connection initially, read an article saying that you should not power them from the USB connector. So I even tried from a 9v battery to try and isolate the problem. For now I am just trying with 1 relay until I get it working.
    – Matt D
    Jul 12 at 15:22
  • @Gerben Seems I should widen the net slightly for full disclosure. I've narrowed it down to something else... I have a 4 button RF Remote Control, the receiver is in the blue box, one of the buttons fires another relay that has an interrupt input into the Arduino, and does an _Init(). Seems this is being fired when "relay for light 1" is disengaged. I will update the question and the diagram.
    – Matt D
    Jul 12 at 16:06
  • 2
    Are you using an internal pullup resistor on Pin 2? The internal pullup is about 20K to 50K, but there is also a 10K external pulldown on that pin. It should be either pullup or pulldown, but not both. Also consider using a 1K resistor instead of the 10K to provide a stronger pulldown and greater noise immunity. And you could replace all the relays with MOSFETs.
    – tim
    Jul 13 at 12:51
  • 1
    That 10K resistor should be removed completely. It's not achieving anything useful, and is in fact causing the input to be far too sensitive to noise. You should use a pullup resistor of 10K or less instead of the internal (very weak) pullup.
    – Majenko
    Jul 13 at 13:27
3

There are two things to tackle in your schematic. First is snubber networks. These are used to aid in the prevention (or rapid extinguishing) of sparks between the contacts of switching gear (like relays). You should attach one across the contacts of each relay. It is these sparks that create most of the "airborne" EMI.

A diode across a relay's coil only deals with "wire-born" EMI (in the form of induced back-EMF) and has no relevance in your circuit due to the galvanic isolation of the first stage relay and the driver circuit in the module.

The second, and more important, thing to deal with is your input pin. Firstly the built-in pull-up resistor is very very weak. It's usually around 30kΩ, and that is very easy for "airborne" EMI to overcome. You should avoid using it. Instead an external pull-up resistor of no more than 10kΩ (I'd recommend 1kΩ as a good value) should be used.

Secondly you have a 10kΩ resistor in series with your switching contacts. This will not be helping to get a logic LOW level when the switch contacts are closed since it forms a resistive divider with the pull-up resistor. As it is it happens to just work with the internal pull-up, since the internal pull-up is greater than the 10kΩ series resistor. Reduce the pull-up with an external and that will no longer be the case.

That 10kΩ resistor should be removed completely.

Here is your circuit with modifications in red:

enter image description here

5
  • That looks like a good plan, I'll give it a shot. I have actually been trying a few things and got it to work. First I removed the resistor, removed the 5v wire to the same relay, left as INPUT_PULLUP. Then I added a Diode from ground to the top side of the Module Relay for flyback. That seems to work, strobe and everything, but I may have a ticking timebomb!!
    – Matt D
    Jul 13 at 15:41
  • Added an updated circuit with my changes. Thoughts?
    – Matt D
    Jul 13 at 16:43
  • 1
    @MattD I would still recommend adding the smaller pullup resistor on the input pin. It will help it be more immune to noise. Snubbers are still a good idea to add, although the diode you added is doing most of the job of the snubber for the inductive load of the second relay. You should consider adding one to the second relay's contacts though, if only to increase their lifetime.
    – Majenko
    Jul 13 at 16:51
  • Thanks for your help, it's all working now, got 4 inputs and 8 outputs to do the same, that's a fair bit of wiring, I think I'll need to put together a strip board to tidy it all up.
    – Matt D
    Jul 13 at 22:01
  • The internal pullup was ok when the car wasn't running, but was not enough with the engine on. Putting in the 1K external pullup resistor worked a treat, even when running. Thanks!
    – Matt D
    Aug 6 at 11:51
1

Here is a general idea of a MOSFET alternative for switching the light on and off.


Click to simulate in Falstad.

You can click the switch and the H/L input to see how it operates while running the simulation.

The p-channel MOSFET in series with Light 1 could be FQP27P06.

The n-channel MOSFETs are of much lower power.

Using MOSFETs eliminates both the RFI/EMI interference from sparks across relay contacts and the surges/noise from the collapsing electric field of the coils of the relays.

1
  • I like the idea of this (still getting my head around it tbh)... but I can't get around the wiring in the engine bay, that needs to be the existing relay. I think it's too much of a change for me at the moment, though I will consider parts of this if I end up taking it further. Thanks
    – Matt D
    Jul 13 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.