PLCS.net -- Your Personal PLC Tutor Site
           FREE PLC programming info... in plain English!
                     http://www.plcs.net
***** Wiring the -smart- way for programming (((smart designing)))
There are many ways to design a circuit or a PLC program. Many people
believe that if the design works, then it's ok. Perhaps this is true
but why not do it with failures in mind. After all, we want the 
machine operators, us, and even the boss to be proud of our work, don't
we? (I hope your thinking -yes- , even about the boss being proud, but
they probably won't say anything!)
Ok, let's consider a conveyor running through our monster-sized 
factory with multiple detection sensors looking for various product 
defects. If any one of the sensors is activated, the conveying system
should shut-down so we can examine the manufacturing fault. (after all
bad product is worse than no product... unless you're M**rosoft...just
kidding!)
If you think quickly, it would seem simple. Just use multiple normally
open sensors wired in parallel with each other. The plc ladder logic 
program would look like this:
   sensor A      conveyor off output 
----|  |----------------(  )---
   sensor B | 
----|  |----
   sensor C | 
----|  |----
   sensor D | 
----|  |----
Here we can see that if any of the sensors should detect a defect
the sensor will turn on its output and the plc input should close, the 
conveyor off output will turn on and disable the conveyor. We can add
more sensors if we wanted to. It's basically an OR ladder. In other
words, if sensor a -OR- b -OR- c -OR- d should turn-on, the conveyor
output coil will energize and disable the conveyor. Seems ok, little 
chance of a problem... right? Wrong! You're probably thinking "What, 
is he CRAZY?" I might be, but not in this case. Read on.
What happens if we get a cable failure? (not like cable tv going out 
again but rather a broken wire) Believe it or not, -open circuit-
failures are the most common problems that happen. Examples of open
circuit failures include-- blown fuses, broken wire connections, loose
wires, failed switches, failed sensors, fried relay contacts... and
the list goes on.
Now that we understand the theory, let's redesign to be more on-guard
for such things. Suppose sensor B (in the example above) fails open.
If a bad product appears we want its output to close(turn on) but 
nothing would happen and the conveyor would continue on its merry way.
(Does that explain buggy software??) How about if a wire connecting
sensor C to the PLC input terminal breaks? Then sensor C is of no use
since it won't stop the conveyor! Ideally, the system is tested 
regularly during routine maintenance and the problem would be 
discovered... but what if maintenance is missed??(never happens in the
real world, right?!?)
Here's a -better- solution. Lets replace the normally open sensors
with normally closed types. (i.e. their output is ON unless there's a
problem) Here's our modified plc ladder program to reflect a change:
   sensor A      conveyor off output 
----|\ |----------------(  )---
   sensor B | 
----|\ |----
   sensor C | 
----|\ |----
   sensor D | 
----|\ |----
Now, if we get a cable break or another -open circuit- fault, the
conveyor off output will energize and the conveyor will stop. Here, we
might get false "conveyor offs" because of a broken wire, but it's
better than not being able to turn the conveyor off in a bad product
situation.
Before you say that it should be a series ladder rung (for you experts
out there), remember that the physical sensors are normally closed.
So, when there's no fault, they are making the ladder false.
Although the conveyor example might not be too realistic for most of
us, it shows the general theory of smart design. Of course it's
still possible to get a failure but it's statistically smarter than it
was before. When doing your design or programming, try to think about
the application as much as possible (sounds obvious). Eliminate the
best chances of failure and everyone will be happy in the end!
So, do I still seem crazy? Maybe so...
Click below for more crazy wisdom... in book form!
http://www.plcs.net/book3i.shtml
      --------------------------------------------------
***** What the heck is latching? (((Latch basics)))
Latching is a cool word for meaning that your -locking- something on
or -sealing- the circuit on. It typically includes 2 switches and
one turns the circuit on and the other turns the circuit off. It's
commonly used in motor control.
Coming up with the logic to do it can be a little tricky for the new
programmer, so let's check it out.
Let's say that our operation requires that a motor be turned on to
spin our drill bit so we can drill a hole. (high tech machine, right?)
We have an on switch(momentary type) and we have an off 
switch(momentary type). We connect the motor to our PLC output relay.
(of course the PLC is controlling other operations of the machine such
as moving the parts into position, but we'll just discuss the motor 
part for now)
Our ladder logic would look like this to start:
   ON switch         motor output 
----| a |----------------( b )---
   motor output | 
----| c |--------
Here, when we turn on the ON switch(a), the motor output coil(b) will 
energize and the motor output contact(c) would close. When we let go
of the ON switch, the motor output contact (c) will still let logic
(current) flow to the motor output coil (b) so it stays on even though
the ON switch (a) is now physically off. (understand so far?)
Problem is, there is no way to turn off the motor because it is 
latched (locked or sealed) on. Push the ON switch (a) button all you
want but we'll always have a flow through (b) and (c).
The answer is to add an OFF switch to the operation like this:
   ON switch         OFF switch     motor output 
----| a |---------------| e |----------( b )---
   motor output | 
----| c |--------
If the OFF switch (e) is a momentary normally closed type (it's closed
if you don't physically touch it) the ON switch (a) will still 
energize the motor output coil (b) so the motor can be on.
Let's look at it step by step.
*1-Initially a is off, e is on (the switch is physically normally 
closed)and b must be off (logic/current can't get to it because a is
off) so c is also off.
*2-Push the ON switch (a) and now -- a is on, e is on, so b gets 
logic/current and turns on and later it turns c on. Following so far?
*3-Let go of the ON switch (a) and now --- a is off, c is on so 
logic/current still has a path to b to lock it on. (the path is c
through e). Therefor, b is locked on as before.
*4-Push the OFF switch (e) and we no longer have a path for b to get
logic/current anymore. (a is off, e just opened, so b will turn off 
and it turns off c)
*5-Let go of the OFF switch (e) and we're back to *1- above.
All PLCs also include separate set and reset instructions that 
eliminate the logic shown above... but that takes the fun out of 
experimenting!
Check out the details of set/reset instructions by clicking the
link below. (check out the animation too!)
http://www.plcs.net/chapters/latch1i.htm