Using Latex Code for Circuit Diagrams

  • Thread starter Thread starter neilparker62
  • Start date Start date
AI Thread Summary
The discussion focuses on using LaTeX code to create circuit diagrams, specifically for an electrical relay with normally open (n/o) and normally closed (n/c) terminals. Users express that while it is not possible to draw such diagrams in standard LaTeX without packages, tools like TikZ and CircuiTikz can be utilized effectively with some learning. A user shares a link to a circuit diagram generator that outputs LaTeX code, which meets their needs. The conversation then shifts to the functionality of a relay control circuit for a gate motor, emphasizing the importance of electrical interlock to prevent simultaneous activation of forward and reverse terminals. Concerns about the clarity of switch functions in the diagram and potential safety issues are raised, highlighting the need for precise representation in circuit designs.
neilparker62
Science Advisor
Homework Helper
Insights Author
Messages
1,191
Reaction score
683
TL;DR Summary
Need Latex code for an electrical relay
Hi

Just wondering if there's any example Latex code to draw a simple electrical relay with the usual n/o , n/c and common terminals. Maybe with n/o attached to some kind of load ? I see there are circuit diagram packages for Latex but I don't know how to use them at all
 
Engineering news on Phys.org
I have not specifically tried to make such diagram in Latex, but if you are asking if it possible to make electric circuit diagrams in a standard Latex environment without using any package then I am fairly sure the answer is no. What is wrong (for you) with using something like TikZ with IEC or the CircuiTikz package or similar, other than perhaps spending time learning how that package works? Are you perhaps looking for an graphical editor instead?

Edit: added IEC link.
 
Last edited:
  • Like
Likes neilparker62
Filip Larsen said:
I have not specifically tried to make such diagram in Latex, but if you are asking if it possible to make electric circuit diagrams in a standard Latex environment without using any package then I am fairly sure the answer is no. What is wrong (for you) with using something like TikZ with IEC or the CircuiTikz package or similar, other than perhaps spending time learning how that package works? Are you perhaps looking for an graphical editor instead?

Edit: added IEC link.
The CircuiTikz link is great. Many thanks. I am using Overleaf for all such projects and can certainly spend some time learning how the package works per examples given.
 
  • Like
Likes berkeman and Filip Larsen
neilparker62 said:
The CircuiTikz link is great. Many thanks. I am using Overleaf for all such projects and can certainly spend some time learning how the package works per examples given.
See also https://circuit2tikz.tf.fau.de/designer/ where you can put together a circuit diagram and then generate Latex code for it. Which is exactly what I wanted!
 
  • Informative
  • Like
Likes Filip Larsen and berkeman
So now - if you'll please forgive being off topic from the original thread. Will the follow relay control circuit work for driving forward and reverse terminals of a gate motor ? I used the above link for my circuit design! Relays are connected for 'electrical interlock' meaning it should not be possible for both fwd and rvs terminals to be activated at the same time. Physically that is implemented as a jumper wire between the relay commons. If the fwd n/o is closed, the right hand motor will be connected and vv for the reverse. If both fwd and rvs are somehow activated at the same time, both n/c s will be open and there will be no connection to either terminal.

Design notes / recommendations on fuses and TVS diodes below are from Chatgpt.


1746680869129.webp

Design Notes
Motors: 230 V AC, 0.5 HP induction motors.
Motor windings: 10 ohm resistance, 90 mH inductance.
TVS Diodes: SMCJ440CA — bidirectional, 440 V clamping.
Fuses: 500 mA fast-blow, 600 V AC rated — placed in series with each TVS diode.
Purpose: Suppress voltage transients across motor windings during switching by relays.
 
neilparker62 said:
Will the follow relay control circuit work for driving forward and reverse terminals of a gate motor ?
I have a problem making sense of how the "FWD" AND "REV" switches function. The way they are connected, the switches are connected in parallel so whichever is 'on', both coils will be activated. That horizontal line doesn't make sense. without some 'context'.
 
sophiecentaur said:
I have a problem making sense of how the "FWD" AND "REV" switches function. The way they are connected, the switches are connected in parallel so whichever is 'on', both coils will be activated. That horizontal line doesn't make sense. without some 'context'.
The key point is that if a normally open switch (one of the two at the top) closes, the corresponding normally closed switch (one of the two below) opens. If (say) the FWD (no) switch closes the nc on that side opens so current has no path to the left hand circuit. It must cross to the right via the connecting line and then through the (still closed) nc on that side to the circuit on the right which represents the forward motor winding. I should have labelled it as such. Current flows per red path or per green path below but the two paths are mutually exclusive. If both fwd and rvs (normally open) are activated at the same time, both normally closed switches will be open and there will be no current path at all between live and neutral. This is electrical interlock - it's similar to the way an XOR logic gate operates.

1747166105574.webp
 
Here is 24V DC relay switch. At 'rest' the movable arm(centre) is in contact with the left terminal (normally closed). When the relay's electromagnetic is activated the movable arm will make contact on the right (normally open) leaving an open circuit on the left.

1747166981077.webp
 
Are you prepared to use resistors that can handle 100 watts?
 
  • #10
Averagesupernova said:
Are you prepared to use resistors that can handle 100 watts?
The 10 ohm resistor and 90mH inductor are a simplified circuit representation of a motor winding.

Edit: We decided our Sainsmart 4-channel relay set (albeit rated at 10 amp) is not suitable for driving an AC inductive load. So we're going to rather let it drive a contactor control coil. Which should reduce the load considerably. In case there's any confusion the Sainsmart relay is NOT the one I photographed above. It's this set:

1747212133809.webp
 
Last edited:
  • Like
Likes Averagesupernova
  • #11
neilparker62 said:
This is electrical interlock - it's similar to the way an XOR logic gate operates.
AH; that makes some sense to me now. Those basic switch symbols actually contain a lot of 'extra' implied functions. I guess it may work ok for 'slow' logic but it seems to me that it introduces a potential logic hazard if the operating time for the switches vary. To make the diagram represent the actual situation, the switch functions should really be defined more fully. I would imagine this sort of practice would be very risky in vital equipment as it would be relatively easy to tidy it up with a better designed bit of (synchronous) logic.
 
  • #12
sophiecentaur said:
I guess it may work ok for 'slow' logic but it seems to me that it introduces a potential logic hazard if the operating time for the switches vary.
The drawing is a little confusing but I seriously doubt it's any less safe than whatever is driving it.
 
  • #13
Averagesupernova said:
I seriously doubt it's any less safe than whatever is driving it.
If those two switches were not as you describe then the function of the whole circuit would / could be totally the other way round. It may work fine but what happens when someone introduces two different switches and is not aware of the spec? Those basic symbols are not sufficient. If you were to try to use an emulator to study what happens, how would the emulator 'fill in the blanks'?
 
  • #14
sophiecentaur said:
Those basic symbols are not sufficient.
Averagesupernova said:
The drawing is a little confusing...

Engineering for someone's stupidity/misunderstandings/etc in the future concerning parts replacement is an exercise in futility after a point. There's no end to what-ifs.
-
Automotive relays come to mind. Many variations of these ice cube shaped relays exist. Some with diodes across the coil for flyback protection. There could be cases where one is without the diode is replaced by one with. In some cases the diode could be forward biased when voltage is applied to the coil. If whoever installed the original didn't follow a standard that could happen. It's never happened to me but it could have as I have wired up a lot of them without a diode not paying attention to coil connections.
 
  • #15
sophiecentaur said:
AH; that makes some sense to me now. Those basic switch symbols actually contain a lot of 'extra' implied functions. I guess it may work ok for 'slow' logic but it seems to me that it introduces a potential logic hazard if the operating time for the switches vary. To make the diagram represent the actual situation, the switch functions should really be defined more fully. I would imagine this sort of practice would be very risky in vital equipment as it would be relatively easy to tidy it up with a better designed bit of (synchronous) logic.
Well here's a very thorough operational explanation from Chat gpt. We've included snubber circuits mainly to protect the relay contacts from arcing and (as mentioned above) we've decided that the relays are not good enough to drive AC motors directly so now they are shown driving control coils for contactors.
 

Attachments

  • Like
Likes sophiecentaur
  • #16
neilparker62 said:
Well here's a very thorough operational explanation from Chat gpt.
That's fair enough but, on that diagram, there are two pretty vital elements that are not specified. The other components are specified well enough in as far as their relevant functions go. From your description, the way those switches work is very relevant, in a basic way, to the operation of the circuit. Make before break or the opposite could make a huge difference to how it works. That would be made clear in the parts list and in any description of the way things work so no worries but it raised an alarm for me, an ignoramus about automotive electronics. I guess it's basically a bistable / latching circuit.
 
  • #17
I have never heard of a SPDT relay that is not break before make. It may exist and I've never searched for one, but I think it would be very uncommon.
-
As far as I can tell there is no latching. I believe we are to understand that the coils in the schematic are contactor coils that control the motor. They are not coils for the relay contacts in the schematic. The whole point of the circuit is to prevent both loads from being energized at the same time.
-
Maybe I understand this more easily because I have done something similar. I converted an Eaton 10 speed Autoshift transmission to manual. There are minor differences between the two. These transmissions are not automatic in the conventional sense of having clutch packs or bands with planetary gear sets. Instead of that they are just like a manual with servo motors to move the shift collars. There are speed sensors in the transmission to synchronize shaft speeds while the transmission computer controls the throttle. The main clutch is NOT controlled by the transmission computer. Only the driver when starting from a stop. There are two ranges in this particular transmission that are shifted by air actuators. That's where the interlock logic comes in. It prevents the transmission from trying to shift both actuators at the same time. In true manual Eaton transmissions this logic was done with an air valve. The automatics were not cast with this provision to only allow range shifting while going through neutral. Mechanical linkage provided this in an original manual transmission. I used the neutral safety switch and relay interlock in my conversion. Trust me, the relay logic shown will work. The relay logic in my case was set up to be latching.
 
  • #18
Averagesupernova said:
As far as I can tell there is no latching. I

Averagesupernova said:
The relay logic in my case was set up to be latching.
Sorry. I am still confused. To latch or not to latch, that is the question?

Surely this is a bistable control. Pressing the same switch twice will (should ) not change things. That is described as a latching function.
 
  • #19
@sophiecentaur The example I gave with the transmission conversion was latching. How can you possibly get that mixed up with what @neilparker62 is doing which is not latching?
-
The PDF posted in this thread explains it quite well. The coils shown in the drawing(s) are not and have never been implied to be the coils for the relay contacts shown. So they cannot be latching based on the drawings given. The first drawing of this thread they were to be motors. Later in the thread it was explained that this had been changed so now the coils shown are coils for contactors. They are coils for other components that are not shown on the schematic. Replace the relay contacts shown with SPDT toggle switches and it might sink in what is happening here.
 
  • #20
Averagesupernova said:
How can you possibly get that mixed up with what @neilparker62 is doing which is not latching?
Post #17 is the cause of my confusion. It doesn't use the right way of inserting quotes. I couldn't be bothered to sort out how the post should have been written.

In any case, launching out on the details of the whole switching circuit doesn't clear up the basic error (yes it is an error) in the drawing with the two simple switches connected in parallel with no other circuit elements with suitable reactances and resistances to separate the effects of the two switches. That horizontal link and the two added coloured paths do not make sense and explain nothing about the situation with change over action. One switch could possibly cause a flip-flop action if the relays worked appropriately but there is no way that one switch would work differently from the other one. If we can't rely on 'a switch equals an ideal switch and a wire equals an ideal wire' then circuit diagrams are meaningless.
 
  • #21
sophiecentaur said:
Post #17 is the cause of my confusion. It doesn't use the right way of inserting quotes. I couldn't be bothered to sort out how the post should have been written.
There was no intention of inserting quotes.
-
Again you talk of latches and flip flops when there is no such connection to cause this. I've redrawn it. It might make more sense. K1 and K2 coils are driven by some means. We are not told specifically what but as far as I'm concerned the voltage applied to them is independent of any contact position shown on the schematic. K3 and K4 coils are the coils for other relays not shown in this schematic.
17475083947099003852984314733027.webp

No flip flop or latch action will occur.
-
Edit: I drew it a little different unintentionally. The original drawing shows the current crossing as @neilparker62 showed. My drawing doesn't have the NC relay contacts placed the same but electrically there is no difference.
 
Last edited:
  • #22
The relay set we are working with is the one in the pic above which I will repeat here:

1747599958100.webp


Each relay has 3 output terminals: the no, the common and the nc as shown at the top of the board. They are just switches - nothing more , nothing less. Input pins showing at the lower right are driven from raspberry pi GPIO pins. There's certainly no latching or flip flop circuitry that my simple mind is aware of anyway!

Anyway the main query is about snubber circuitry since the relays are driving inductive loads. So I am just wondering what the current wisdom is about those. Just RC circuits ? Or TVS diodes ? Maybe even a combination of both ? We managed to melt an MOV (metal oxide varistor) which wasn't very clever! Probably did not calculate carefully enough the transient high voltage spike energy release. Now we've reverted to a simple RC series circuit and we're not seeing any arcing across the relay contacts. So it seems to be working.
 
  • #23
You are driving inductive loads, so based on previous discussion these relays will be driving the coils for heavy duty contactors correct? All fine and well but you haven't specified the voltage for those coils. Motor contactors are available with many different coil voltages. AC or DC.
 
  • Like
Likes neilparker62
  • #24
Averagesupernova said:
You are driving inductive loads, so based on previous discussion these relays will be driving the coils for heavy duty contactors correct? All fine and well but you haven't specified the voltage for those coils. Motor contactors are available with many different coil voltages. AC or DC.
230 Volt AC contactor control coil(s). I should mention that in post #22 snubbers designed for the direct AC load are working but the switching is a bit "iffy". Contactors are on order and we intend putting them in. So we do need snubbers (or other electronics) to handle the transients from contactor control coils.
 
Last edited:
  • #25
Averagesupernova said:
Edit: I drew it a little different unintentionally. The original drawing shows the current crossing as @neilparker62 showed.
That makes some sense now and it is a basic bistable circuit; that's all sorted then :smile: . This proves how important it is to stick to the conventions.
 
  • #26
Averagesupernova said:
You are driving inductive loads, so based on previous discussion these relays will be driving the coils for heavy duty contactors correct? All fine and well but you haven't specified the voltage for those coils. Motor contactors are available with many different coil voltages. AC or DC.
Apologies so long responding. We are using 230 volt contactors and the same for the contactor control coils.
 

Similar threads

Replies
5
Views
712
Replies
11
Views
2K
Replies
3
Views
3K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
14
Views
2K
Replies
1
Views
2K
Back
Top