Fluctuating digital inputs


Closed Thread
Results 1 to 28 of 28

Hybrid View

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

    Default Fluctuating digital inputs

    Hi, I have this weird problem where a PIC chip is seeing the input pins fluctuate randomly (between 1 and 10 times per second).

    The inputs are as simple as it gets. It's just a switch from the PIC to ground and a 10K pullup resistor to VDD 3.3V (also tried 100K).

    The problem only occurs when the switch is on the end of a 4M long wire. This would suggest some kind of EM interference but I can't see how such a minor current could cause a digital pin to change state.

    The problem happens regardless of whether the switch is open or closed. It happens more often when it's closed though.

    According to the datasheet all digital inputs have a Schmitt trigger that is enabled by default.

    I've tried it on multiple pins with no difference.

    I have disabled all analog inputs in code.

    I was about to connect my Oscope this morning but it seems that after the circuit being left on overnight it's fixed itself. It was also working fine yesterday evening then suddenly went weird. I don't know of anything in the house that could be interfereing.

    Can anyone think of anything that might cause this or any tests I can do? It's working now but I'm worried it will fail again when it really needs to be working.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Maybe the switch is faulty?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    There is a remote possibility that it's faulty and not making contact properly when closed but it definitely wouldn't be making contact when it's open.

    Just to be sure I'll try shorting the wires at the switch end the next time I see the problem. I'll also see if I can locate a backup switch.

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


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Come on now, What kind of design is that? An input pin to a CMOS device that is at least 12 feet long with nothing more than a pullup resistor of 10K? Well actually 24 feet long, I forgot the return path. If it is to be a robust design then allow some current to flow in the remote switch circuit by means of an led for an OPTOISOLATOR in series with the switch. Think about it? Even with a 10K pullup resistor and a schmitt trigger, with a 3.3 volt VCC the switching voltage threshold is at best 1 volt.
    Dave Purola,
    N8NTA
    EN82fn

  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'm not sure I understand. Surely anything in series with the switch would weaken the return voltage?

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Dave says that you should not connect such electric circuits directly to the CMOS inputs of the controller.

    Better is to use an optocoupler and your switch be in series with the source, limit R and the opto LED. The optocoupler output could then be connected to the PIC input, having an electric isolation from any external EMC source.

    Ioannis

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, 02:23
  2. PIC 18f4680 DIGITAL INPUTS
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2008, 07: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, 06:50
  4. Setting up digital inputs
    By quester in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2008, 22:14
  5. Digital inputs
    By Christopher4187 in forum General
    Replies: 5
    Last Post: - 1st August 2007, 23: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