Flyback Diode not enough?

I'm using flyback diode parallel to a solenoid to protect my 12V power network from reverse currents (at least I think I'm protecting it this way). I do have different Arduinos on the same 12V network and sometimes other microcontrollers do reset, when the solenoid is turned off by the relay. Looks like the flyback diode isn't working or not protecting it enough. Do you have any suggestion? Should I use an additional polarity protection diode before the solenoid?

Maybe it's important to state that the flyback diode is placed right on the relay side (but of course between the two wires coming from the solenoid), while the solenoid is approx. 1m away. Could this "long wire" cause some EMF and voltage spikes?

Remember to use bypass capacitors for the arduino and other devices.

Maybe it’s important to state that the flyback diode is placed right on the relay contacts

This makes no sense at all. A flyback diode has absolutely nothing to do with relay contacts. It goes across the COIL (NOT the CONTACTS).

Look at the schematic (YOU posted) . (the diode is shown across the solenoid , not the contacts)

YOUR RELAY IS WIRED BACKWARDS !

The contacts are supposed to be connected to the solenoid and the relay coil is supposed to be switched with a transistor or mosfet.

The arduino turns on the transistor , which turns on the relay which switches the contacts , which connect the solenoid coil to GND , completing the current path for the solenoid coil.

Usually the solenoid is powered with a transistor or mosfet.
Using a transistor to switch a relay to switch a solenoid is redundant.
It doesn’t mean it won’t work. It just means it is overkill when you only need to switch the solenoid.
What’s messed up is your relay is wired backward. The contacts should be switching the solenoid and the relay coil should be switched by a transistor or mosfet.

Try googling “arduino powering relay and solenoid”

Here’s and example:
arduino relay and solenoid

RELAY DRIVER
driver.jpg

Now imagine solenoid in place of the relay in that schematic.

Alternately you can use the schematic as is an connect the solenoid coil to the N.O. contacts of the relay so the relay contacts complete the circuit path for the solenoid. (although, as I mentioned, that is redundant, unless the solenoid is a very large one.) Even if you did use a relay to switch a solenoid, the COILS of the two devices would NOT be in SERIES as you have depicted.

If you are able to control the solenoid then there is no way it is wired as you have depicted and the schematic is not really telling us how you have it wired.

Look at the relay schematic I posted and then look at the schematic you posted.
Can you find another schematic wired like yours anywhere on the web ? (hopefully not)

Southpark: How can you look at the OP’s schematic and then post this ?

Remember to use bypass capacitors for the arduino and other devices.

(the error is rather obvious)

You're showing the solenoid in SERIES with the relay coil, that can't be right!

And how are the ground wires connected between the various devices and the solenoid.

sometimes other microcontrollers do reset, when the solenoid is turned off by the relay.

OK! Connecting fly-wheel diode in the right way is going save the relay driver transistor. But the complain the OP is making that the MCU gets reset when the relay/solenoid operates. What could be the solution to this problem?

When the relay operates, there are openings of the contacts; current flow is disrupted; spark occurs which randomly triggers the MCU. It like the common problem with the MCU-based unprotected Taximeter which goes crazy when the 15kV spark plug fires!

We need to look at the mechanism how this contact-breaking sparks relate with the MCU-reset process.

Then there are those "hidden" tracks that have to be pulled from a CD and islated to form proper tracks of their own.

The flyback diode will completely prevent high voltage or a spark.

If you are getting a spark, the flyback diode is blown or connected incorrectly. Or, the spark is caused by "something else", somewhere else in the circuit.

Oh my. We are lost aren't we ?

Lost isn't the word. The diagram is gone and somebody edited their post a whole lot more than just typos.

haaslukas:
Could this “long wire” cause some EMF and voltage spikes?

Absolutely, it definitely will, the question is how much - are you using twisted pair? screened cable?
You should be.

Do you have good decoupling at the driver transistor between supply and ground, several uF would be good.

I wouldn’t consider 1 meter ‘long’.
Voltage spikes are typical for back EMF and you have provided no electrical specss or dimensions or photos of the solenoid so we have no way to judge the magnitude of the back EMF from the solenoid and based on what you have posted we can’t even imagine how it is actually wired since it couldn’t be wired as you have depicted if you are able to control it. Why ? Because your arduino digital signal is connected to the relay contacts ,
and the coil (which determines if it is on or off) is not even connected to the arduino . There is no way you could wited it that way if you are able to turn it on and off. Since schematic capture does not seem to be helping here, perhaps drawing the schematic by hand and posting a photo might help. Some photos would help too.

1m of random wire (not twisted pair or shielded) could be a large enclosed loop area though.

There is absolutely no suggestion of a l'loop'. The inference is 'a straight wire'.

Two straight wires, its not an antenna.

Two straight wires = a loop.

Two straight wires = a loop.

How ? (I don't follow that reasoning. To me a 'loop means that the end of one wire wraps around in a circle and is adjacent to the 'begining' of the wire, like you wrapped the wire around the outside of a bucket and slit it off the bucket while holding the two ends at the same place.

edgemoron:
You're showing the solenoid in SERIES with the relay coil, that can't be right!

You're right, my drawing was wrong. It look's more like this:

raschemmel: How ? (I don't follow that reasoning. To me a 'loop means that the end of one wire wraps around in a circle and is adjacent to the 'begining' of the wire, like you wrapped the wire around the outside of a bucket and slit it off the bucket while holding the two ends at the same place.

"Loop" has a technical meaning in electrical engineering. A loop is just a closed path for current to flow through. Every electrical circuit has at least one loop. Most loops in an electronic circuit have much more than wire as a part of them, but they're still loops.

It's almost impossible for two circuits to work correctly if they are connected at less than 2 points. If there's one wire going out to it, there is a return path somewhere. That return path is part of that loop.

Inductive noise pickup is one of the areas where the sanitary assumptions of a schematic are no longer applicable, because the physical area enclosed by a current loop is one of the factors determining how easily noise can be induced in it. It is one of the kinds of noise that twisted-pair cable was invented to protect against.

Let's not forget that this discussion began when the OP said this: "Maybe it's important to state that the flyback diode is placed right on the relay side (but of course between the two wires coming from the solenoid), while the solenoid is approx. 1m away. Could this "long wire" cause some EMF and voltage spikes?"

The 1 m wire is notgiing to cause the arduino to reset. To suggest that is absurd. There is obviously something the OP has not told is , if only because he is unaware. This whole post smacks of inadequate filter caps across the solenoid power and 5V line. Microprocessors control solenoids all over the world without reseting. This discussion of " loops" (FYI, it's called ac'circuut loop' , NOT a ' wire loop' ( like I dicribed). One is is function of simple circuit basics , while the other constitutes a inductive loop, which is totally different. Neither is relavant in this case. It would take any tech or engineer 5 minutes to see what's wrong. We need close up photos of the hardware.

raschemmel: This whole post smacks of inadequate filter caps across the solenoid power and 5V line.

Then I would expect the resets to happen when the solenoid turns on. The inrush is what would cause the brownout.

That it happens when the solenoid is turned off, and because the flyback diode is not in the right place, make me suspect the relay is sparking when it opens. The solenoid might be 1m away, but the relay is probably up close and personal to the controller, and sparks are a very powerful source of EMI.

I agree that the long wires to the solenoid are probably not relevant.

It would be nice to see the rest of the circuit to know how the load and solenoid contacts arching while opening can affect the 12v supply and grounds.