Hardware

GPIO wiring guide

How to wire buttons, switches, and LEDs to the GPIO pins used by GlanceRF (e.g. on a Raspberry Pi). This page covers resistors, grounding, pull-up/pull-down, and good practice so your hardware is safe and reliable.

Overview

GlanceRF can use GPIO for inputs (buttons, switches) and outputs (LEDs, e.g. “satellite in pass”). GPIO is only available when running on a board that exposes pins (such as a Raspberry Pi). Use the app’s GPIO page (Menu → GPIO) to assign pins to module functions. Below we focus on how to wire things correctly.

Grounding (earthing)

Use a common ground between the Pi and all peripherals. All grounds (Pi GND, switch legs, LED cathodes, power supply negative) should tie to the same ground. Never leave a pin floating (unconnected); floating inputs can read noise and behave unpredictably.

  • Connect one side of every switch or button to a Pi GND pin (or a common ground rail that goes to Pi GND).
  • LED cathodes (negative leg) go to GND (often via a resistor); the GPIO pin drives the anode through a resistor.
  • Keep wires short where possible; long wires can pick up noise and cause false triggers.

Buttons and switches (inputs)

GPIO inputs need a defined voltage when the button is not pressed. That is done with a pull-up or pull-down resistor.

Pull-up (recommended for simple buttons)

One leg of the button goes to the GPIO pin; the other goes to GND. A resistor (e.g. 10 kΩ) connects the same GPIO pin to 3.3 V (not 5 V on a Pi). When the button is open, the pin sees 3.3 V (high). When you press the button, the pin is shorted to GND (low). The resistor limits current when the button is pressed.

  • Wiring: 3.3 V → resistor (10 kΩ) → GPIO pin; same GPIO pin → one button leg; other button leg → GND.
  • You can enable the Pi’s internal pull-up in software and omit the external resistor for a minimal circuit: GPIO pin → button → GND. Internal pull-ups are typically 50–65 kΩ, which is fine for most buttons.

Pull-down

Alternatively, the button connects the GPIO pin to 3.3 V when pressed, and a resistor (e.g. 10 kΩ) ties the pin to GND when the button is open. Then “released” = low, “pressed” = high.

  • Wiring (pull-down): GPIO pin → resistor (10 kΩ) → GND; same GPIO pin → one button leg; other button leg → 3.3 V.

Resistor values

For pull-up or pull-down, 4.7 kΩ to 10 kΩ is typical. Lower values draw more current when the switch is closed; higher values are weaker and can be more susceptible to noise. 10 kΩ is a good default.

LEDs (outputs)

Never connect an LED directly from a GPIO pin to GND or to 3.3 V without a current-limiting resistor. GPIO pins can only safely source or sink a few tens of milliamps; an LED without a resistor can pull too much current and damage the pin or the board.

Simple LED circuit

GPIO pin → resistor → LED anode (+); LED cathode (−) → GND. When the pin is high, current flows through the resistor and LED to ground. Choose the resistor so the LED current is safe (e.g. 5–15 mA for a typical small LED).

  • Example (3.3 V, ~2 V LED, 10 mA): R = (3.3 − 2) / 0.01 ≈ 130 Ω. A 330 Ω or 470 Ω resistor is a safe, common choice and keeps current well below 20 mA.
  • Use 330–1000 Ω for standard 3.3 V GPIO-driven LEDs; 330 Ω gives a brighter LED, 1 kΩ is dimmer but very safe.

Higher current (optional)

For larger LEDs or higher current, drive the LED through a small NPN transistor or a MOSFET; the GPIO pin drives the base or gate through a resistor (e.g. 1 kΩ), and the LED (with its own series resistor) is in the collector/drain circuit powered by 3.3 V or a separate supply. That keeps GPIO current low while allowing the LED to draw more current from the supply.

Best practices summary

  • Common ground — Tie all grounds together (Pi and peripherals).
  • No floating inputs — Use pull-up or pull-down so every input has a defined level when the switch is open.
  • Resistor for inputs — 4.7–10 kΩ for external pull-up/pull-down; or use the Pi’s internal pull-up/pull-down if your software supports it.
  • Resistor for LEDs — Always use a series resistor (e.g. 330–1000 Ω for 3.3 V); never connect an LED directly to a GPIO pin.
  • 3.3 V only — Raspberry Pi GPIO is 3.3 V. Do not connect 5 V logic or unknown voltages directly to GPIO pins.
  • Double-check wiring — Before powering on, verify pin numbers (e.g. BCM vs physical), polarity of LEDs, and that no pin is shorted to the wrong rail.

Configuring GPIO in GlanceRF

In GlanceRF, open the menu (press M) and go to GPIO. There you can assign which GPIO pins (by BCM number) drive which module functions (e.g. a button to advance the countdown, an LED for “satellite in pass”). The app uses the Raspberry Pi’s BCM pin numbering. For hardware details and pinout, see the official Raspberry Pi documentation.

Back to home