element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum False triggering interrupts in Arduino Mega2560
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 19 replies
  • Subscribers 395 subscribers
  • Views 4225 views
  • Users 0 members are here
  • interrupt
  • interrupt problem
  • Design
  • interr
  • interru
  • product design
  • arduino
  • arduino avr
Related

False triggering interrupts in Arduino Mega2560

shwetankv007
shwetankv007 over 7 years ago

Hello everyone,

Greetings of the day, i have been working with embedded systems for quite a while now, currently i am working on a project that dispenses water depending upon the balance from rfid card, however the system has start stop and recharge buttons connected to interrupts of microcontroller Atmega2560 with internal pull-ups driven from falling edge. The system works fine mostly however in some cases false interrupts are detected that causes functions to be activated for respective buttons i.e. start stop or recharge. I tried adding a coupling capacitor and a schmitt trigger circuit to stabilize the input but it still detects the false signals of noise.

 

Moreover a small touch on the interrupt terminals(buttons not connected ) also causes the interrupt to be triggered, any suggestions are appreciated.

 

I am using arduino for declaring and defining the interrupt pins and their respective routines. The function just hosts a flag which is then checked in the main loop.

 

Thank you in advance.

 

EDIT:-

As suggested I tried:-

1. Adding an external pullup of values ranging from 1.5k-10k but the issue persists

2. Adding the decoupling capacitor

3. Power supply is fixed and using a bench supply of 24volt stepped down by a MORNSUN buck converter.

4. Not tried the debouncing test since the problem is not related to button press. Even if the button is not pressed, if I touch the open end of wire connecting the interrupt terminal then also it triggers the interrupt.

5. the pin is not routed near a power rail or a high frequency coil/trace.

 

interrupt problem  interrupt arduino avr product design

 

Message was edited by: shwetank vishnu

  • Sign in to reply
  • Cancel

Top Replies

  • jc2048
    jc2048 over 7 years ago +4
    Perhaps try an external pull-up and see if that helps.
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to shwetankv007 +4
    even when it’s not related to the button and debouncing, there has to be something electrical going on. If it happens when you pat the terminal, an oscilloscope with single shot trigger would help to catch…
  • jw0752
    jw0752 over 7 years ago +3
    Hi Shwetank, Here are some ideas. Have you checked to make sure there is adequate decoupling on the power supply to your unit? Poor power quality can make the Arduino glitchy. Another thing to check is…
  • jw0752
    jw0752 over 7 years ago

    Hi Shwetank,

    Here are some ideas.

    Have you checked to make sure there is adequate decoupling on the power supply to your unit? Poor power quality can make the Arduino glitchy. Another thing to check is whether there is a good Earth ground on the unit. This can provide stability in some cases. What about using opto-isolators on your inputs?

    John

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shwetankv007
    shwetankv007 over 7 years ago in reply to jw0752

    Hello sir,

    Thank you for the reply

    I am using a 24volt battery input which is further step down to 5 volt by a MORNSUNS buck convertor with proper decoupling capacitors, as per the design guidlines.

    I am not using the optocouolers due to cost...all i want is to add a button with about 1meter wire for fitting to the enclosure.

    I didn't used an earth ground though, but will do the same and post the results.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • jc2048
    jc2048 over 7 years ago

    Perhaps try an external pull-up and see if that helps.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • DAB
    DAB over 7 years ago

    Have you de-bounced the switches?

    Unless you set up a single pulse for button push, you can get a lot of noise when the button is depressed, which with trigger a host of interrupts.

     

    DAB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shwetankv007
    shwetankv007 over 7 years ago in reply to jc2048

    I tried with an external pull up with different values ranging from 1.5k-10k with a parellel capacitor followed by a schmitt trigger as well, however the immunity was improved but the interrupt got triggered with external noise without hitting the button. The problem is that if i touch the terminal let alone pat it with something, the interrupt gets triggered.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shwetankv007
    shwetankv007 over 7 years ago in reply to DAB

    As far as i understand the concept for denouncing it is to avoid false triggers once the button is pressed, but i get the interrupt even when it is not pressed.

    However I am writing the code for the same and will revert the updates.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • gdstew
    gdstew over 7 years ago in reply to shwetankv007

    Switch bounce can occur when the switch is pressed and when it is released. If you have access to an oscilloscope you should be able to monitor the

    interrupt pin to see if a glitch on that pin is causing the interrupt. A digital oscilloscope will allow you to get a good look at a glitch however you could

    also use an analog scope if that is all you have. Set the oscilloscope for single trigger falling edge and the trigger voltage to one half to one volt below

    VCC (you may also want to try one volt above ground if you don't get any triggers). Since you don't know the duration of the pulse finding the right

    time base to see the glitch will require a bit of trial and error. First set it to one division for the the specified minimum time needed for the Mega2560

    to see an external interrupt, usually at least a couple of clocks, and if the scope triggers and you do not see the glitch, set the time base one or two

    periods slower. Eventually you should see the glitch and you can then adjust the time base to get a better look at it on a digital scope. You may be

    able to get a decent look at in on an analog scope depending on the persistence of the scope tube phosphor but it won't show up for long, especially

    if it is a short pulse.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • jc2048
    jc2048 over 7 years ago in reply to shwetankv007

    Do you have an oscilloscope that you can look at the signal on the pin with? That would give you an idea of what the signal is that's coupling into the wiring.

     

    If not, does the switch wiring go alongside a mains cable or anywhere close to or under the rfid coil?

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • shwetankv007
    shwetankv007 over 7 years ago in reply to gdstew

    the whole idea for testing the debouncing using oscilloscope and identifying the glitches sounds great, however my issue isn't related to the button press, in ideal state when the button is at rest and NOT PRESSED the controller detects signal causing the routine to be called. I am connecting the interrupt pin using a wire about 1-2 meter long with the button connecting the other terminal of button to ground to give a falling edge when pressed. Now even if the button is not connected the controller detects noises and calls the interrupts. I want to know whether I can stabilize it using a separate hardware or changing something on the firmware side.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to shwetankv007

    even when it’s not related to the button and debouncing, there has to be something electrical going on. If it happens when you pat the terminal, an oscilloscope with single shot trigger would help to catch the event.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube