Fluctuating digital inputs


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    That spikes can easily kill pic. Not single spike, but repeated...
    This is simplest circuit that will protect pic, and give you good immunity to spikes.
    Name:  PIC Input.png
Views: 657
Size:  20.0 KB
    Also this circuit add little delay...
    And use twisted pair for wiring remote switch, it should improve situation.

  2. #2
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    A very small delay isn't really a problem. The chip is currently sampling each input at over 300,000 times per second but it wouldn't really matter if it were only 100 times per second. I can't imagine the cap would add a delay much longer than that.

    I might be able to solder the capacitors under the PCB and the 2K-R12 resistor would have to be on the wire but since that's in series it's position shouldn't matter.

    I don't think any of the spikes go high enough to cause a problem with the PIC. I've never seen one get up to 3.3V. The negative ones may be a problem though.

    Thanks for your help. I'll try the extra cap/resistor as it looks to be a simple mod and see what the Oscope looks like.

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    R12 should be on PCB side of cable. Because long wire have a capacitance to ground.
    Spikes are clamped to -0,7V and +4V by pic internal diodes.
    Negative voltage on input pin can latch new pic.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Hi,
    Thanks for doing the schematic pedja089 - that's exactly what I'm talking about. The 15k, 2k will give a low level of 0.39V. I looked at a 18F2420 datasheet and it states max voltage for a logic low on a schmitt trigger input to be 0.2Vdd or 0.66V with a 3.3V supply so you're below that by some margin - but not much. Definitely worth a try. Double check against correct datasheet!

    but since that's in series it's position shouldn't matter.
    Yes, I'd say it matters. You want the cap close to the PIC and the resistor close to the cap - not at the switch.
    If you're trying to filter noise generated from the switch itself bouncing etc then it wouldn't matter but in this case you're trying to filter out noise being coupled into the wires. If you put the resistor far away from the capacitor (which you want close the actual input pin) the noise can be coupled into the part of the wire between the resistor and capacitor basically negating the resistor.

    A simple software based low pass filter will most likely work as well but a little bit of hardware filtering is "the right way" and will provide some protection for the input.

    /Henrik.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    I will have to put the resistor inside the plug which is on the circuit end of the wire then. That's as close as I can get it without cutting through traces on the PCB. It still puts the resistor within 3 inches of the PIC though.

    The PIC I'm using is a PIC24FJ64GA002. I'm pretty sure the datasheet said VSS-0.2V is low and 0.8-VDD is high.

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    That is just print scr, from my schematic.
    My Vdd is 2.8V, so lower threshold is 0.56V. With 2K and 15K combination low level is 0.32V.
    That is almost half of threshold, it works fine for me.

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Bandaids,Bandaids,Bandaids, Just put an optoisolator and a couple of resistors on a small piece of Vectorboard and be done with it. If you are going to use the circuit in post #382 you might as well do it right with anh opto.
    Dave Purola,
    N8NTA
    EN82fn

  8. #8
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    If you referring to my post #14...
    My circuit use only 10uA with all inputs shorted to GND.
    Vdd for inputs is controlled by PIC. So just give me opto that uses less than 1uA and I'll be happy to use it.
    By the way device passed ESD and RF immunity test without false triggering or any damage
    Last edited by pedja089; - 7th October 2014 at 20:37.

  9. #9
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Double post. Bad internet connection...

Similar Threads

  1. How to Measure 2 or more digital inputs a the same time
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 29th April 2013, 03:23
  2. PIC 18f4680 DIGITAL INPUTS
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2008, 08:34
  3. Digital inputs are some pin NOT working (PIC18F458)
    By san6302 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2008, 07:50
  4. Setting up digital inputs
    By quester in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2008, 23:14
  5. Digital inputs
    By Christopher4187 in forum General
    Replies: 5
    Last Post: - 2nd August 2007, 00:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts