<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: External Interrupt fire random</title>
		<link>http://forums.leaflabs.com/topic.php?id=1779</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:22 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1779" rel="self" type="application/rss+xml" />

		<item>
			<title>pici on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-11002</link>
			<pubDate>Thu, 31 May 2012 11:52:08 +0000</pubDate>
			<dc:creator>pici</dc:creator>
			<guid isPermaLink="false">11002@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://arduino-info.wikispaces.com/RelayIsolation&#34; rel=&#34;nofollow&#34;&#62;http://arduino-info.wikispaces.com/RelayIsolation&#60;/a&#62;&#60;br /&#62;
May be this helps....&#60;/p&#62;
&#60;p&#62;regards pici
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cosminnci on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10842</link>
			<pubDate>Thu, 24 May 2012 10:25:19 +0000</pubDate>
			<dc:creator>cosminnci</dc:creator>
			<guid isPermaLink="false">10842@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I have a 12V transformer rectifier bridge 7812 ,7805 and 2 electrolytic caps.&#60;br /&#62;
I checked the supply with a dso nano looks smooth, it drops about 0.2v when the relay is on.&#60;br /&#62;
we tried activating the interrupt in the main loop too, no changes.&#60;br /&#62;
it must be somme interference,&#60;br /&#62;
I will rebuild the cable and the connections.&#60;/p&#62;
&#60;p&#62;regards,&#60;br /&#62;
Cosmin
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pici on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10829</link>
			<pubDate>Wed, 23 May 2012 16:22:35 +0000</pubDate>
			<dc:creator>pici</dc:creator>
			<guid isPermaLink="false">10829@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;- what power source you use for the relay, is it stabilized ?&#60;br /&#62;
- is the irp acitvated after relais activation ?&#60;br /&#62;
- can you monitor the power source with a osci ?&#60;/p&#62;
&#60;p&#62;looks like a problem with a dirty power source.&#60;br /&#62;
try to stabilize the pwr source with a capacitor, may be 100yF. &#60;/p&#62;
&#60;p&#62;regards pici
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cosminnci on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10827</link>
			<pubDate>Wed, 23 May 2012 13:22:09 +0000</pubDate>
			<dc:creator>cosminnci</dc:creator>
			<guid isPermaLink="false">10827@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I tried with INPUT_PULLUP and RISING, the functionality is about the same,&#60;br /&#62;
when the maple is powered from battery it works ok, when powered from the same supply as the relay the interrupt fires at same rate as enabling the relay.&#60;br /&#62;
what is the safer for button with interrupt on 10cm rainbow cable the pullup or the pulldown, I mean for protection against interferences.&#60;/p&#62;
&#60;p&#62;regards,&#60;br /&#62;
Cosmin
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10817</link>
			<pubDate>Tue, 22 May 2012 18:40:20 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">10817@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;
just one thing, you're trying to detect a falling edge with a pull-down resistor? It should be a rising edge, or a pull-up resistor...&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;I agree with blackswords (I didn't read your first post carefully, and missed that you were using a pulldown). If you have an external pulldown (and &#60;code&#62;INPUT&#60;/code&#62; mode), then you want &#60;code&#62;RISING&#60;/code&#62;, not &#60;code&#62;FALLING&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Though it's still a good idea to check if just using the internal pullups/pulldowns won't work for you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pici on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10814</link>
			<pubDate>Tue, 22 May 2012 12:53:14 +0000</pubDate>
			<dc:creator>pici</dc:creator>
			<guid isPermaLink="false">10814@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ups, i am not sure. Does it still fire when you use INPUT_PULLUP mode ?&#60;br /&#62;
The only thing i can imagine so far is when your input is pulled down - there could be any strange emitting source&#60;br /&#62;
that could cause your input to peak high for a short time. So the time delay in the irq routine should work as a filter.&#60;br /&#62;
May be you can adjust the time delay.&#60;/p&#62;
&#60;p&#62;I figured that out when i was developing my remote controlled power line. There are a lot of transmitting sources in the air&#60;br /&#62;
like RC, mobile, etc.&#60;br /&#62;
So the best way would be to check the input with a oscilloscope or dso to figure out the shape of the signal.&#60;/p&#62;
&#60;p&#62;But i think it shouldn't happen with the internal pullup mode so u need no external resistor.&#60;/p&#62;
&#60;p&#62;regards pici
&#60;/p&#62;</description>
		</item>
		<item>
			<title>blackswords on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10813</link>
			<pubDate>Tue, 22 May 2012 12:51:51 +0000</pubDate>
			<dc:creator>blackswords</dc:creator>
			<guid isPermaLink="false">10813@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;just one thing, you're trying to detect a falling edge with a pull-down resistor? It should be a rising edge, or a pull-up resistor...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10812</link>
			<pubDate>Tue, 22 May 2012 12:45:20 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">10812@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Since you want the interrupt to fire on falling edges, try using &#60;code&#62;INPUT_PULLUP&#60;/code&#62; instead of &#60;code&#62;INPUT&#60;/code&#62; in your call to &#60;code&#62;pinMode()&#60;/code&#62;.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cosminnci on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10811</link>
			<pubDate>Tue, 22 May 2012 11:06:25 +0000</pubDate>
			<dc:creator>cosminnci</dc:creator>
			<guid isPermaLink="false">10811@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;the debouncing is ok, it will help but for now the interrupt fires without any button press, only the relay is commanded.&#60;br /&#62;
what is better to have buttons pulled up all times and on contact goes 0 or oposet?&#60;br /&#62;
regards,&#60;br /&#62;
Cosmin
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pici on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10810</link>
			<pubDate>Tue, 22 May 2012 09:57:12 +0000</pubDate>
			<dc:creator>pici</dc:creator>
			<guid isPermaLink="false">10810@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;#define BUTTON_MASTER xxyourpin&#60;/p&#62;
&#60;p&#62;// button state&#60;br /&#62;
volatile int buttonMasterState = LOW;&#60;/p&#62;
&#60;p&#62;void __button_master_irq()&#60;br /&#62;
{&#60;br /&#62;
  static unsigned long last_master_irq = 0;&#60;br /&#62;
  unsigned long irq_time = millis();&#60;br /&#62;
  // If interrupts come faster than 100ms, assume it's a bounce and ignore&#60;br /&#62;
  if (irq_time - last_master_irq &#38;gt; 200)&#60;br /&#62;
  {&#60;br /&#62;
    buttonMasterState = !buttonMasterState;&#60;br /&#62;
    digitalWrite( LED_MASTER, !buttonMasterState);&#60;br /&#62;
    fs20_cancel = true;&#60;/p&#62;
&#60;p&#62;  }&#60;br /&#62;
  last_master_irq = irq_time;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;br /&#62;
  // define the button pin's, pullup to 3.3 V&#60;br /&#62;
  pinMode( BUTTON_MASTER, INPUT_PULLUP );&#60;/p&#62;
&#60;p&#62;  attachInterrupt (BUTTON_MASTER, __button_master_irq, CHANGE);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;Hi Cosmin,&#60;br /&#62;
am not quite sure if this is you are looking for.&#60;br /&#62;
For my project it works pretty good. I think you have to debounce your button.&#60;br /&#62;
best regards
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cosminnci on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10808</link>
			<pubDate>Tue, 22 May 2012 09:02:00 +0000</pubDate>
			<dc:creator>cosminnci</dc:creator>
			<guid isPermaLink="false">10808@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;it is more complex but we tried with simple example and same behavior, we tested with pin38 the onboard button and it works.&#60;br /&#62;
could it be of the wires? somme kind of interference?&#60;/p&#62;
&#60;p&#62;#define PIN_BUTTON_STOP          38&#60;/p&#62;
&#60;p&#62;boolean trigg = false;&#60;/p&#62;
&#60;p&#62;void isr_stopProgram(){&#60;br /&#62;
        trigg = !trigg;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void setup(){&#60;br /&#62;
        pinMode( PIN_BUTTON_STOP, INPUT );&#60;br /&#62;
        attachInterrupt( PIN_BUTTON_STOP, isr_stopProgram, FALLING );&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop(){&#60;br /&#62;
  SerialUSB.println( trigg );&#60;br /&#62;
  delay(1000);&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pici on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10807</link>
			<pubDate>Tue, 22 May 2012 08:14:10 +0000</pubDate>
			<dc:creator>pici</dc:creator>
			<guid isPermaLink="false">10807@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;can you send your code or part of it ?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cosminnci on "External Interrupt fire random"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1779#post-10806</link>
			<pubDate>Tue, 22 May 2012 07:24:52 +0000</pubDate>
			<dc:creator>cosminnci</dc:creator>
			<guid isPermaLink="false">10806@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I use a maple ret5 with an 10k pull down resistor and a button when pressed connects to +5v, on another pin I use a relay board, with transistor and diode, this switches on and off a 220V solenoid, somehow the interrupt fires at every switch, rarely misses.&#60;/p&#62;
&#60;p&#62;if I completly disconnect the button it works ok.&#60;br /&#62;
how can I debug this?&#60;br /&#62;
do I need somme hardware changes?&#60;/p&#62;
&#60;p&#62;regards,&#60;br /&#62;
Cosmin
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
