This one should be simple, but I'm fairly new to this.

The button has a COM and an NO terminal. Beaglebone pins can only take 6mA, so I don't have much room for error. My question is, how do I wire this and does it need voltage?

More information:

Here are the pins: GPI/O Pins

  • \$\begingroup\$ More information will be needed. When you hit the button and close the circuit, what are you doing? What is on the other side of the button? Yes, if you are looking to read the button you will probably want to see a voltage change when its state is changed. \$\endgroup\$ – mikeY May 13 '13 at 20:38
  • \$\begingroup\$ I added more info, including the pin chart. I just want the button to act as an input. Not sure what else to say here. Using bonescript, I will be able to read the pin and see if it's high or low. \$\endgroup\$ – taco May 13 '13 at 21:49

Your button can be a pull-up or pull-down on a GPIO. You take on of the GPIO lines (configured as an input in software) and connect it to one of the button terminals. You place a resistor (say 10K) between that line and the 3.3V rail.

You then take the other terminal and connect it to ground.

When the button is open (i.e. not pressed) the GPIO line is pulled to +3.3V via the resistor and the input will read 1. When the button is pressed the line will be connected to ground and it will read 0. You can do "de-bouncing" in software by not reading the button after the first 1 to 0 transition, for small period, say 200 ms.

The point of the resistor is to pull the line back up to +3.3V when the button is released again, otherwise it would "float" at some indeterminate value. Hence it is called a "pull-up" resistor.

Here are a couple of examples. The left shows an active high switch with an external pull-down resistor. The right is an active low switch with an external pull-up resistor. The Beagleboard also has internal pull-up and pull-down resistors which can be enabled for this purpose. It may also be a good idea to put a small resistance (100 - 1k) in between the switch and the pin to protect it.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Consider adding a diagram. Edit your anser, then hit Ctrl-M and you get a simple schematic editor. \$\endgroup\$ – jippie May 14 '13 at 5:57
  • \$\begingroup\$ It should have internal pull ups/downs as well, so you can even simplify the circuit more... just a switch to either VCC or GND. \$\endgroup\$ – Marko May 15 '13 at 8:22
  • \$\begingroup\$ @Marko I mentioned that I'm my edit. \$\endgroup\$ – Kurt E. Clothier May 15 '13 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.