Stufin
Home Quick Cart Profile

2 Pin Button Switch (Pack of 10)

Buy Now on Stufin

Name

2 Pin Button Switch (Pack of 10)

Type

Mechanical Switch

Description

A pack of 10 miniature 2-pin button switches, ideal for various IoT, robotics, and electronics projects.

Functionality

The 2 Pin Button Switch is a simple, mechanical switch that allows users to control the flow of electrical current in a circuit. When the button is pressed, the switch connects the two pins, allowing current to flow. When the button is released, the switch opens, breaking the circuit and interrupting the current flow.

Key Features

  • Compact Size: The switch has a small footprint, making it perfect for space-constrained projects and devices.
  • 2-Pin Interface: The switch has two pins, making it easy to integrate into breadboards, PCBs, or other electronic circuits.
  • Momentary Action: The switch is designed for momentary action, meaning it only conducts electricity when the button is physically pressed.
  • SPST (Single Pole Single Throw) Configuration: The switch has a single pole and single throw configuration, which means it can be used to connect or disconnect a single circuit.
  • Rated Voltage and Current: The switch is rated for a maximum voltage of 12V DC and a maximum current of 50mA, making it suitable for low-power applications.
  • Operation Life: The switch is designed for a long operation life, with a minimum of 10,000 cycles.
  • Tactile Feedback: The switch provides a clear, tactile feedback when pressed, making it easy to use in a variety of applications.
  • Pack of 10: The component comes in a pack of 10, providing a cost-effective solution for projects that require multiple switches.

Dimensions

6.5mm x 6.5mm x 5.5mm (L x W x H)

Weight

Approximately 0.5g per switch

Material

PCB-mounted switch with metal contacts and a plastic housing

Color

Typically black or gray, depending on the manufacturer

Use Cases

IoT projects, such as home automation systems or wearable devices

Robotics projects, such as robotic arms or grippers

Electronics projects, such as DIY gadgets or prototyping boards

Consumer electronics, such as toys or appliances

Notes and Precautions

Handle the switches with care to avoid damage or deformation.

Ensure the switch is properly mounted and secured to prevent accidental activation or damage.

Use the switch within its rated voltage and current specifications to avoid degradation or failure.

Clean the switch regularly to prevent dust or dirt accumulation, which can affect its performance.

Pin Configuration

  • Component Documentation: 2 Pin Button Switch (Pack of 10)
  • Overview
  • The 2 Pin Button Switch is a compact, simple, and widely used component in IoT projects. This pack of 10 switches is ideal for prototyping and building various applications that require a push-button interface. Each switch has two pins, making it easy to integrate into a circuit.
  • Pinout Explanation
  • The 2 Pin Button Switch has two pins, labeled as follows:
  • 1. Pin 1: Normally Open (NO) Pin
  • Function: This pin is connected to the switch's internal contact. When the button is pressed, the internal contact closes, and the pin becomes connected to Pin 2.
  • Behavior: Normally, this pin is open (not connected to Pin 2) when the button is not pressed. When the button is pressed, it becomes connected to Pin 2.
  • Typical Connection: Connect to a digital input pin on a microcontroller or a power source.
  • 2. Pin 2: Common (COM) Pin
  • Function: This pin is the common pin of the switch, connected to the other side of the internal contact.
  • Behavior: This pin is always connected to one side of the internal contact, regardless of the button's state.
  • Typical Connection: Connect to ground or a reference voltage.
  • Connection Structure
  • To use the 2 Pin Button Switch in a circuit, follow this connection structure:
  • Pin 1 (NO):
  • + Connect to a digital input pin on a microcontroller (e.g., Arduino, Raspberry Pi, etc.).
  • + Alternatively, connect to a power source (e.g., VCC) through a pull-up resistor (typically 1 k to 10 k).
  • Pin 2 (COM):
  • + Connect to ground (GND) or a reference voltage (e.g., 0V).
  • Example Circuit Diagram
  • Here's a simple example circuit diagram to illustrate the connection:
  • ```
  • +-----------+
  • | |
  • | Micro |
  • | Controller|
  • | |
  • +-----------+
  • |
  • |
  • v
  • +-----------+
  • | |
  • | Pull-up |
  • | Resistor |
  • | (1 k) |
  • +-----------+
  • |
  • |
  • v
  • +-----------+
  • | |
  • | 2 Pin |
  • | Button |
  • | Switch |
  • +-----------+
  • |
  • |
  • v
  • +-----------+
  • | |
  • | GND |
  • | |
  • +-----------+
  • ```
  • In this example, Pin 1 (NO) is connected to a digital input pin on the microcontroller, and Pin 2 (COM) is connected to ground (GND). When the button is pressed, Pin 1 becomes connected to Pin 2, and the microcontroller can detect the button press.
  • Remember to adjust the pull-up resistor value according to your specific requirements and the microcontroller's input impedance.

Code Examples

2 Pin Button Switch (Pack of 10) Documentation
Overview
The 2 Pin Button Switch is a simple, momentary push-button switch that can be used to trigger various events in IoT projects. This pack of 10 switches is ideal for prototyping and development of IoT devices. Each switch has two pins, which are connected internally and can be used to connect to a microcontroller or other digital devices.
Pinout
The 2 Pin Button Switch has the following pinout:
Pin 1: One terminal of the switch
 Pin 2: The other terminal of the switch
Operating Principle
When the button is pressed, the two pins are connected, allowing current to flow between them. When the button is released, the connection is broken, and no current flows between the pins.
Code Examples
### Example 1: Using the 2 Pin Button Switch with Arduino
In this example, we will use the 2 Pin Button Switch to control an LED connected to pin 13 of an Arduino board.
Hardware Requirements
Arduino Board (e.g., Arduino Uno)
 2 Pin Button Switch
 LED
 220 ohm resistor
 Breadboard and jumper wires
Code
```c++
const int buttonPin = 2; // Pin connected to one terminal of the switch
const int ledPin = 13;  // Pin connected to the LED
void setup() {
  pinMode(buttonPin, INPUT); // Set button pin as input
  pinMode(ledPin, OUTPUT); // Set LED pin as output
}
void loop() {
  int buttonState = digitalRead(buttonPin); // Read the button state
  if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH); // Turn on the LED
  } else {
    digitalWrite(ledPin, LOW); // Turn off the LED
  }
  delay(50);
}
```
Explanation
In this example, we connect one terminal of the switch to digital pin 2 of the Arduino board and the other terminal to ground. When the button is pressed, the voltage on pin 2 goes high, and we read this state using `digitalRead()`. If the button is pressed, we turn on the LED connected to pin 13 using `digitalWrite()`.
### Example 2: Using the 2 Pin Button Switch with Raspberry Pi (Python)
In this example, we will use the 2 Pin Button Switch to trigger a Python script on a Raspberry Pi.
Hardware Requirements
Raspberry Pi
 2 Pin Button Switch
 Breadboard and jumper wires
Code
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)  # Use Broadcom numbering
button_pin = 17  # Pin connected to one terminal of the switch
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
    if GPIO.input(button_pin) == GPIO.LOW:
        print("Button pressed!")
        # Add your code here to perform an action when the button is pressed
        time.sleep(0.5)  # Debounce
```
Explanation
In this example, we connect one terminal of the switch to GPIO pin 17 of the Raspberry Pi and the other terminal to ground. We use the `RPi.GPIO` library to read the button state. When the button is pressed, the voltage on the pin goes low, and we detect this state using `GPIO.input()`. If the button is pressed, we print a message to the console and add our custom code to perform an action.
Note: Ensure to modify the pin numbers and code according to your specific IoT project requirements.