Newbie Help with Input Status

ccthbsh01

Member
Hi all,
 
I am pretty new to the CAI WebControl Board though I have been following this forum for a long while.
 
One of my goals that I am working on is to use the board to connect 8 standard magnetic contact door sensors to the 8 digital inputs. These sensors are what’s called “closed loop” which means that when the door is closed and the sensor is in contact with the magnet the circuit is closed. Then have the board update via WEBSET a corresponding variable on my ISY-994 each time the sensor status changes.
 
I am very far from being an experienced electronic tinkerer. As far as I understand, the way to do this is to connect one end of each of the sensor wires to pin 13 (5Vdc) and connect the other end of each sensor wire to pins 5 thru 12.
 
I am not going to bore you with all the troubleshooting steps I took to understand what’s going on. To make a long story short here is where I am up to now:
 
My PLC code now is as follows:
 
START
                TSTEQ IP1 0 
                CALLSUB IP1_OFF  
                TSTEQ IP1 1 
                CALLSUB IP1_ON
                END
 
IP1_ON:
                ADD 1 VAR5 VAR5
                RET   
 
IP1_OFF:
                ADD 1 VAR6 VAR6
                RET  
 
So the system will constantly keep adding 1 to VAR5 when Input1 is on, and will keep adding 1 to VAR6 when input1 is off. So this way I can see what’s going on. I also have the Web Polling Enabled option on.
 
Now here is what happens, when I connect a Dupont wire from pin 13 (5V) to pin 5 (IP1) the system status will properly show IP1 as 1, and VAR5 will keep increasing, and everything is fine. However, when I disconnect the wire from pin 13 while leaving it connected to pin 5, for as long as I am holding the wire in my hand, VAR5 will continue to increase at a rate of about 1-3 per second, while the IP1 status will correctly show as 0 most of the time with once in a while showing 1 & changing right back to 0. But even more strange, when I connect 1 side of the about 15 ft. long 22AWG cable going to a magnetic contact sensor to pin 5, the board goes completely crazy and VAR5 starts increasing at a rate of about 30 per second!
 
Just to rule out anything else I don’t have anything else connected to the board now other than the power supply & Ethernet cable.
 
What am I doing wrong here?
 
Thanks in advance.
 
Each TTL input pin has 10K pull down resistor to the ground. You may change that to 1K, or run a resistor in parallel that from pin 5 to ground, to see if that helps.  The lower the resistance, the less chance your bode or longer wire to produce enough current to false trigger the TTL Inputs.
 
Your PLC code will keep increase VAR5 and VAR6, as long as TTL input is logic 1.  It sounds like your physical body becoming a conductor between +5V and TTL input.  What if you touch ground with one hand also?  Electrical signals are a lot faster than display function then to browser pulling the status. TTL input must see voltage high enough to trigger it consider the logic 1 present.
 
Thanks CAI_Support for your response.
 
As I had mentioned before I have very little knowledge about electrical stuff. So I did some googling & read up on what a pull down resistor means & does. I am confused. From what I read on a couple of websites I understand that the pull down resistor is used to remedy the exact problem that I am having. I learned that there is such a thing that when the input pin is not connected to voltage it’s not necessarily going to be 0 but it will float all over the place. So the purpose of the pull down resistor is to make a connection between the pin & ground so this will keep the input pin at 0, and when the 5V to the input pin is closed the pull down resistor will keep it from making a short.
 
Now you are saying that there is already built in a pull down resistor between each input and ground so why is this happening? I am really new to this stuff so pardon me if I don’t know what I am talking about. I am just trying to understand.
 
I am wondering how does everyone use the digital inputs? Does everyone have the same issue with the status showing 1 even if the sensor is actually open and need to add resistors? Am I the only one having this issue?
 
 
CAI_Support said:
Each TTL input pin has 10K pull down resistor to the ground. You may change that to 1K, 
 
How do I change that to 1K?
 
or run a resistor in parallel that from pin 5 to ground
 
Could you please post a link what to buy?
 
Thank you.
 
As you have learned pull-down resistors are used to prevent logic inputs from floating high.
 
What you are seeing when you disconnect the 5V side and hold the wire you body is acting as a capacitor picking up the 60Hz AC field causing the input to randomly switch between 1 and 0.
 
The CAI suggestion to use a 1k ohm resistor at the input to ground is to increase the amount of current needed to cause the input switching from 0 to 1.
 
Here is an ebay link, but you can get them from any electronic supplier or perhaps even Radio Shack.
http://www.ebay.com/itm/50-x-Resistors-1K-Ohms-OHM-1-4W-5-Carbon-Film-/181403038924?pt=LH_DefaultDomain_0&hash=item2a3c76b4cc
 
/tom
 
Tschmidt said:
As you have learned pull-down resistors are used to prevent logic inputs from floating high.
 
What you are seeing when you disconnect the 5V side and hold the wire you body is acting as a capacitor picking up the 60Hz AC field causing the input to randomly switch between 1 and 0.
 
The CAI suggestion to us a 1k ohm resistor at the input to ground is to increase the amount of current needed to cause the input from 0 to 1.
 
Here is an ebay link, but you can get them from any electronic supplier or perhaps even Radio Shack.
http://www.ebay.com/itm/50-x-Resistors-1K-Ohms-OHM-1-4W-5-Carbon-Film-/181403038924?pt=LH_DefaultDomain_0&hash=item2a3c76b4cc
 
/tom
 
Another particularly effective technique is to use a 6V torch bulb across the input.
* It gives a visual indication when the input is on - great for testing, diagnostics and instant feedback
* It has a non-linear resistance. Cold-resistance is MUCH lower than hot, so it's very effective at damping input signals
* Running a 6V bulb at 5V, it'll probably never burn out.
* Cheap, easy to get.
 
Another possible option would be to use one of these boards:  http://webcontrol.rossw.net/
I can supply without the amplifier chip, trimpots and 5-pin connector.
There's space to install 8 pull-up or pull-down resistors, or if you prefer, to put a capacitor across the input to help reduce noise.
The main benefit is that it gives you a convenient termination board with screw-connectors to get all your wires into.
(It also brings out the +5V onto a pin on the screw connectors to assist connecting your switches if you're pulling the input high)
 
I guess after reading this thread I should change my anemometer input contact to a pullup and lose my1K pullup resistor. The 1K pullup resistor I installed was fighting the board pulldown resistor (I didn't know about) giving me some low (half?) voltage pulses. 
 
It  counts OK but I don't like borderline voltage pulses.
 
LarrylLix said:
. The 1K pullup resistor I installed was fighting the board pulldown resistor (I didn't know about) giving me some low (half?) voltage pulses. 
Not sure I understand your concern.
 
A 1k pullup with a 10k pulldown means quiescent voltage is 4.54v (neglecting gate input current which should be negligible). I'm assuming the anemometer switches to ground so input voltage toggles  between 4.54 and 0v, (neglecting cable and switch resistance). Sounds fine to me.
 
Now if your pullup was 10k, instead of 1k, that would be a problem because quiescent voltage would be 2.5v,that is right at TTL switching level.
 
Going with low value resistors may be a concern if the device driving the input has limited output current capability. With a 1k pullup the driver needs to be able to sink 5ma to bring the input voltage to 0v.
 
/tom
 
Not sure I understand your concern.




Thanks Tom.
 
It may have been a 5K or something. I can't remember. It was a grab into my resistor junk box at the time that has never been resorted since I moved and I just ran with it. Without any I/O specs or schematics for the board I just  figured there was some clamping going on the board inputs. Now I will have non-current-limited 5v run into the real world. This is not usually done elsewhere.
 
The high state voltage was  about 1.6v or something but it worked at the time and I haven't returned to it. Now I will switch the contact to pull-up.
 
Hi all,
 
So I went out & bought from Radio Shack resistors with the same exact specs as the one that Tschmidt linked to on ebay. (BTW the price was $1.49 for 5 pieces vs. 99 cents on ebay for 100 pieces. At least I didn’t have to wait 30 days to get it…) I took the board with me to my office yesterday to test it & later I tested it again at home. It’s interesting that it seems that I have much more electrical noise at home than the office, when I actually have much more electrical equipment at the office.
 
So here are the results:
 
Office – Before the resistor:
VAR5 (which keeps on increasing by 1 when IP1 is on) would increase at a rate of about 1-3 per second only when touching the wire connected to IP1. Without touching the wire it would not increase.
 
Office – After the resistor:
VAR5 would not increase even when touching the wire. (Except when I would touch the resistor pin itself, but only the part of the pin between the resistor & IP1, not the part of the pin between the resistor & ground)
 
Home – Before the resistor:
I had not really mentioned this in my first post, but even when I didn’t touch the wire connected to IP1 at all, VAR5 would increase by 1 about every 10-20 seconds.  When I would touch the wire, VAR5 would increase by about 1-3 per second. When I connected one end of the 15 ft. 22 AWG cable going to a magnetic contact door sensor to IP1, VAR5 would increase at a rate of about 30 per second.
 
Home – after the resistor:
When I don’t touch the wire, VAR5 is stable & does not increase at all. When I touch the wire, it will increase by 1 about every 10-20 seconds. When I connected one end of the 15 ft. 22 AWG cable, VAR5 started increasing by about 1-3 per second. But here is the strange part that I don’t understand why that is: When I connected the second conductor of that cable going to the magnetic sensor to the 5V pin, VAR5 stopped increasing even though the door was open which means there is actually no connection between the 2 conductors. (I should mention that without the resistor, VAR5 increased by 30 per second even when the 2nd conductor was connected to 5V) What’s the explanation for that?
 
Thanks for all your help.
 
I tested again now connecting the 15 feet magnetic sensor cable to IP1 and 5V. Now I did see VAR5 increasing by 1 about every 30 seconds. That's still not acceptable. I added a second resistor between ground and IP1, then it seemed to completely stop. Though I only watched it for 2-3 minutes. Do I need a different resistor instead of using two?

Thanks.
 
ccthbsh01 said:
I tested again now connecting the 15 feet magnetic sensor cable to IP1 and 5V. Now I did see VAR5 increasing by 1 about every 30 seconds. That's still not acceptable. I added a second resistor between ground and IP1, then it seemed to completely stop. Though I only watched it for 2-3 minutes. Do I need a different resistor instead of using two? Thanks.
 
2 resistors is no different to one of a smaller value.
The incandescent lamp like I suggested would arguably be better again, its cold resistance is probably only a few tens of ohms.
 
Your long cable with only the signal wire connected will be acting like an antenna, picking up whatever noise is around.
When you then connect the +5V to the other wire, it will (to some extent) be acting as a low impedance shield, and to some extent as a capacitor. Both of these effects will reduce how much noise gets presented to the input pin.
 
The ultimate cure for this problem (you can keep adding more and more damping to reduce the effect, but sooner or later it's going to get you. Nearby thunderstorm, for example) is to actually isolate the long input wire from the low voltage input pin. An optocoupler is the perfect resolution to this problem, as you can power all your "external" devices from a seperate supply and completely isolate all your external wiring from the WC input pins.
 
ccthbsh01 said:
Do I need a different resistor instead of using two?
As Ross posted two resistors in parallel is the same as a single smaller resistor of 1/2 the ohms. One thing you have to be careful of is if you make the pullup resistor too small, switching current become high causing other problems.
 
If you have a multimeter it would be a good sanity check to verify the input voltage. I'm surprised the inputs are still so sensitive. In my designs I buffer inputs, not for noise immunity, but to protect the WC. I'd rather replace a TTL gate on my adapter interface then the entire WebControl.
 
I like the idea of using an incandescent bulb as the pullup but have never actually used it. I've also used opto couplers - they are much like using a bulb because they are current driven making them more immune to noise pickup
 
If you know the duration of the signal you can debounce it in software. WC makes that pretty easy.
 
/tom
 
 
 
I Like
 
I like the idea of using an incandescent bulb as the pullup but have never actually used it. I've also used opto couplers - they are much like using a bulb because they are current driven making them more immune to noise pickup

I believe that was a "pulldown" lamp bulb. Careful incandescents sometimes short out when the filament breaks.
 
Opto-isolators  would be the method of choice for protecting a sensitive signal that should never be off the board in the first place. Definitely a recipe for a static punched through transistor.
 
Trouble is, how many peripheral boards do we need to add to connect to the real world to make a the credit card size  board work safely?
 
Back
Top