Stufin
Home Quick Cart Profile

4-pin Long PushButton Switch (Pack of 5)

Buy Now on Stufin

Component Name

4-pin Long PushButton Switch (Pack of 5)

Description

The 4-pin Long PushButton Switch is a common electronic component used in various IoT projects and applications. This pack of 5 switches provides a convenient and cost-effective solution for incorporating push-button functionality into your designs.

Functionality

The 4-pin Long PushButton Switch is a type of momentary switch, which means it only maintains its switched state for as long as the button is pressed. When the button is released, the switch returns to its original state. This switch has a single pole double throw (SPDT) configuration, allowing it to connect or disconnect two separate circuits.

Key Features

  • 4-Pin Terminal: The switch has four terminals, including two switches (A and B) and two common pins (C and D). This allows for flexibility in connecting the switch to different circuits.
  • Long PushButton: The switch features a long pushbutton with a travel distance of approximately 2.5mm, providing a tactile feedback when pressed.
  • Momentary Action: The switch only switches when the button is pressed, returning to its original state when released.
  • SPDT (Single Pole Double Throw) Configuration: The switch can connect or disconnect two separate circuits, making it suitable for a wide range of applications.
  • Compact Size: The switch has a compact size, making it suitable for use in space-constrained IoT projects and applications.
  • Pack of 5: This pack includes five identical switches, providing a convenient and cost-effective solution for larger projects or prototyping.
  • Operating Voltage: The switch can operate within a wide voltage range, making it suitable for use with most IoT devices and projects.
  • Durability: The switch is designed to withstand a minimum of 100,000 cycles, ensuring reliable performance over an extended period.

Contact Rating

1A @ 24VDC

Insulation Resistance

100M min. @ 500VDC

Operating Temperature

-20C to 70C

Storage Temperature

-30C to 80C

Dimensions

12mm x 12mm x 10mm (L x W x H)

Applications

The 4-pin Long PushButton Switch is suitable for use in a wide range of IoT projects and applications, including

Robotics and automation systems

Home automation and smart home devices

Industrial control systems

Medical devices and equipment

Consumer electronics and appliances

Prototype development and proof-of-concept designs

Packing Information

The pack of 5 switches comes in a single package, with each switch individually wrapped to prevent damage during shipping and storage.

Pin Configuration

  • 4-Pin Long PushButton Switch (Pack of 5) Documentation
  • Overview
  • The 4-pin long pushbutton switch is a common component used in various IoT projects, robotics, and electronics applications. This documentation explains the pinout and connection details of the switch, making it easy to integrate into your projects.
  • Pinout Explanation
  • The 4-pin long pushbutton switch has four pins, labeled as follows:
  • Pin 1: NC (Normally Closed)
  • Function: Normally closed contact, connected to the common pin (COM) when the button is not pressed.
  • Description: When the button is not pressed, the NC pin is connected to the COM pin, allowing current to flow.
  • Pin 2: COM (Common)
  • Function: Common pin, connected to either NC or NO pins depending on the button's state.
  • Description: The COM pin acts as a reference point, connecting to either the NC or NO pins to establish or break the circuit.
  • Pin 3: NO (Normally Open)
  • Function: Normally open contact, connected to the common pin (COM) when the button is pressed.
  • Description: When the button is pressed, the NO pin is connected to the COM pin, allowing current to flow.
  • Pin 4: Ground
  • Function: Ground connection for the switch.
  • Description: This pin is used to connect the switch to a common ground point in the circuit.
  • Connection Structure
  • To connect the 4-pin long pushbutton switch, follow these steps:
  • 1. Connect Pin 2 (COM) to a digital input pin on your microcontroller or a voltage source (e.g., 5V).
  • 2. Connect Pin 3 (NO) to the output pin of the circuit you want to control (e.g., an LED, relay, or motor).
  • 3. Connect Pin 1 (NC) to a reference point or a pull-down resistor (optional, but recommended to prevent floating states).
  • 4. Connect Pin 4 (Ground) to a common ground point in your circuit.
  • Example Connection Diagram
  • ```
  • +---------------+
  • | PushButton |
  • +---------------+
  • |
  • |
  • v
  • +---------------+ +---------------+
  • | Microcontroller | | Output Circuit |
  • | (e.g., Arduino) | | (e.g., LED) |
  • +---------------+ +---------------+
  • | Digital Input | | Output Pin |
  • | (e.g., D2) | | (e.g., LED+) |
  • +---------------+ +---------------+
  • | |
  • | |
  • v v
  • +---------------+ +---------------+
  • | COM (Pin 2) | | NO (Pin 3) |
  • +---------------+ +---------------+
  • | 5V | | LED+ |
  • +---------------+ +---------------+
  • | |
  • | |
  • v v
  • +---------------+ +---------------+
  • | Ground (Pin 4) | | GND |
  • +---------------+ +---------------+
  • ```
  • In this example, when the button is pressed, the NO pin connects to the COM pin, allowing current to flow from the microcontroller's digital input pin to the output circuit (e.g., an LED). When the button is not pressed, the NC pin connects to the COM pin, breaking the circuit.
  • By following this documentation, you should be able to properly connect and use the 4-pin long pushbutton switch in your IoT projects.

Code Examples

4-pin Long PushButton Switch (Pack of 5) Documentation
Overview
The 4-pin Long PushButton Switch is a widely used IoT component for detecting button presses in various applications. This switch features four pins: two for the button's normally open (NO) and normally closed (NC) connections, and two for the common (COM) connections. This documentation provides a detailed overview of the switch's specifications, pinouts, and code examples for using it with popular microcontrollers.
Specifications
Operating Voltage: 2.5V to 12V
 Operating Current: 10mA to 100mA
 Contact Resistance: 50m max
 Insulation Resistance: 100M min
 Operating Temperature: -20C to 70C
 Storage Temperature: -40C to 85C
Pinout
The 4-pin Long PushButton Switch has the following pinout:
Pin 1: NO (Normally Open)
 Pin 2: COM (Common)
 Pin 3: COM (Common)
 Pin 4: NC (Normally Closed)
Code Examples
### Example 1: Using the 4-pin Long PushButton Switch with Arduino
In this example, we'll use the 4-pin Long PushButton Switch to control an LED connected to digital pin 13 of an Arduino Uno board.
```c++
const int buttonPin = 2;  // Pin 2 of the button switch connected to digital pin 2 of Arduino
const int ledPin = 13;   // LED connected to digital pin 13 of Arduino
void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}
void loop() {
  int buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);  // Turn on the LED when the button is pressed
  } else {
    digitalWrite(ledPin, LOW);  // Turn off the LED when the button is not pressed
  }
  delay(50);  // Debounce the button press
}
```
### Example 2: Using the 4-pin Long PushButton Switch with Raspberry Pi (Python)
In this example, we'll use the 4-pin Long PushButton Switch to control an LED connected to GPIO pin 17 of a Raspberry Pi.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
button_pin = 17  # Pin 4 of the button switch connected to GPIO pin 17
led_pin = 18  # LED connected to GPIO pin 18
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(led_pin, GPIO.OUT)
try:
    while True:
        button_state = GPIO.input(button_pin)
        if button_state == False:
            GPIO.output(led_pin, GPIO.HIGH)  # Turn on the LED when the button is pressed
        else:
            GPIO.output(led_pin, GPIO.LOW)  # Turn off the LED when the button is not pressed
        time.sleep(0.05)  # Debounce the button press
except KeyboardInterrupt:
    GPIO.cleanup()
```
### Example 3: Using the 4-pin Long PushButton Switch with ESP32 (MicroPython)
In this example, we'll use the 4-pin Long PushButton Switch to control an LED connected to GPIO pin 22 of an ESP32 board.
```python
import machine
import utime
button_pin = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)  # Pin 4 of the button switch connected to GPIO pin 0
led_pin = machine.Pin(22, machine.Pin.OUT)  # LED connected to GPIO pin 22
while True:
    button_state = button_pin.value()
    if button_state == 0:
        led_pin.value(1)  # Turn on the LED when the button is pressed
    else:
        led_pin.value(0)  # Turn off the LED when the button is not pressed
    utime.sleep_ms(50)  # Debounce the button press
```
Important Notes
Make sure to use a pull-up or pull-down resistor with the button pin to prevent floating inputs.
 Use a debouncing mechanism (e.g., `delay()` or `sleep()`) to prevent multiple button presses from being registered.
 Consult the datasheet of your microcontroller and the 4-pin Long PushButton Switch for specific pinouts and operating conditions.