Relay causes errors on MAX7219 7 segment displays

Hi all,

Just installed a relay in my project that uses MAX7219 7 segment displays and i've noticed that when switching the relay On or OFF would sometimes make the displays to output errors or random characters... is this normal? I guess switching frequency, magnetic field... or whatever the relay does is interfering with MAX7219 switching and thus producing an error.

So, one solution i see would be to add N-channel MOSFET, should this be different than relay in terms of interference?
My relay basically just brakes GND link from a series of LEDs to GND but as i need to control this with multiple switches, it goes through the relay so i can control everything from an Arduino pin.

Any help would be appreciated.
Many thanks,
Alek

Hi,
What are you switching with the relay?
If you remove the load from the relay, does its operation still cause the display problem?

Are you switching mains voltage?
If so have you kept the mains wiring away from the controller?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What are you using as a power supply for your project?
What model Arduino are you using?

Tom... :slight_smile:

hi Tom,

Here is a quick diagram, please note that there are no resistors on diodes but this should give you an idea of what i want to do.

So, to answer your questions:

  1. i am switching GND
  2. my project uses UNO and MEGA PRO, both with their own power supply (common GND of course)

Display errors doesnt happen every time i engage the switch which engages the relay but rather it happens on random. When i try to do it without relay and just turn displays ON/OF with a physical switch, display error never happens. But since i need to turn OFF LEDs with the displays as well, i need to use relay and that where problems start.

Many thanks for any tips,
Alek

A couple of possibly stupid questions:

Do you use a bare relay or a relay module?

Operating voltage and current of your relay? Most probably a transistor and possibly a separate power supply is required to drive the relay.

A freewheel diode is required over the relay coil.

I am using relay module and relay DOES have its own power supply, again with common GND with everything.

Its a standard, cheap relay module from amazon, operating voltage should be 5V as i can control it with 5V on other projects without any issues (no 7 segment displays though)

If its not clear, the relay works, everything works as it should and the only problem is display errors when using relay.

Many thanks,
Alek

so, should an N-channel MOSFET as a switch eliminate this problem?

Many thanks,
Alek

elcrni:
I am using relay module and relay DOES have its own power supply, again with common GND with everything.

Its a standard, cheap relay module from amazon, operating voltage should be 5V as i can control it with 5V on other projects without any issues (no 7 segment displays though)

OK, now give us the Web reference for the relay module, and explain exactly what you are using as a 5 V power supply and what you mean by "relay DOES have its own power supply" and "UNO and MEGA PRO, both with their own power supply" as well as how you have it all wired together?

Ok, i can not draw a diagram at the moment but basically, i am using TRACO POWER 1-2450 5V power supply for each. Wallwart (9V) connects to all 3 of them. So one 1-2450 for relay, one for MEGA and one for UNO. After a lot of testing and having each of them have its own power supply i was able to greatly reduce interference and noise from MAX7219 chips on other components and sensors.

I can not find that relay online any more, got it long time ago but something like this:

and power supply:

Many thanks,
Alek

reading about using PN2222 as a switch... will have to test it out

So you feed 9V into the 5V relay modules? Please check each relay module separately, perhaps one has already been damaged.

DrDiettrich:
So you feed 9V into the 5V relay modules? Please check each relay module separately, perhaps one has already been damaged.

no no no, maybe i was not clear, i am feeding 9V into each Traco 2450 DC/DC converter that then outputs 5V to each, UNO, MEGA and relay.

elcrni:
reading about using PN2222 as a switch... will have to test it out

No, that makes no sense. The relay module you have already contains the switching transistor, That is not the problem.

The problem is the wiring layout. You need to keep all the wiring from module to module tightly bundled, forming no open loops separating supply from ground or control signal from ground, which can variously radiate or pick up impulse interference.

While those DC-DC converters look good, they clearly have minimal capacitance across the output (or indeed, input). Put a 470 µF capacitor across the Vcc and Ground connections of the actual relay module. It already includes the "kickback" diode.

But note the need to keep the wiring to the relay contacts also paired and away from all the other logic wiring.

DrDiettrich:
So you feed 9V into the 5V relay modules? Please check each relay module separately, perhaps one has already been damaged.

You are not likely to damage a 5 V relay (module) by feeding it 9 V. :astonished: Certainly not in a hurry.

(90 mA x 9 V - 810 mW)

OK, just connected the transistor PN2222 and it works without errors on 7 segment displays BUT, i have a feeling i am doing something wrong here.
It does work, it does break the circuit and turns LEDs ON and OFF but when they are OFF they still flicker slightly, not visible in bright conditions but when i turn of light in the room i can clearly see it.

GND from power supply goes into PIN1 of the transistor, PIN12 from MEGA goes to base middle pin and then GND goes out from PIN3 of the transistor.
I have 1k resistor on MEGA to BASE pin.

Ah i just seen the replies... one thing that bothers me with relays is that they "click" :slight_smile: and even i do love relays, i would like some other solution here that does not "click" when switched ON or OFF.

I DO have 220uF capacitors added on all 3 1-2450 step down modules.

And yes, need to tidy up the wiring a bit indeed

Any other suggestion would be appreciated.

Many thanks guys!
Alek

Hi,
When you can, a schematic (even pencil/paper) and a picture of your project please.

Thanks.. Tom... :slight_smile:

Ok, i've put 470uF on the relay and the same thing happens again, messes up 7 seg displays after a random number of turn ON/OFF cycles.

I use 2 physical switches, one controls LEDs only and the other one both all displays and all leds. Errors happen only when i turn ON/OFF the second one that controls displays and LEDs.
If i cycle switch for LEDs only, it doesnt seem to affect displays.

Interesting thing is, if i turn OFF LEDs with LEDs switch and then just cycle ON/OFF the displays alone, no error happens.

So it ONLY happens when i control both, LEDs and displays at the same time.

TomGeorge:
Hi,
When you can, a schematic (even pencil/paper) and a picture of your project please.

Thanks.. Tom... :slight_smile:

Unfortunately i still don't have a scheme of my rig and to make it would require days, as my setup is quite complex.
I can perhaps only make a scheme of how relay connects to the rig...

Many thanks,
Alek

Ok, got it all working nicely with PN2222. this is now resolved.
Many thanks to all!

Hi,

Unfortunately i still don't have a scheme of my rig and to make it would require days, as my setup is quite complex.
I can perhaps only make a scheme of how relay connects to the rig...

That would be fine, please show how you have the relay module connected to the controller with the PN2222 and the relay to the load and its power supply.

If your project is now so complex hardware wise, now is a good reason to make a good schematic for future reference and troubleshooting.
In doing so you may find other potential problems or wiring redundancies.

Thanks... Tom.. :slight_smile:

In case you control the power to the entire display including the MAX, then you should disconnect not only power but allso all signal lines. After turning the display on again the MAX has to be initialized again.