Two (2) buck converters = opto isolation on relay module?

Hi community, I'm a beginner at this whole arduino thing. Codewise, I get around stuff by myself (usually), but I have low experience into building stuff, although the theory of it is familiar to me (I'm grad in teaching science, ive been in a class for 2 years, now owning my own business). Off with the intro: I've built my first full scale project, but now I'm faced with problems.

My prototype (NOT final build) has bad solenoid/inductive feedback through the whole 5V rail, and it makes my 16x2 LCD go mad from time to time.
Build: Inputs - 1x Thermistor and 1x manual on/off switch
Outputs - 1x 16x2 LCD, 1x 8-relay module. (7 pins used)
Power supply: An old yet fully functionnal CPU PSU that could deliver enough amps to fry everything, fused before everything :wink: Rail varies from 5.05V-5.04V no load/under load.
PROBLEM: From time to time, when a relay switches ON OR OFF, observed on at least 4 of the 7 relays, the LCD enters berserk mode and show random numbers and letters while "updating" part of the screen to the programmed intervals.
LIMITS:

  1. I stress-tested the system, and while the LCD is gone wild, the arduino seems 100% fine and responds as expected. Seems like the chip is not affected, although I will not feel safe long term leaving it as is, as it could be destructive to the chip if it is to the LCD...
  2. Most of the time, the LCD will come back to normal when a relay clicks (not necessarily the same who began the problem), but sometimes it will take a while. Very random!
  3. The circuit is extremely basic, no filters whatsoever (I dont have parts on hand). Mostly the 3 shields, wires and resistors, and 1 pot for the LCD.
  4. I know a lot of the similarly reported problems were bad wire connections, I wiggled everything, pressed, re-pressed, etc. Doesnt seem to do much until one of the relays open/closes.

HYPOTHESIS: I read on buck converters, it seems like they would benefit the circuit as I could create 2 separate 5V rails out of a main DC12V already available (which already feeds the relayed circuit and is far from being saturated), and I feel like the buck converters themselves would "filter" between the rails.

This way, I could power the "J" 5V pin of the relays (coil power) in opto-isolation with its own 5V and GND. (no GND between relays and the arduino, as these boards use GND on output pins to close the LED circuit in opto-isolation)

Am I wrong? Would 2 buck converters rated 5V 2A do the trick? Would I need to add further filtration?

As the whole thing is in Prototype mode (lots of wires dangling in mid air), I want to figure it out ASAP before I get my final parts for the 100%-soldered circuit. I may order more parts (yay! gift to me!)

Thank you all for any advice, have a nice holiday season!

Do you have a flyback/snubber diode across your solenoid? You will need one. It will reduce spikes when switching on/off.

Following on from what @blh64 said, read this, which explains the problem: Flyback diodes and why you need them

That doesn't help, loops of wire are wonderful for picking up interference.

Some photos would help, please.

And no, you almost certainly don't need two buck converters, you need to wire one correctly.

Do you have a flyback/snubber diode across your solenoid?

I don't. Not sure if I could put one, as most of the circuit is SMD... I'll have a look if I can do it underside (I have space). Those are the classic opto-driven relays with a phototransistor inside a black box to keep circuits isolated.

And no, you almost certainly don't need two buck converters

As they are so cheap... I figured it would be more time/cost effective for me if it would be a decent isolation between the 2 rails. It'd be faster for me to strap 2 of those on a slightly larger circuit (I have space left) than to start fidgetting with 8 diodes or worse... 8 snubber circuits! :laughing:

Thanks again for the inputs. Also YES! those wire loops are placed different than when I was concept-testing the thing... They dont help for sure!

If you can't fit one, your project is just a pile of scrap, they are essential. You can get SMD diodes so I find it hard to believe that you have no room for them.

Almost certainly the cause of your problem.

There are SMD diodes. Failing that I can't image a solenoid without room somewhere for a diode.
(There is a deeply technical discussion on here from time to time about the best place to put the diode: close to the solenoid or close to the device switching it, however, for most purposes don't worry about it).

It's a predesigned board... not much I can do except tap from the components mounted through holes.

UPDATE: Having a closer look, there is a diode on the board (and it's SMD!), it's right next to the coil. So there IS a diode... now would adding a snubber to the whole thing help in any way? Should it be 1 snubber on the +5V or 8 snubbers to each of the low signal leads?

Couldnt find a lot of info on that, also no information on impedance of the coil to design my own snubber... Really tempted to go double-PSU now :wink:

Hey still no one answered the main question: Would 2 buck converters isolate sub-circuits from noise or do they usually feedback in the providing main DC circuit?

No, snubbers are generally used on mains voltage circuits. Just use extra decoupling, or us a Pi type decoupling filter.
Pi filter.pdf (104.2 KB)

They would help but not provide complete isolation. Normal decoupling techniques would be better.

1 Like

Then either the diode is faulty or something else is going on. Please test the diode and please post some photos and a schematic for your project, it might be clear from those what the problem is.

I guess the answer is probably yes they would provide a degree of isolation. Whether they would fix the problem rather depends on what the root cause of the problem is, which I don't think we have identified.

1 Like

Well put. :grin:

This discussion is getting mildly insane. :roll_eyes:

Who designed it? Did you? Where is the circuit schematic for it?

If you do not know what the circuit is, you clearly cannot use it for whatever purpose. If it is a prototype then it may - or may not - need a complete redesign.

Please start making sense. :thinking:

Hi Paul_B! When speaking about the "predesigned board", I was talking specifically about the shield (8 relay module board), not the actual final project. So this shield is kinda hard to "modify", except for adding stuff to HTH nodes, as its pretty compact already. And also no, there is not a lot of documentation out there for those shields unfortunately.

Note that for sanity, the whole project is mostly a arduino uno, an LCD shield and the 8-relay shield. Plus 3 to 4 10k pull up/down resistors, and a pot for the LCD contrast. Veeeeeery basic.

I'll take a look at the diode. It may very well be bad, I dont expect the shield to be of utmost top quality.

Well then you appear to have broken the forum rules. :astonished:

On review, I see your OP mentioned an "8-relay module. (7 pins used)".

OK, the rule here is, don't hide it! Give us the Web link to that module and we will most likely know exactly what is in it and how it works, and how you need to wire it. It is then most unlikely that anything needs to be added, just understood.

Further than that, if you want useful answers, give us your schematic for the thing (which is to say your whole project) and some photographs taken in daylight so we can see things.

Do not connect your contrast pot to 5 V. That is a longstanding mistake.

Sorry for no answers - It was christmas and I have kids!

Paul_B unfortunately I can't take photo of the thing in plain daylight as it is now test-mounted in a poorly lit area ... Also the wires are mostly the same color and partially hidden in heatshrink, honestly a picture would not be helpful :stuck_out_tongue:

Here's the link to the relay module: https://www.amazon.ca/gp/product/B06XCN5JNH/
As you will see, there are no schematics. I did find stuff online, though.. like this, which seems accurate when probing and following my module's PCB lines and figuring out component values. The Answer is 42!!: Elegoo 8 Channel Relay Module Tutorial

Oh no... My contrast pot is connected to +5V. I guess I did the mistake.

I basically soldered right on the LCD pins so it stays compact: +5V, GND and the potpin to the contrast pin of the LCD. Did I have to add resistors to limit the current there (on the 5V) ? Thanks

Buck converters generate noise because of the switching circuits.
Paul

OK now, that relay board is pretty standard and familiar to us. The tutorial you cite is not at all helpful in explaining how to maintain isolation of the relay power from the control signals.

And the schematic has no useful definition.


Better this diagram:

OK, let's get down to business. :wink:

The first problem which has caused much confusion is that you have described only part of your system - as I see it, an Arduino board, a display and a relay board. And a thermistor and switch. Well now, is the relay board actually connected to anything else to actually switch and control something? If so, what that "something" is becomes a major part of the discussion. There was earlier confusion about "solenoids" and whether they had diodes across them but you never as far as I can see, mentioned "solenoids", only the relay coils on the board you have which became a point of confusion but does necessarily have the requisite diodes included, so not a problem as such.

However,

This will be the source of your problem.

So we will be working blind then. :roll_eyes:

Arduino model not specified. A UNO is a poor choice for a practical project such as this, the "Dupont" jumpers are not really appropriate for long-term operation and vibration could be a concern.

For such projects, we would prefer to have almost all soldered connections - a Nano is appropriate for this as you can obtain them without the pin headers mounted. A "screwshield" is however a good alternative.

The major problem here is the scrambled wiring. To avoid interference between different parts, it is essential to keep all connections between one part and another tightly bundled either by using ribbon-type or "figure-eight" wire, or tying with cord (nylon fishing line is convenient) so that there are no open loops in the wiring between any power or signal line and its matching ground return as such open loops function as little coupling transformers for inteference. If you can trace an open circular path around any part of your wiring loom, you have almost certainly done something wrong.

It is necessary to understand that these microcontrollers operate at "RF" - radio frequencies - and the principles of radio transmission apply.

So for these relay modules - and contrary to what is shown in that supposed "tutorial", you must supply the relay module itself with 5 V to "JD-VCC" with the link removed and the ground connection by a twin cable direct from the terminals of your 5 V supply. Using an old PC supply you can - having removed the connectors - separate out a black and red wire pair to supply this.

Another such pair can supply the Arduino via the "5V" (VCC) pin and ground. The Arduino control pins then run with the 5V to "VCC" as a bundle to the relay board, the relay board does not connect to the ground on the Arduino. Similarly your switches and thermistor (connected to ground, not 5 V) connect via bundles of wires direct to the Arduino.

And the LCD wiring is also bundled to the Arduino.

Finally, the relay contact connections are bundled together (with the nylon line), away from the other wiring, to connect to whatever mysterious things you are controlling.

Hardly surprising seeing how frequently this mistake has been mindlessly copied from one "design" to the next over the years. :grin:

Why would you want to "limit current"? Do not all these things require the correct current?

Many "tutorials" show a 220 Ohm resistor in series with the backlight, but almost all current "1602" LCD displays have a 100 Ohm ("101") resistor as "R8" (occasionally "R9") on the board, so the extra 220 merely dims it slightly.

Technically correct, but a properly designed "buck" converter should generate minimal actual noise and not affect ratiometric analog readings where a voltage divider is compared to the default supply voltage reference.

In any case, the problem here has not been "noise" but switching transients. :grimacing:

So I read a little bit more on switching transients, they would appear to be high-frequency-ish, based on the circuit and how it "would" behave, as I don't own an oscilloscope of any sort.

My guess now is that on my 2nd prototype (which will be more compact, soldered, short leads, leads close to the board, on a perfboard), I would add a simple LC filter to cut at about 150Hz (giving room for the relatively absent noise from the mains). This board is currently being built as a V1... I can have good pics of it soon but I only put down the nano, 4 traces, 2 wires... so not much as of today.

I dont have a diagram yet but here is how I see it being "okay" powerwise:

120VAC - [120 to 24VAC transformer] - full bridge - adj buck conv 3A - *splits
split1: The JD-VCC supply and GND for the relays
split 2: [LC lowpass filter 150Hz] - arduino nano, 1602, sensors, etc.

I dont expect it to be fully filtered, but I guess this placement of the LC filter will attenuate the transients which should be high voltage spikes on nano/milliseconds intervals (ie high freq).

Thanks again for all the precious input. Really trying to design something nice and reliable for my super-secret load (totally separated by the way, wires run far from the duino n stuff) :wink:

PS: The super-secret load is just resistive loads, no coils, motors or anything fancy there. Heating my shop with a blower (controlled externally) and the duino controls the heat inside the thingy as it came with a blown circuit. Before it had a PID for number of elements but now I just hand-adjust with many tresholds, doesnt need to stay at 0.5 degrees as it was designed to before...

What would this filter be doing?

Your problem has nothing whatsoever to do with "noise" - your problem is entirely due to improper wiring. Have I not explained that? :worried:

True. OK anyways I got a lot of those proto boards so lets go ahead and try without. I'll leave space just in case it would behave again...