Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Pimoroni OnOffShim: Examples, Pinouts, and Specs

Image of Pimoroni OnOffShim
Cirkit Designer LogoDesign with Pimoroni OnOffShim in Cirkit Designer

Introduction

The Pimoroni OnOffShim is a compact add-on board designed for Raspberry Pi devices. It provides a convenient and safe way to manage power by enabling users to turn their Raspberry Pi on and off using a physical button. The OnOffShim ensures a clean shutdown process, preventing potential data corruption or damage to the Raspberry Pi's operating system.

This component is ideal for projects where easy power management is essential, such as portable Raspberry Pi setups, embedded systems, or any application requiring a user-friendly power control mechanism.

Explore Projects Built with Pimoroni OnOffShim

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
Image of Rocket: A project utilizing Pimoroni OnOffShim in a practical application
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Raspberry Pi Zero with OLED Display and EmStat Pico for Portable Data Acquisition
Image of RPI Zero Prototype: A project utilizing Pimoroni OnOffShim in a practical application
This circuit is a portable system powered by a 3.7V LiPo battery, which is boosted to 5V using an Adafruit PowerBoost 1000C to power a Raspberry Pi Zero and an EmStat Pico. The Raspberry Pi Zero interfaces with an OLED display via I2C and a tactile switch for user input, while the EmStat Pico communicates with the Raspberry Pi over UART for data acquisition or control purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi Pico Controlled Alternating LED Indicator
Image of Base Pico Test: A project utilizing Pimoroni OnOffShim in a practical application
This circuit features a Raspberry Pi Pico microcontroller used to control two LEDs (one red, one green) through GPIO pins 16 and 17. The LEDs are each connected in series with a 220-ohm resistor to limit current, and the Pico is powered via a USB power connection. The embedded code alternates the LEDs on and off every second, and there are connections to a DIP switch, which suggests potential user input to modify the behavior, although the switch is not utilized in the provided code.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Game Controller with SparkFun Pro Micro and Raspberry Pi 4B
Image of Raspberry Pi handheld: A project utilizing Pimoroni OnOffShim in a practical application
This circuit is a custom game controller featuring a SparkFun Pro Micro microcontroller, multiple tactile pushbuttons, and two analog joysticks. The Pro Micro reads inputs from the buttons and joysticks, processes them, and sends the corresponding gamepad signals. Additionally, a Raspberry Pi 4B is powered by a Pisugar S Pro battery module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Pimoroni OnOffShim

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Rocket: A project utilizing Pimoroni OnOffShim in a practical application
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of RPI Zero Prototype: A project utilizing Pimoroni OnOffShim in a practical application
Battery-Powered Raspberry Pi Zero with OLED Display and EmStat Pico for Portable Data Acquisition
This circuit is a portable system powered by a 3.7V LiPo battery, which is boosted to 5V using an Adafruit PowerBoost 1000C to power a Raspberry Pi Zero and an EmStat Pico. The Raspberry Pi Zero interfaces with an OLED display via I2C and a tactile switch for user input, while the EmStat Pico communicates with the Raspberry Pi over UART for data acquisition or control purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Base Pico Test: A project utilizing Pimoroni OnOffShim in a practical application
Raspberry Pi Pico Controlled Alternating LED Indicator
This circuit features a Raspberry Pi Pico microcontroller used to control two LEDs (one red, one green) through GPIO pins 16 and 17. The LEDs are each connected in series with a 220-ohm resistor to limit current, and the Pico is powered via a USB power connection. The embedded code alternates the LEDs on and off every second, and there are connections to a DIP switch, which suggests potential user input to modify the behavior, although the switch is not utilized in the provided code.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Raspberry Pi handheld: A project utilizing Pimoroni OnOffShim in a practical application
Battery-Powered Game Controller with SparkFun Pro Micro and Raspberry Pi 4B
This circuit is a custom game controller featuring a SparkFun Pro Micro microcontroller, multiple tactile pushbuttons, and two analog joysticks. The Pro Micro reads inputs from the buttons and joysticks, processes them, and sends the corresponding gamepad signals. Additionally, a Raspberry Pi 4B is powered by a Pisugar S Pro battery module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Portable Raspberry Pi projects
  • Media centers and home automation systems
  • Embedded systems requiring safe shutdown
  • Projects with limited access to power switches

Technical Specifications

The Pimoroni OnOffShim is designed to work seamlessly with Raspberry Pi boards. Below are its key technical details:

Key Specifications

Parameter Value
Input Voltage Range 2.8V to 5.5V
Maximum Current 2.5A
Dimensions 19.5mm x 18mm x 2.75mm
Button Type Momentary push-button
Compatibility All 40-pin Raspberry Pi models
Shutdown Signal Pin GPIO 17 (BCM numbering)

Pin Configuration

The OnOffShim connects directly to the Raspberry Pi's GPIO header. Below is the pin configuration:

Pin on OnOffShim Corresponding GPIO Pin Description
5V Pin 2 or Pin 4 Power input (5V)
GND Pin 6 or Pin 9 Ground
GPIO 17 Pin 11 Shutdown signal (BCM GPIO 17)

Usage Instructions

Installation

  1. Attach the OnOffShim: Align the OnOffShim with the Raspberry Pi's GPIO header and gently press it into place.
  2. Connect Power: Plug the power supply into the OnOffShim's micro-USB port.
  3. Install Software: To enable the safe shutdown functionality, install the required software on your Raspberry Pi:
    • Open a terminal on your Raspberry Pi.
    • Run the following commands:
      curl https://get.pimoroni.com/onoffshim | bash
      
      This script will install the necessary software and configure the GPIO pin for shutdown.

Using the OnOffShim

  • Power On: Press the button on the OnOffShim to power on the Raspberry Pi.
  • Safe Shutdown: Press and hold the button for 3 seconds to initiate a safe shutdown. The Raspberry Pi will power off automatically after the shutdown process is complete.

Important Considerations

  • Ensure the OnOffShim is securely connected to the GPIO header before powering on the Raspberry Pi.
  • Use a power supply that meets the Raspberry Pi's voltage and current requirements.
  • Avoid disconnecting the power supply while the Raspberry Pi is running to prevent data corruption.

Example Code for Custom Shutdown Behavior

If you want to customize the behavior of the OnOffShim, you can use the following Python script. This script listens for a button press on GPIO 17 and initiates a shutdown:

import RPi.GPIO as GPIO
import os
import time

Set up GPIO 17 (BCM numbering) as an input pin

BUTTON_PIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def shutdown(channel): # Function to safely shut down the Raspberry Pi print("Shutdown button pressed. Shutting down...") os.system("sudo shutdown -h now")

Add an event listener for the button press

GPIO.add_event_detect(BUTTON_PIN, GPIO.FALLING, callback=shutdown, bouncetime=200)

print("OnOffShim is ready. Press the button to shut down.")

try: # Keep the script running while True: time.sleep(1) except KeyboardInterrupt: # Clean up GPIO settings on exit GPIO.cleanup()


Notes:

  • Save the script as onoffshim_shutdown.py and run it with sudo python3 onoffshim_shutdown.py.
  • Ensure the RPi.GPIO library is installed (sudo apt install python3-rpi.gpio).

Troubleshooting and FAQs

Common Issues

  1. The Raspberry Pi does not power on:

    • Ensure the OnOffShim is properly seated on the GPIO header.
    • Verify that the power supply is connected to the OnOffShim and is functioning correctly.
  2. The safe shutdown does not work:

    • Confirm that the required software is installed using the installation script.
    • Check that GPIO 17 is not being used by another component or script.
  3. The Raspberry Pi shuts down unexpectedly:

    • Ensure the power supply meets the Raspberry Pi's voltage and current requirements.
    • Check for loose connections between the OnOffShim and the GPIO header.

FAQs

Q: Can I use the OnOffShim with other GPIO-based components?
A: Yes, but ensure that GPIO 17 is not used by other components, as it is reserved for the OnOffShim's shutdown signal.

Q: Does the OnOffShim work with Raspberry Pi Zero models?
A: Yes, the OnOffShim is compatible with all 40-pin Raspberry Pi models, including the Raspberry Pi Zero and Zero W.

Q: Can I use the OnOffShim with a USB-C power supply?
A: The OnOffShim uses a micro-USB port for power input. You can use a USB-C to micro-USB adapter if needed.

Q: Is soldering required to use the OnOffShim?
A: No, the OnOffShim is designed to be a solderless solution. It connects directly to the GPIO header.

By following this documentation, you can effectively integrate the Pimoroni OnOffShim into your Raspberry Pi projects for safe and convenient power management.