what is needed to sense a simple closure switch

jspoon said:
Ross, have you considered a simple 4 or 8 input optocoupler board/kit/assembly that will inteface with your existing breakout board?

All this said, it I wanted to create a optocoupler interface, how should I approach it?  Do I find some piece of breadboard or something?  What would be the schematic if I wanted to use something like a set of SFH620AA's?
 
Yes, I have, and my next version of this board will lose the input-conditioning resistors and re-use that space for some optos.
 
As for how to drive the inputs, a simple opto can be used to pull the WC inputs high. They are not actually TTL, and draw quite low current, so the opto can do this easily.
You then need a resistor to current-limit the LED. This is probably the simplest, cheapest, smallest solution.
 
I have a lot on my plate at the moment, I doubt I'll have a board ready inside a month or two.
 
CAI_Support said:
Depends on what you want to do. Most alarm system door/windows sensor  inputs don't have opto-isolator chip. The reason is that the alarm system only arm with all switch connected, in another word, TTL input reads 5V. If thief cut the wire anywhere, it will make the TTL input drop. Any such 0 going spike will trigger alarm.  Normally, it is not easy to have noise spike making 5V connected TTL input falsely reaching to TTL 0.
 
Most alarm systems that I've encountered don't use anything as simple/vulgar/vulnerable as a TTL input.
Most use a resistor-terminated line, or in some cases a double-resistor terminated pair of switches, and an more complex input conditioning system to determine resistive bands on the input line.
 
Does this look reasonable?
 
               1.5K           |--------|         
O----------/\/\/\/\/\---------|led     |------------  WC
                              |        |
                              |  Opt   |
O-----------------------------|        |------------
                              |----- --|
 
jspoon said:
Does this look reasonable?
 
               1.5K           |--------|         
O----------/\/\/\/\/\---------|led     |------------  WC
                              |        |
                              |  Opt   |
O-----------------------------|        |------------
                              |----- --|
 
The perfect answer for this is to use the ACSL-6400. Basically has four "logic output with LED input and 2500V isolation side-to-side" devices in a 16 pin pack.
 
If you're using a standard, conventional opto, your diagram above is ok, just need to calculate the right value of the resistor. 1K5 should push around 8mA though the LED, which is enough for some, not enough for others.
 
The opto side - connect the output transistor collector to the webcontrol +5V, and the emitter to the webcontrol input. (inputs have pull-down resistors)
 
You are not in an industrial situation and your noise figures will likely be very low in comparison. Also, running both sides of an opto-isolator from the same power supply gives no common mode noise rejection or protection. Separate power supplies are needed to make an opto-isolation scheme work properly anyway. I doubt you want that complexity or cost.

To simplify things for yourself just connect your contact from common grounded negative to the input. Now tie that 1.5 K resistor from that same input to your positive supply +5vdc. When the switch closes the input will switch to logic 0.

This will
- lower your impedance increasing your resistance to any noise in the line. More stray voltage absorption.
- keep your cable loop to the door switch at a grounded potential. Standard industry practice.
- simplify your wiring onto a terminal strip. Give yourself a break unless you want t build a PCB circuit.
- lower your interface costs and time.
- if a huge static electricity attack is induced into the cable the WC8 board is likely cheaper, easier and faster to get, than the complex added components being proposed.

OTOH: If you are going to run long cables in opposite directions to various ends of your house you may want to get much more serious about the opto-isolation thing for multiple inputs and learn about equipotential grounding techniques.
 
New WC32-IO co-designed with Ross does have the TTL inputs with opto-isolation. Input ground by default is not connected to the WC32 ground, but user can jumper them together by soldering JP1.  Similar to analog input ground with JP2.
 
Thanks to all who have responded, this has been very interesting and helpful, with lots to consider.
 
Jay
 
Hi ,
I have the web control Rev 2.2.2 and I would like to control OP3 with a push button IP1 .
Why this code does not work ?
 
START
TSTEQ IP1 1 OP3
TSTEQ OP3 1
SET OP3 0
END
 
I use capacitor paraler with the switch and I have a clean switch source
 
Thanks !
 
 
Every time you turn the output on, (line 3) in the next line you turn it off.

Not sure what you mean by "capacitor paraler with the switch." If you are trying to use the capacitor to debounce the switch need to make sure it is large enough, and since now you have created extremely slow rise and fall times will need a Schmitt trigger input to clean up the edges.

1) can you post a schematic of the circuit.
2) what behavior do you want to switch to have: toggle the output, follow the switch state, something else?

/tom
 
Hi Tom ,
 
Firt of all I want to say thanks a lot for the responce !
 
I want the output 3 on for 1sec when I push the button , no matter how long the button is on or how many time I push the button  the fist 10 sec .
I am working now on Schmitt trigger as you said .
 
Thanks
Steve
 
 
 
 

 
 
The delay operator is easy to use if you can afford to block other operations during the 10 seconds. If not you can use the non-blocking [] operand but the code will be a little more complex.

Here is a quick and dirty untested code fragment. SWITCH tests state of the push button if is is not active returns. Once switch goes active Output is turned on for 1 second, then another delay of 9 seconds to meet cycle time requirement of 10 seconds. The LOOP test at the end prevents return until the switch is released.

Keep in mind when this is going on this is the only user code being executed. If that is not acceptable you can use non-blocking operator and/or use CS or CTS to provide the delay function.

Since the switch closure is only used to trigger the sequence of events and sequence is long relative to switch bounce it can be ignored.

START
CALLSUB SWITCH
END

SWITCH:
TSTNE IP1 1
RET

SET OP3 1
DELAY 1000
SET OP3 0
DELAY 9000
LOOP:
TSTEQ IP1 1
GOTO LOOP
RET
 
It works perfect !
Thank you very much !
 
I have one more question please . Can I have notification email without date and time ?
 
 
" Test  Message

WEB CONTROL  Sent at: 19:13:07 On the 02/02/2015 "
 
stst0011 said:
Can I have notification email without date and time ?
I don't think so, I've always used verbose messages. Play around with the "Item Starts Not Reporting" option on the notification page.

/tom
 
I am so happy ! Thank you so much , this is my first expirience with PLC .
Can you tell me please the code for the non-blocking [] operand ? Can I have input 1 for output 1 and input 2 for output 2 with the same senario and the same delay times ?
 
Thank you Tom !
 
stst0011 said:
Can you tell me please the code for the non-blocking [] operand ?
It is documented in the user manual - additional parameter to the test opcodes. Some of the example code at the end of the manual show it being used.

Basically what it does is say: don't execute the command unless the thing you are testing has been in the same state for that period of time.

/tom
 
Back
Top