Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

External switch

external switch

Best Answer Mario Vernari, 20 March 2015 - 04:53 AM

I just tried for you...

 

explosion-of-fire.jpg

 

 

In theory, your circuit should work, but the problem is that the Netduino does not offer a "pull down" feature.

Simply invert the logic, and wire the button from the input to the ground, then set the "pull up". This is also the preferred way to connect a pushbutton/switch because the ground is everywhere but the +3.3V not.

 

Remember, if you try to register the button activity via interrupt or so, you may easily experience "bounces". That is, when you press the button, you'll see several unexpected "on/off" events, which are undesired. Those bounces are due to the mechanical structure of the button.

There are two ways to solve this problem:

  • add an external capacitor (e.g. 100nF or more, not critical) across the button. This is an "hardware filter".
  • do NOT use the interrupt, and implement a "digital filter" by sampling the state of the input periodically, then detect the stable state. In this case you won't need a capacitor.

Bear in mind, for a quick test on a breadboard, there's no problems at all. Once you'd create a reliable definitive circuit, I'd use both the filter ways: capacitor and sampling. Bullet-proof!

 

Good luck!

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Emilio Pastore

Emilio Pastore

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationSo Paulo, Brasil

Posted 19 March 2015 - 07:02 PM

Hi guys.

 

I wonder if the attached setup works -or would burn down my apartment to ashes. Black goes from 3V3 to a button pole and yellow goes from pin 0 to the other button pole.

 

If so, would it be okay to read from pin 0 with

 

externalSwitch = new InputPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.PullDown);

 

Thanks, Emilio

 

 

Attached Files



#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 20 March 2015 - 04:53 AM   Best Answer

I just tried for you...

 

explosion-of-fire.jpg

 

 

In theory, your circuit should work, but the problem is that the Netduino does not offer a "pull down" feature.

Simply invert the logic, and wire the button from the input to the ground, then set the "pull up". This is also the preferred way to connect a pushbutton/switch because the ground is everywhere but the +3.3V not.

 

Remember, if you try to register the button activity via interrupt or so, you may easily experience "bounces". That is, when you press the button, you'll see several unexpected "on/off" events, which are undesired. Those bounces are due to the mechanical structure of the button.

There are two ways to solve this problem:

  • add an external capacitor (e.g. 100nF or more, not critical) across the button. This is an "hardware filter".
  • do NOT use the interrupt, and implement a "digital filter" by sampling the state of the input periodically, then detect the stable state. In this case you won't need a capacitor.

Bear in mind, for a quick test on a breadboard, there's no problems at all. Once you'd create a reliable definitive circuit, I'd use both the filter ways: capacitor and sampling. Bullet-proof!

 

Good luck!


Biggest fault of Netduino? It runs by electricity.

#3 Emilio Pastore

Emilio Pastore

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationSo Paulo, Brasil

Posted 20 March 2015 - 12:37 PM

hahahahah thanks, Mario ! heheheheheeh






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.