Do I need to add a diode on a coil?

In the circuit shown the contact on the ground side of the coil is currently a mechanical switch.
If I replace this mechanical switch with a relay driven by the Arduino, do I have to add a diode on the existing coil ?

Yes

Read this discussion:

https://forum.arduino.cc/index.php?topic=705982.0

Your circuit is somewhat meaningless. Once the capacitor is loaded no more current will flow. Do you mean to switch the right (capacitor) connection alternatively to Gnd (-) and Vcc (+)?

I agree with reply #2. First of all, there is no "ground side of the coil", it doesn't connect to ground anywhere. Secondly, you don't show any switch so it's not possible to know where it is actually connected. Please provide a diagram that correctly shows all the components and connections.

Or tell us the purpose of the circuit, perhaps you are trying something stupid.

The OP is using a symbol for a switch used in mechanical engineering, not in electronics. :roll_eyes:

A relay is just another switch. Generally they will tolerate some arcing; it depends on just what the "coil" is but a diode - conservatively rated for the operating current for the coil and the same supply voltage - will suppress arcing but delay the release of the coil which may matter in some circumstances.

The release delay can be reduced by a resistor in series with the diode, typically the same resistance as of the coil.

DrDiettrich:
Your circuit is somewhat meaningless. Once the capacitor is loaded no more current will flow. Do you mean to switch the right (capacitor) connection alternatively to Gnd (-) and Vcc (+)?

in ladder logic, that is a switch

Qsilverrdc:
In the circuit shown the contact on the ground side of the coil is currently a mechanical switch.
If I replace this mechanical switch with a relay driven by the Arduino, do I have to add a diode on the existing coil ?

SOME coils yes, others, no, NEVER in AC voltage
it would not hurt.
also, you don't list your power voltage so that is a bit confusing.
if it is 5v AND you are powering any other electronics, then a spike from a coil could effect their operation. In which case, emphatically YES, ADD the diode.

if you do add a diode, it is reverse. it allows the flow from ground to power.
if you put it in to allow power to ground it becomes a short in the circuit.

Ladder logic is not something we see here everyday as you can tell.
as a note, I typically put the 'thing' (coil, light, buzzer) by the ground. switch to the left, coil to the right.
left is the 'conditions' side and the right is the 'actions or results' side

you show the coil as always having potential.

OK,
Hi all will give all of the big picture. Please see the attached.
This is the controll circuit of a 1960's vintage bowling pin spotter.
When PR1 is energized pins will feed to the table spotting cups. The pins pass by a mechanical switch counter (sw5), indexing 1 to 9 keeping PR1 energized until the 10th pin is fed, then PR1 deenergizes.
The switch (sw5) is physically about 6ft of away connected by 2 wires and the machine frame (ground).
The system is very mechanical and every so often will miss a count, so will feed 11 pins. The machine will now require the attendant to reset the machine. This can take up to 5 minutes or longer. Working counters are getting harder to find.

So my thought is to replace the mechanical counter with an IR break beam sensor, and a mechanical relay.

Here is a link to a video. You can see the counter on the bracket.
82-30 pin feed

On DC coils then I'd say yes has it stops the back EMF and the spikes of the coil going into the electronics.
The sudden collapse of the magnetic field induces a brief high voltage across the coil which is very likely to damage transistors and ICs. The protection diode allows the induced voltage to drive a brief current through the coil (and diode) so the magnetic field dies away quickly rather than instantly.

In our access platforms they all use diodes for this reason.

I would recommend you look at the three solutions separately.

#1 cobble together a custom, one off unit to fix the immediate problem

#2 engineer and design a module for use with any relay. Or just buy a RIB module.RIB makes a variety of relays for industrial use.

#3 design a full blown replacement panel.

Buy relay modules not individual relays.

Holy cow, what a setup. So the schematic must be for the whole bowling alley. The video really helps to clarify what's going on.

This looks like an ideal setup for an electronic solution. There is a nice big bracket on which to mount a detector, or an emitter-detector pair (and there are several detection technologies to choose from). You will need something to convert the pulse from the sensor into something usable, and also to ensure that one and only one pulse is produced per pin. It might actually be better to detect the movement of the existing switch arm than the pin itself. Then you will need to count the pulses and send an appropriate, compatible signal to the rest of the electrics. All of this is doable and would make for a really cool project. But there also some potential snags, so you'd want to retrofit only one or two lanes at first, and track them for a couple of weeks to make sure that the cure isn't worse than the disease.

S.

srturner:
Holy cow, what a setup. So the schematic must be for the whole bowling alley. The video really helps to clarify what's going on.

This looks like an ideal setup for an electronic solution. There is a nice big bracket on which to mount a detector, or an emitter-detector pair (and there are several detection technologies to choose from). You will need something to convert the pulse from the sensor into something usable, and also to ensure that one and only one pulse is produced per pin. It might actually be better to detect the movement of the existing switch arm than the pin itself. Then you will need to count the pulses and send an appropriate, compatible signal to the rest of the electrics. All of this is doable and would make for a really cool project. But there also some potential snags, so you'd want to retrofit only one or two lanes at first, and track them for a couple of weeks to make sure that the cure isn't worse than the disease.

S.

I agree. The schematic shows most of 1 lane. There is a 6 level 11 step rotary contractor. In the particular chassis I have, these rotary steppers were replaced with a digital. There are still centers with stepper relays.. I have decided that it will be a thru beam IR connected to an Arduino, not sure which one at the end of the day. The minimum timing between pins is known, so getting accurate pin detect should be somewhat simple. There are quite a few power interuption related issues. For example if the feed is on pin 3 and the power is dropped because of the off spot switches, what happens on power up? A mechanical switch has no issues with memory.

Paul__B:
The OP is using a symbol for a switch used in mechanical engineering, not in electronics. :roll_eyes:

I guess I should have used a couple labels. In lader a contact looks like a capacitor. I see the confusion created.

Qsilverrdc:
There are quite a few power interuption related issues. For example if the feed is on pin 3 and the power is dropped because of the off spot switches, what happens on power up? A mechanical switch has no issues with memory.

Yes, that's important to think about. If the interruptions are mostly momentary, like a second or two, that can be solved by a supercap. But you still need to address the larger issue of a longer outage, which would result in an unknown equipment state unless you constantly write state information to nonvolatile memory.
S.

In the existing circuit, SW4 is mechanically closed when the machine is in the zero position.
Would it be possible to monitor the status of the switch without affecting the operation kind of like I have shown?
How little current is needed for an Arduio input?

Qsilverrdc:
In the existing circuit, SW4 is mechanically closed when the machine is in the zero position.
Would it be possible to monitor the status of the switch without affecting the operation kind of like I have shown?
How little current is needed for an Arduio input?

It's possible to do, and the Arduino needs miniscule input current (for the purposes here almost zero). More importantly, though, you can't feed 24v directly into a logic input. You will want to drop it down to the logic level of the Arduino used (usually 5v). You should measure what voltages are present on the switch in its two states. I'm having some trouble with your schematic, which is nonstandard (despite being a work of art in its own right).
S.

Getting back to #5, what is the resistance of the solenoids? To determine the diodes, we need to know how much current the solenoid draws. If the resistance is more than 25 Ohms, then the current is less than 1 Amp and the common 1N4004 (or equivalent) diode will fit the job perfectly, If more than one Amp (and less than five), you need the 1N5404 or equivalent.

Having the switches going to ground is excellent as that neatly matches what we do in digital electronics. To monitor the state of a grounded switch, you put a diode in series between it and the solenoid, cathode end to the switch. Another diode - also cathode to switch but does not need to be a power diode, a 1N914 or similar will do - isolates the logic circuit which uses a pull-up to 5 V to sense the switch however if you do this you must have the "back-EMF" diode across each solenoid. :sunglasses:

In this pinspotter application, the solenoid release time is not going to be a concern.