+ Reply to Thread
Results 1 to 13 of 13

Thread: Noisy Long Wire effect my Microcontroller Digital input

  1. #1
    ksaomar Newbie
    Join Date
    Nov 2007
    Posts
    3

    Default Noisy Long Wire effect my Microcontroller Digital input

    Hello all

    I am using my Microcontroller to read a status of digital input, but when I put long wire to read the status, my MC can not read a clear value, sometimes it ON and sometimes it is OFF, when I measure the value by the oscilloscope, I can see a square wave from 0V to 2.5V, with 60 HZ.

    Help me guys to eliminate this? (You can see the design in the attachment)

    Thanks in Advanced

    Omar
    Attached Images


  2. #2
    Leftyretro Excellent Leftyretro Excellent Leftyretro Excellent Leftyretro Excellent
    Join Date
    Mar 2007
    Location
    Hercules, California
    Posts
    1,420

    Default

    Quote Originally Posted by ksaomar View Post
    Hello all

    I am using my Microcontroller to read a status of digital input, but when I put long wire to read the status, my MC can not read a clear value, sometimes it ON and sometimes it is OFF, when I measure the value by the oscilloscope, I can see a square wave from 0V to 2.5V, with 60 HZ.

    Help me guys to eliminate this? (You can see the design in the attachment)

    Thanks in Advanced

    Omar
    Try moving the digital input wire to between the LED and resistor, that may help lower the impedance to the input when the switch is open.

    Lefty
    Measurement changes behavior

  3. #3
    House0Fwax Newbie
    Join Date
    Nov 2006
    Location
    Hampshire U.K.
    Posts
    292

    Default

    Is the 'long' wire sheilded? Also, how 'long'?

  4. #4
    Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent
    Join Date
    May 2008
    Location
    San Diego, Ca
    Posts
    3,922
    Blog Entries
    2

    Default

    You need a proper driver and wire arraignment. Check out Rs422.
    Pay it forward.
    www.geoepicenter.com

  5. #5
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    Simply lower the input impedance of the microcontroller-line by putting a 1k on the anode of the LED to 0v and a 100n across the 1k.

  6. #6
    Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent
    Join Date
    May 2008
    Location
    San Diego, Ca
    Posts
    3,922
    Blog Entries
    2

    Default

    Quote Originally Posted by colin55 View Post
    Simply lower the input impedance of the microcontroller-line by putting a 1k on the anode of the LED to 0v and a 100n across the 1k.
    That would slow the rising edge of the signal and may cause a double clock situation.

    Without knowing the nature of the input to the MCU it is hard to say.
    Last edited by Mikebits; 2nd May 2009 at 09:33 AM.
    Pay it forward.
    www.geoepicenter.com

  7. #7
    mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent
    Join Date
    Oct 2006
    Location
    Hyderabad, India.
    Posts
    2,476
    Blog Entries
    1

    Default

    Quote Originally Posted by ksaomar View Post
    Hello all

    I am using my Microcontroller to read a status of digital input, but when I put long wire to read the status, my MC can not read a clear value, sometimes it ON and sometimes it is OFF, when I measure the value by the oscilloscope, I can see a square wave from 0V to 2.5V, with 60 HZ.

    Help me guys to eliminate this? (You can see the design in the attachment)

    Thanks in Advanced

    Omar
    why not use an opto isolator and the transistor would be on the Microcontroler as emitter follower. the LED and additional resistor can be on the Diode path of opto coupler.
    Regards,
    Sarma.

  8. #8
    Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent
    Join Date
    May 2008
    Location
    San Diego, Ca
    Posts
    3,922
    Blog Entries
    2

    Default

    Problem is that you will still have losses in wire and induced noise on a single wire. Differential pair is best way to overcome noise induced into the wire. Single wire transmission has inherent problems, and other modes of long distance signal transmission must be used, eg. RS422.
    Pay it forward.
    www.geoepicenter.com

  9. #9
    mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent
    Join Date
    Oct 2006
    Location
    Hyderabad, India.
    Posts
    2,476
    Blog Entries
    1

    Default

    Quote Originally Posted by Mikebits View Post
    Problem is that you will still have losses in wire and induced noise on a single wire. Differential pair is best way to overcome noise induced into the wire. Single wire transmission has inherent problems, and other modes of long distance signal transmission must be used, eg. RS422.
    Opto sees a lower impedance and the noise won't be there.

    I had an occasion to solve such problem, where an FET's gate was facing 5.5KM of Underground cable and was never working. after inclusion of Opto with 10mAs current , the issue was sorted and around 50 such telecom signaling circuits were stablized, Mikebits.
    Last edited by mvs sarma; 2nd May 2009 at 10:29 AM.
    Regards,
    Sarma.

  10. #10
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,791

    Default

    Well he's never mentioned how long the wire is - but basically he's done it in the worst possible way, almost as if he was trying for problems?.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  11. #11
    ksaomar Newbie
    Join Date
    Nov 2007
    Posts
    3

    Default

    Thank you guys for these answers, I posted it only three hours ago, and I got all these replies, I really appreciate it.

    Leftyretro:

    I will do what you suggested in your post, but the problem is where the square wave comes from?

    House0Fwax

    The wire is 3 to 5 meters long, and no I did not use shielded wire. I will use the a shielded wire, and I hope it solve the problem.

    Mikebits

    RS422 is used for serial communication, I am not sending any data. It is just like any DIP switch in any board, the difference is that the DIP switch is 5 meters far from the board.

    mvs sarma
    I could not visualize your design, could you please draw it and post here.

    Nigel Goodwin

    This design is found in most of the boards with DIP switches, and if you think this is bad!!, please let me know any better design.
    Last edited by ksaomar; 3rd May 2009 at 05:28 AM.

  12. #12
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,791

    Default

    Quote Originally Posted by ksaomar View Post
    Nigel Goodwin

    This design is found in most of the boards with DIP switches, and if you think this is bad!!, please let me know any better design.
    Check my tutorials - you're feeding a long wire directly into a high impedance CMOS input - this is just asking for disaster.

    As already suggested, a simple pull-down resistor should be used in all cases, or preferably a pull-up resistor, with the switch pulling the input low instead of high - that's the more normal way of doing it (there are various advantages in doing it that way).
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  13. #13
    ksaomar Newbie
    Join Date
    Nov 2007
    Posts
    3

    Default

    Thanks a lot guys, it works now very well.

    I put a pull down resistor, but there was still some little sparks, but when I put 100nF across the resistor, all the sparks are gone and I have a clean signal.

    I really appreciate what you are doing guys.

+ Reply to Thread

Similar Threads

  1. Coax for 50 ft long stereo unit speaker wire?
    By priscilla7391 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 5
    Latest: 28th March 2009, 05:24 PM
  2. PIC PORTA digital input HOW
    By LUNAR in forum Micro Controllers
    Replies: 9
    Latest: 22nd December 2008, 06:43 PM
  3. noisy audio input to system help
    By andy257 in forum General Electronics Chat
    Replies: 13
    Latest: 1st April 2008, 10:24 PM
  4. HOW Long should an input be up for PIC to read it correctly?
    By potpotpotpot in forum Micro Controllers
    Replies: 3
    Latest: 11th May 2006, 04:19 PM
  5. Need 6 channel digital input to PC
    By iwonder in forum Electronic Projects Design/Ideas/Reviews
    Replies: 4
    Latest: 1st December 2003, 06:56 PM

Tags for this Thread