Fluctuating digital inputs


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    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

  2. #2
    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?

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    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

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


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Ahh I see. I'll make sure to do it that way in the future. Thank you both for the tip/clarification.

    Unfortunately this particular circuit is already on a PCB and it's too late to redesign.

    I've been doing some reading about pull-ups. Someone mentioned that the weak internal pull-ups in the PIC24 family are about 50K and they could easily allow EMI on long traces (let alone external wires). I guess this means the 100K resistors are way out. Quite a few people use 10Ks but it seems that 5K is recommended so I'll give some of those a go later.

    The good news is that the circuit has now been running for over 7 hours and hasn't randomly triggered once. Maybe the interference is coming from something that's only on at night.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Quote Originally Posted by The Master View Post

    The good news is that the circuit has now been running for over 7 hours and hasn't randomly triggered once. Maybe the interference is coming from something that's only on at night.
    Your switch wiring is very close to resonance to communications r/f frequencies either private or GOV If you are running X # of meters you could be resonant at 1/4 wave or 1/2 wave . . . perfect as an antenna. As indicated above a load so as to define the actual switch event, an opto solution, or if you can determine the source even a choke to block r/f.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    Yeah, connecting long flying wires directly to the inputs of the PIC usually isn't the best design practice for anything that's going to see some use in the real world. I am surprised though that it's picking up enough crap to drive the input high even with the switch pulling it hard to GND - that sounds a bit strange.

    Provided that the switch is really switching "hard" to Vss I'd start with a simple cap (10-100nF) across the input. Then perhaps a little series resistance on the input (outside of the cap) but Watch out for the voltage divider effect with the pull-up. An inductor in series with the input lead (again on the outside of the cap) and/or a couple of turns on a ferrite core.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Fluctuating digital inputs

    The circuit has been working fine all day but again about 8PM it started acting up. Nothing in the house changed at that time so it must be something external interfering (neighbour's TV or something).

    I've managed to get my Oscope connected at the circuit end and the results are actually quite surprising. The line stays almost completely flat with very minor fluctuations just like you'd expect for an input being held to ground by 8M total of wire. The strange part is that every few seconds I see a huge spike that varies from 0.4V to over 2V. This is definitely enough to cause the problem (I believe anything over 0.8V is classed as high).

    I've attached 2 screenshots to show the kind of spikes I'm seeing. One with the switch closed (grounded) and one with the switch open (pulled up). Long wire or not I don't think I should be seeing spikes like this.

    I have some triac optoisolators laying around. Would I be able to use those to isolate the switch? I'm thinking to MacGyver something onto the back of the box and use a 5V supply to drive the opto's LED through the switch. Would these fluctuations still cause a problem though?

    For the cap/resistor. Should the 10-100nF cap be at the circuit end and by "outside of the cap" do you mean anywhere along the wire but not between the cap and the PIC?
    Attached Images Attached Images   

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