A push button is a simple switch mechanism that controls an electric circuit, making it one of the most common and easy-to-understand components in electronics.
When you press a push button, it completes a circuit and allows current to flow, activating a connected component or system (like a light, motor, or sound alarm).
When you release the button, it returns to its original position and breaks the circuit, stopping the current flow.
A is a type of switch that completes an electrical circuit when pressed.
Basic Structure of a push button
A push button typically consists of two metal contacts and a spring. When pressed, the contacts are bridged, allowing electricity to flow.
Momentary Push Button
Only completes the circuit when pressed. Once released, it breaks the circuit. This type is widely used in everyday items like keyboards and doorbells.
Latching Push Button
Remains in its pressed state after being pushed until it’s pressed again, commonly used in on/off power switches.
What is one common use for a latching push button?
A latching push button requires an additional press to change its back to the original.
Push button functionality
Push buttons usually have two or four pins. In a two-pin button, pressing it closes the circuit. Four-pin buttons can have two pins dedicated to the input and two to the output, allowing more control over different connections.
In programming, a can be used to monitor the state of the 4 pin push button to trigger specific actions.
In a typical setup, the two on one side of the button are for input and the other two are for output.
NO vs NC Buttons
NO (Normally Open) vs. NC (Normally Closed): NO buttons start open, only closing the circuit when pressed.
NC buttons are the opposite, completing the circuit when not pressed and opening when pressed.
When a normally off switch is activated, the circuit .
Example Circuit with Push Button
Here is an simple circuit and for connecting a switch to the microbit using a breakout board.
On side of the switch is connected to pin 0 (the input pin) and the other side is connected to the Ground. When the push button is pressed the circuit is closed and the current passes from pin 0 to Ground
Example Code
Here is a simple piece of test code that will display either a tick or a cross depending on the open or closed state of the button.