Stufin
Home Quick Cart Profile

4-Pins DIP Momentary Square Tactile Push Button Switch 10 Pieces - 6x6x5mm

Buy Now on Stufin

Component Description

4-Pins DIP Momentary Square Tactile Push Button Switch 10 Pieces - 6x6x5mm

Overview

The 4-Pins DIP Momentary Square Tactile Push Button Switch is a compact, surface-mountable switch designed for various IoT applications. This component is part of a package of 10 pieces, each measuring 6x6x5mm in size. The switch features a momentary action, meaning it only remains in the "on" state while being pressed, and returns to the "off" state when released.

Functionality

The primary function of this push button switch is to provide a simple, intuitive way to interact with electronic devices. When pressed, the switch connects the two pins (normally open, NO), allowing the flow of electric current. When released, the switch disconnects the pins, breaking the circuit. This momentary action is useful in applications where a temporary signal or power is required.

Key Features

  • Compact Size: The switch measures 6x6x5mm, making it suitable for compact IoT devices and designs where space is limited.
  • 4-Pin DIP (Dual In-Line Package): The switch features a Dual In-Line Package with four pins, allowing for easy surface mounting and connections.
  • Momentary Action: The switch only remains in the "on" state while being pressed, and returns to the "off" state when released.
  • Tactile Feedback: The switch provides a distinct tactile "click" when pressed, giving users a clear indication of the switch's state.
  • Low Profile: The switch's low profile design (5mm height) makes it ideal for applications where vertical space is limited.
  • 10 Pieces per Package: This component is sold in a package of 10 pieces, making it economical for prototyping, testing, and production.
  • RoHS Compliant: The switch is compliant with the Restriction of Hazardous Substances (RoHS) directive, ensuring environmental sustainability.

Electrical Characteristics

Rated Voltage

12V DC

Rated Current

50mA

Contact Resistance

50m

Insulation Resistance

100M

Operating Temperature

-20C to 70C

Mechanical Characteristics

Operating Force

1.5N to 2.5N

Travel Distance

0.5mm

Life Expectancy

100,000 cycles

Applications

The 4-Pins DIP Momentary Square Tactile Push Button Switch is suitable for a wide range of IoT applications, including

Remote control systems

Automation and robotics

Consumer electronics

Medical devices

Industrial control systems

Wearable devices

Prototyping and development boards

Recommendations

Use a gentle, controlled force when pressing the switch to ensure reliable operation and longevity.

Ensure the switch is properly secured to the PCB to prevent mechanical stress and damage.

Follow proper soldering techniques to ensure reliable connections.

Pin Configuration

  • Component Documentation: 4-Pins DIP Momentary Square Tactile Push Button Switch
  • Overview
  • The 4-Pins DIP Momentary Square Tactile Push Button Switch is a compact, surface-mountable switch designed for a wide range of IoT applications. It features a small footprint of 6x6x5mm and comes in a pack of 10 pieces. This documentation provides a detailed explanation of the switch's pins, their functions, and a step-by-step guide on how to connect them.
  • Pin Description
  • The 4-Pins DIP Momentary Square Tactile Push Button Switch has four pins, labeled as follows:
  • Pin 1: NC (Normally Closed)
  • Function: This pin is connected to the switch's internal circuitry and is normally closed (connected) when the button is not pressed.
  • Connection: Connect to the circuit's ground or a pull-down resistor to ensure the switch is in a known state when not pressed.
  • Pin 2: COM (Common)
  • Function: This pin is the common terminal of the switch, connecting to the internal circuitry and the NC pin.
  • Connection: Connect to the power supply or the circuit's positive voltage rail.
  • Pin 3: NO (Normally Open)
  • Function: This pin is connected to the switch's internal circuitry and is normally open (disconnected) when the button is not pressed.
  • Connection: Connect to the circuit's output or load, which will be energized when the button is pressed.
  • Pin 4: NC (Normally Closed) - duplicate
  • Function: This pin is identical to Pin 1, providing an additional connection point for the normally closed circuit.
  • Connection: Can be connected to the same point as Pin 1 or used as an additional connection for the circuit's ground or pull-down resistor.
  • Connection Structure
  • To connect the switch correctly, follow these steps:
  • 1. Connect Pin 2 (COM) to the power supply or positive voltage rail.
  • 2. Connect Pin 1 (NC) and Pin 4 (NC) to the circuit's ground or a pull-down resistor. This ensures the switch is in a known state when not pressed.
  • 3. Connect Pin 3 (NO) to the circuit's output or load. This will energize the load when the button is pressed.
  • Important Notes
  • The switch is momentary, meaning it only connects the NC and NO pins when the button is pressed. When the button is released, the switch returns to its normal state.
  • Use a pull-down resistor or a debouncing circuit to prevent unintended triggering of the switch due to noise or bounce.
  • Ensure the switch is properly mounted and secured to prevent mechanical stress or damage.
  • By following these guidelines, you can effectively incorporate the 4-Pins DIP Momentary Square Tactile Push Button Switch into your IoT project, ensuring reliable and efficient operation.

Code Examples

Component Documentation: 4-Pins DIP Momentary Square Tactile Push Button Switch
Overview
The 4-Pins DIP Momentary Square Tactile Push Button Switch is a compact, surface-mountable switch designed for use in a variety of IoT applications. This switch features a momentary action, meaning it only closes the circuit when the button is pressed and returns to its open state when released. The switch has four pins, making it suitable for use in circuits that require a common ground or voltage connection.
Pinout
The switch has a standard DIP (Dual In-Line Package) pinout, with the following connections:
Pin 1: NO (Normally Open) - connected to the load or output circuit
 Pin 2: COM (Common) - connected to ground or voltage source
 Pin 3: COM (Common) - connected to ground or voltage source
 Pin 4: NC (Normally Closed) - not used in momentary mode, but can be used as an additional output in alternate applications
Electrical Characteristics
Operating voltage: 12V DC
 Contact resistance: 50m max
 Switching current: 100mA max
 Operating life: 100,000 cycles min
Code Examples
Example 1: Basic Switch Debouncing using Arduino
In this example, we'll use the switch to control an LED on an Arduino board. We'll also implement a simple debouncing mechanism to prevent multiple triggers from a single button press.
```c++
const int buttonPin = 2;  // Connect switch NO pin to Arduino digital pin 2
const int ledPin = 13;   // Connect LED to Arduino digital pin 13
int buttonState = 0;      // Variable to store button state
int lastButtonState = 0;  // Variable to store last button state
int debounceDelay = 50;  // Debounce delay in milliseconds
void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}
void loop() {
  int reading = digitalRead(buttonPin);
  if (reading != lastButtonState) {
    lastButtonState = reading;
    if (reading == HIGH) {
      // Button pressed, turn on LED
      digitalWrite(ledPin, HIGH);
    } else {
      // Button released, turn off LED
      digitalWrite(ledPin, LOW);
    }
    delay(debounceDelay);
  }
}
```
Example 2: Using the Switch with a Raspberry Pi to Trigger a Python Script
In this example, we'll use the switch to trigger a Python script on a Raspberry Pi. We'll connect the switch to a GPIO pin on the Raspberry Pi and use the RPi.GPIO library to read the switch state.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO pin as input
GPIO.setmode(GPIO.BCM)
button_pin = 17
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def trigger_script():
    print("Button pressed! Triggering script...")
    # Add your script code here
try:
    while True:
        if GPIO.input(button_pin) == GPIO.LOW:
            trigger_script()
            time.sleep(0.5)  # Debounce delay
except KeyboardInterrupt:
    GPIO.cleanup()
```
Example 3: Using the Switch with an ESP32 Board to Send an HTTP Request
In this example, we'll use the switch to send an HTTP request to a server using an ESP32 board. We'll connect the switch to a digital pin on the ESP32 and use the WiFi client library to send the request.
```c++
#include <WiFi.h>
#include <HTTPClient.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const char serverUrl = "http://example.com/switch_trigger";
WiFiClient client;
HTTPClient http;
void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");
  Serial.println("Initializing switch...");
  pinMode(32, INPUT);  // Connect switch NO pin to ESP32 digital pin 32
}
void loop() {
  int buttonState = digitalRead(32);
  if (buttonState == LOW) {
    Serial.println("Button pressed! Sending request...");
    http.begin(client, serverUrl);
    int httpResponseCode = http.GET();
    if (httpResponseCode > 0) {
      Serial.println("Request sent successfully!");
    } else {
      Serial.println("Error sending request:");
      Serial.println(http.errorString(httpResponseCode));
    }
    delay(500);  // Debounce delay
  }
}
```
Remember to modify the code examples to fit your specific use case and IoT application.