There is nothing more frustrating than a push button that seems to work at random. The good news is the fix is pretty simple: a resistor.
It may not seem obvious when you first start working with electronics but a “floating pin” doesn’t have a defined “high” or “low” level. Remember from the Analog and Digital video, that Digital Electronics has defined voltage levels. Well, when you don’t connect anything to the I/O pin of your microcontroller, the voltage level is undefined!
Episode #15 of AddOhms Looks at what happens when you leave a pin floating and how you can create a floating pin with a push-button!
There’s even a quick peek inside of my “studio”!
First Launchpad / Energia Video
This episode is focused on a Launchpad from TI. The Energia project is an Arduino-like environment for Launchpad boards. Everything in the video applies to an Arduino. On my blog, I wrote about my first impressions of Energia and the Launchpad.
When you enable the internal pull-up resistor, you want to connect one side of your button to the pin and the other side to ground. If you use an external pull-up resistor, use something between 10k and 100k.
- Written Pull-Up Resistor tutorial [via baldengineer]
- Code used in Episode [via pastebin]
- Arduino Uno [via makershed]
- LaunchPad [via energia]
- Fluke Multimeter
- Rigol Oscilloscope
- Breadboard-able Tactile Pushbuttons [via adafruit]
- Two pushbuttons on one pcb [via tindie]
Support AddOhms by joining the Bald Engineer’s Patreon.
Amazing! simple but functional. You make the building process look very easy. Thank you for share.