Push Buttons & Tactile Switches

A momentary tactile switch (push button) is a normally open (NO) mechanical switch that bridges an electrical connection only while it is physically pressed down.

Sensors11 blocksMicroPythonC++
Push Button

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the Push Button, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
1A1ASignal in
1B1BSignal in
2A2ASignal in
2B2BSignal in

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
PressedOn or offoff
Cap Color#000000

A momentary tactile switch (push button) is a normally open (NO) mechanical switch that bridges an electrical connection only while it is physically pressed down. In Open Maker Studio, buttons are the primary input device for detecting user presses, triggering interrupts, and controlling states.


1. Schematic Symbol

Standard SPST momentary (Normally Open) pushbutton symbol — electrically two terminals (the component's real 1A/1B group and 2A/2B group, internally bridged, act as one node each):

1 2

2. Pin Configuration (Tactile Switch Layout)

A standard tactile button features four pins arranged in two bridged pairs:

  • Pin 1A and Pin 1B: Internally shorted together inside the switch casing.
  • Pin 2A and Pin 2B: Internally shorted together inside the switch casing.
  • Switch Behavior: Pressing the button bridges the electrical connection between the 1 group and the 2 group.

[!TIP] Diagonal Wiring Best Practice: To ensure that the button behaves as a normally open switch and to prevent creating an accidental permanent short, always connect your wires diagonally (e.g. from Pin 1A to Pin 2B).


3. Floating Pins & Pull-Up / Pull-Down Circuits

When a microcontroller input pin is disconnected, it is in a floating state. The pin acts like a miniature antenna, picking up electrostatic noise and fluctuating randomly between high (1) and low (0) readings. To secure a stable reading, you must use reference resistors:

  • Pull-Down Resistor (Active High):
    • Connects a resistor (typically 10 kΩ10\ \text{k}\Omega) between the input pin and GND.
    • Connects the switch between the input pin and VCC.
    • Logic: When the button is open, the pin is pulled down to GND (LOW). When pressed, it bridges directly to VCC (HIGH).
  • Pull-Up Resistor (Active Low):
    • Connects a resistor (typically 10 kΩ10\ \text{k}\Omega) between the input pin and VCC.
    • Connects the switch between the input pin and GND.
    • Logic: When open, the pin is pulled up to VCC (HIGH). When pressed, it bridges to GND (LOW).
  • Internal Pull-Up Resistors (INPUT_PULLUP):
    • Microcontrollers (like ATmega328P, ESP32, and RP2040) contain internal software-controlled pull-up resistors (typically 20 kΩ20\ \text{k}\Omega to 50 kΩ50\ \text{k}\Omega) on their GPIO pins. This allows you to wire the button directly between the GPIO pin and GND, eliminating the need for an external physical resistor.

4. Mechanical Contact Bounce & Debouncing

When a physical button is pressed, the internal metal spring contacts do not connect cleanly. Instead, they bounce off each other rapidly for 55 to 1010 milliseconds before settling.

  • The Problem: A fast microcontroller can read these mechanical bounces as 1010 to 2020 individual presses in a fraction of a second.
  • The Solution (Debouncing):
    • Software Debounce: Code ignores subsequent state changes for a short window (typically 20ms to 50ms) after the first edge transition is detected.
    • Hardware Debounce: A small capacitor (e.g. 100100nF) placed in parallel with the switch filters out high-frequency contact noise.

5. Component Properties (Property Inspector)

When you select a Push Button on the canvas, you can modify the following parameters in the Property Inspector panel:

  • Pressed (pressed): A toggle switch representing the physical press state of the button (closed vs. open).
    • Default: false (normally open / released)
    • Options: true (bridges contacts 1 and 2), false (disconnects contacts)
  • Cap Color (capColor): Customizes the visual color of the push button cap on the canvas.
    • Default: #e74c3c (Red)
    • Range: Color picker palette

6. Supported Blockly Blocks

Drawing the blocks…

7. Simulator Behavior

  • Interactive Canvas Control: Click and hold the button graphic during active simulation to press it (real pointerdown/pointerup/pointerleave handlers) — releasing the mouse (or moving off the button while held) automatically returns it to the unpressed state.
  • Visual Feedback: The plunger visibly scales down slightly (~92%) while held, a physical "click" animation — the cap's color itself doesn't change to indicate state. There's no live voltage/potential readout on the connected wires; wires don't display any per-net value overlay in OMS today.

Push Buttons & Tactile Switches — OMS Parts