Add Adafruit's Ring LED Momentary Switch to Raspberry Pi

Introduction: Add Adafruit's Ring LED Momentary Switch to Raspberry Pi

As part of my cord cutting system, I want a power indicator and a reset switch on a Raspberry Pi-based media center running Kodi on OSMC.

I've tried several different momentary switches. Adafruit's Rugged Metal Push Button with Blue LED is very cool.

This is the first of several instructables, which form the basis of a Kodi/OSMC hat for the Raspberry Pi.

In each instructable, I will get part of the hat to work and I think each piece of the hat is useful by itself.

Step 1: Gather Parts

Parts specific to this instructable:

  • Rugged Metal Push Button with Blue LED Adafruit $4.95
  • Short breakaway pins Adafruit $4.95

Reusable parts and tools (prices in USD):

  • Breadboard Fry's $7.99
  • Breadboard wires Fry's $7.99
  • Male to Female Jumper Wires Fry's $3.99
  • MacBook Pro (a PC could be used)
  • Raspberry Pi 3 Element14 $35
  • 5.2V 2.1A USB Power Adapter from Amazon $5.99
  • Micro USB to USB cable 3ft from Amazon $4.69
  • Case from Amazon $6.99
  • SanDisk Ultra 16 GB microSDHC Class 10 with Adapter (SDSQUAN-016G-G4A) from Amazon $8.99
  • Solder, Solder Station, Tip Cleaner
  • TV with HDMI port, USB keyboard, USB mouse, HDMI Cable


  • Text enclosed in spades, such as, ♣replace-this♣, should be replaced with an actual value. Of course, remove the spades.
  • The Raspberry Pi should be set up and running Kodi/OSMC
  • Adafruit has some excellent "instructables", but I they are difficult to find. In google, try:
    • ♣search-terms♣ inurl:
    • rugged led ring inurl:
  • Fritzing is an amazing tool for breadboarding

Step 2: Ring LED

In my applications, the ring LED is a power indicator. If the raspberry pi is powered and running then the Ring LED should be lit (or blue). If there is no power or the raspberry pi is shut down, then the ring LED should be off.

Ring LED Connections

A breadboard allows me to experiment with the circuit until it works. Male-to-female jumper wires and connecting wires that come with breadboards make this process easier. Male-to-female jumper wires connect the breadboard to the raspberry pi.

The two outer connections on the Ring Push button control the Ring LED. The ground terminal is connected to the Raspberry Pi ground in series with a 330 Ohm resistor. Ground is (-). And GPIO 24 will be connected to the positive terminal (+).

Utility software for python

The Ring LED software requires the rpi.gpio package. The following commands download, build and install rpi.gpio

$ sudo su
# apt-get update
# apt-get install python-pip python-dev gcc
# pip install rpi.gpio
# exit

Exit returns to $ prompt

Ring LED Software

Turn the Ring LED on

$ sudo nano /usr/local/bin/

and edit to be:

#!/usr/bin/env python

import RPi.GPIO as GPIO
import subprocess
import argparse
parser = argparse.ArgumentParser()

group = parser.add_mutually_exclusive_group()
group.add_argument("-l", "--light", action="store_true")
group.add_argument("-o", "--off", action="store_true")

# Disable warnings

# turn on gpio pin 24
GPIO.setup(24, GPIO.OUT)
args = parser.parse_args()
if args.light:

Type CTRL-o, CTRL-x ENTER to save the file and exit nano editor

Change the permissions on the file

$ sudo chmod 755 /usr/local/bin/

Create a start script:

$ sudo nano /etc/init.d/

and edit to be:

# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.

# Starts and stops
# Directory: /etc/init.d/
# Permsissions: chmod 755 /etc/init.d/

# Start or stop
case "$1" in
    /usr/local/bin/ --light &
    /usr/local/bin/ --off &
    echo "Usage: /etc/init.d/ {start|stop}"
    exit 1

Type CTRL-o, CTRL-x ENTER to save the file and exit nano editor

Change the permissions on the file

$ sudo chmod 755 /etc/init.d/

Register the script to run on boot

$ sudo insserv 

Start the script

$ sudo /etc/init.d/ start

The Ring LED should light up!

Step 3: Reset Switch

Reset Switch

In general, my Raspberry Pis run all the time. A Raspberry Pi 3 consumes very little power.

Ideally, I would like a power switch to safely shut down the pi, by calling sudo shutdown -h 0 before cutting off the power. However, implementing a power switch is more complicated and will be rarely used.

This is a reset switch, basically, it restarts the Raspberry Pi.

Solder two pins to Raspberry Pi 3

On the Raspberry Pi 3, find the Run holes - see image, box in yellow. The Run holes are near the gpio header.

Remove all cables (power, HDMI, ethernet, etc.) and the Micro SD card from the Raspberry Pi.

From the bottom of the board, solder two short breakaway male pins through the Run holes.

Connect everything back together and make sure it still works.

Connect N01 (normally open) on the momentary switch to one of the Run pins, and C1 to the other Run pin. NC1 (normally closed) is not used.

Press the button, and the system should reboot!

Be the First to Share


    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Unusual Uses Contest

      Unusual Uses Contest
    • Reclaimed Materials Contest

      Reclaimed Materials Contest



    6 months ago

    Where can i find the fritzing file for the pushbutton?


    Reply 6 months ago

    It has been awhile, but If I remember correctly there are add on device file libraries for fritzing. I think this was in an Adafruit supplied library that I found by googling.


    Question 1 year ago

    Great tutorial! I am trying to add this button to a project, and I am having trouble figuring out the wiring even with the schematic you posted. Do you have an image of the breadboard from above?


    Answer 1 year ago

    See the image in Step 3. The image shows the connections as labeled on the bottom or side of the button and how those wires connect to the pi.

    I don't have the breadboard setup any more.


    3 years ago on Step 3

    Hey, cool project. Wanted to ask couple of questions

    1st. On the site I see that the button has a built in resistor. Any reason you're using an additional one?

    2nd. I see you are using the N01 (normally open) connection on the button. If use a On-Off button, instead of a momentary, I would need the NC1 (normally closed) connection too right?


    Reply 3 years ago

    Thank you.

    A1. I don't think the button has a built in resistor, but the GPIO pin does. I could have used the GPIO pin resistor.

    A2. My understanding is for the reset to work on the Raspberry Pi is for the circuit to be normally open.

    My guess for an on-off button, would be pressing opens the circuit (i.e., makes it off). So, you would want to use this in a situation where the circuit is normally complete and opening it would do something.