Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

False triggering on input pin

Status
Not open for further replies.

Plummet

New Member
Hi

I'm using a PIC 12F629 with an active-high input on pin 4. I have a 10K pulldown resistor to ground connected to the pin, with a switch that takes the pin up to +5V when closed. In the software, I am using the port change interrupt to wake the PIC.

It all basically works fine, but I have found that if just I touch the input pin side of the switch with an ungrounded piece of wire then the interrupt triggers - suggesting that the pin is taken momentarily into logic high. I also found that when driving relays (via other pins and a darlington array), I get the occasional false trigger when a relay switches off.

Any idea what is going on here? Is 10K a bad choice of resistor - e.g. maybe too high so the pin is effectively floating? Are PIC inputs generally suseptible to noise?

Thanks!
 
Hi

I'm using a PIC 12F629 with an active-high input on pin 4. I have a 10K pulldown resistor to ground connected to the pin, with a switch that takes the pin up to +5V when closed. In the software, I am using the port change interrupt to wake the PIC.

It all basically works fine, but I have found that if just I touch the input pin side of the switch with an ungrounded piece of wire then the interrupt triggers - suggesting that the pin is taken momentarily into logic high. I also found that when driving relays (via other pins and a darlington array), I get the occasional false trigger when a relay switches off.

Any idea what is going on here? Is 10K a bad choice of resistor - e.g. maybe too high so the pin is effectively floating? Are PIC inputs generally suseptible to noise?

Thanks!

hi,:)
A ungrounded piece of wire can be electrostatically charged, touching the wire to a PIC pin can discharge the static into the pin, which could be seen as a signal.

On the relays, do you have back emf clamping diodes on the relay coils also what level of decoupling caps do you have on the dc supply lines.?
 
Hi - yes, you are right - static discharge could well explain it. I guess I can workaround in s/w by making by debounce routine look for a good period (e.g. 10ms) of high signal before a good period of low signal.

I've got 0.1uF between the vdd and vss pins on the PIC, and also on the MCLR input, but nothing on any of the other inputs/outputs.

For the relays, I'm driving them via a ULN2003A array, which I think includes the back emf diodes, so I have added any others
 
Hi - yes, you are right - static discharge could well explain it. I guess I can workaround in s/w by making by debounce routine look for a good period (e.g. 10ms) of high signal before a good period of low signal.

I've got 0.1uF between the vdd and vss pins on the PIC, and also on the MCLR input, but nothing on any of the other inputs/outputs.

For the relays, I'm driving them via a ULN2003A array, which I think includes the back emf diodes, so I have added any others

hi,

Do you have the diode commoned cathode pin going to the +V driving the relays.?

Also on your power rails +5V/0V you should have at least 220uF cap

Its always a good idea to debounce any mechanical switch contact, either by res/cap of within the program.

Is the circuit on a project board or strip board.?
 
Thanks for the help - yes, I have the diode common pin connected to the +V for the relays (although the connections are not physically close). I'll try 220uF - not sure where I got the idea 0.1uF was a good value.

BTW - I've changed my debounce code so that it goes:

- Trigger on high (pin is active high)
- Ignore if pulse does not stay high for 20ms
- Wait for pulse to go low and stay low for 20ms

..and so far it seems to have worked around the issue
 
Thanks for the help - yes, I have the diode common pin connected to the +V for the relays (although the connections are not physically close). I'll try 220uF - not sure where I got the idea 0.1uF was a good value.

..and so far it seems to have worked around the issue

hi,
The 100nF [0.1uF] is a good idea, a ceramic cap is more effective at suppressing higher frequency noise than a 220uF electrolytic.
The 220uF is better than a 0.1uF at supplying 'pulse' currents to heavy loads.

So basically you should always use both types.:)
 
OK - thanks

Just to make really sure I understand...you are saying put both caps across the 5v and 0v as close to the PIC pins as possible, i.e. in parallel? I'm using a directly connected 5V PSU (no voltage regulator).

I think the lack of a 220uF to handle dips could be part of what I'm seeing - I've noticed now that although I've cured the bounce through s/w, I think the PIC is resetting (possibly brown out reset as I have that enabled) if I put the ungrounded wire on the input pin when all 3 of my relays are on.
 
OK - thanks

Just to make really sure I understand...you are saying put both caps across the 5v and 0v as close to the PIC pins as possible, i.e. in parallel? I'm using a directly connected 5V PSU (no voltage regulator).

I think the lack of a 220uF to handle dips could be part of what I'm seeing - I've noticed now that although I've cured the bounce through s/w, I think the PIC is resetting (possibly brown out reset as I have that enabled) if I put the ungrounded wire on the input pin when all 3 of my relays are on.

I would suggest that you dont keep touching ungrounded/floating wires to the PIC pins,
there is a possibility that you will damage the PIC.

Put the 100nF close to the PIC power pins as possible.
I would also place another 100nF and a 220uF close to the relays.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top