The Raspberry Pi 5 uses new GPIO code, the details below are not applicable for these boards, except for Argon One V3 at the bottom of the page
To keep the price down, the Raspberry Pi board doesn't ship with a power button, yet it's easy to add your own! This guide will show you how to add a power button to your Raspberry Pi that can turn on/off your BATOCERA system.
If you don’t want to build your own, several popular commercial options are available. They will add a power switch to your Raspberry Pu, sometimes provide a temperature-controller fan… and add a stylish look to your board.
You should never “yank” the power cord out of your Pi as this can lead to severe data corruption (and in some cases, physically damage your SD card). Even if Batocera is best prepared against file corruption it is recommended to safely shut down your Pi via Batocera's Shutdown Menu or even better, use a power button or switch.
When Batocera “shuts down” the Pi with a simple button/latching switch, it will send it into a halt state, which still consumes a very small amount of power. This is similar to how all modern computers work. In this guide we will only go into a halt state so that we can still power it up again later without having to replug the power source. You can safely disconnect the power supply (should you desire) without the worry of data corruption while in the halt state.
This method gives the best user experience if you use the GPi-case from Retroflag for example. This nice housing only has one button switch to simply turn on/off the Raspberry. Since Batocera 5.25 the OS is best prepared for all kinds of power devices connected to the Raspberry. But you will lose your game SRM save (your in-game save file) if you just trigger the power button inside a game session.
/userdata/systemchmod +x /userdata/system/custom.sh#!/bin/bash # custom.sh - place to /userdata/system # by cyperghost 23/11/19 # if [[ $1 == stop ]]; then batocera-es-swissknife --emukill fi
Here are some commercial power switches/commercial cases with power switches that are currently supported. These offer a real power cut, that means the Raspberry is really switched off. Usually these small power devices are plugged on top of the Raspberry using it's 40 Pin header. For further install instruction use the links provided.
Here are the values you can put as system.power.switch=<value_below> in batocera.conf:
It is possible to add a button to turn on and turn off your Batocera console properly! But how?
You can add a power button to switch on/off Batocera. The button can be either a push button (momentary button) or a switch button (latching switch). Note on the push buttons: some GPIO have resistors pull-up built-in (resistors connected to the + 3.3V), so it is preferable to use switches normally open (abbreviated NO) with these pins.
to connect the switch to the Raspberry Pi GPIO, plug a PIN on the GPIO3 (physical PIN 5 above on the left) and another on the mass located just to the right on the right (physical PIN 6)
Get a terminal window by quitting EmulationStation with a Keyboard or get a access to terminal by SSH. Now enter /etc/init.d/S92switch setup and you will see a terminal window like in picture below. From there you can select and activate your power or switch device. The script will show you an already activated device (ONOFFSHIM in this case) and will latter show you a small message box, if the value setup was successfully set up. After this reboot the device and everything should work fine.
Check in the table above what is the type of power switch you need.
Then, edit the config file /userdata/system/batocera.conf - in the example below with PIN56ONOFF.
system.power.switch=PIN56ONOFFbatocera-settings-set system.power.switch PIN56ONOFF
then reboot. Your Batocera system can now be turned on/off with a button!
Retroflag is the manufacturer who takes focus on retro case for Raspberry Pi series and for origin looking retro game controllers. In the last years they've managed to bring some pretty nice looking housings to the market. These are inspired of gaming devices from the golden era of game consoles. If you are a proud owner of a GPicase, then take a look here. Besides the nice looking there are always working buttons for power and/or reset possible. But you have to take a few steps there.
batocera.conf and set the correct switch mode.nano /userdata/system/batocera.confsystem.power.switch=RETROFLAGFor the NESPi 4 case only
You have to do an additional reboot! Sorry guys, but we need to make an autoconfig behind the scenes!
Also, for the NESPi4 case, you might experience some sluggishness using the HDD/SSD “cartridge”. Here is a Reddit link that gives you a way to fix it (even if the reddit post was written for RetroPie, it has been reported as OK on Batocera too).
Until Batocera 40, only ArgonOne V1/V2 cases for Raspberry Pi4 are supported.
Batocera 41 introduces support for ArgonOne V3 for Raspberry Pi5, additionally to ArgonOne V1/V2 for Raspberry Pi4.
Activate the Argon One fan by adding system.power.switch=ARGONONE in the configuration file batocera.conf and that's it. Upon next reboot, the fan will be controllable by software (fan speed depending on the temperature) and double-clicking the button on the back will kill the running emulator and get you back to EmulationStation.
Don't use any external script, the support for Argon One is already included in the Batocera Linux distribution.
By default, the fan starts at 55 degrees Celsius. Here is the default fan curve configuration:
# Configuration file for Argon One Pi4 case # temperatures are in Celsius # fan_speed are from 0-100 percent # syntax is: temp_threshold=fan_speed # default is: 45=0 55=10 60=55 65=100
With this fan curve configuration, the behavior would be as follows:
From the vendor recommendations, it is safe to start the fan at 55 degrees only. Less noisy.
You can define own temperature/fan speed ladder by creating a new argonone.conf file at /userdata/system/configs/argonone.conf.
To check that the temperature is correctly reported, you can log into Batocera through SSH and run the command rpi-argonone.