-
Notifications
You must be signed in to change notification settings - Fork 33
R36 Control Centre
Customisable Battery Warning LEDs + Full Hardware Detection for R36S / SoySauce / Clones
We are building a fully customisable LED service for the R36S device family on RK3326 DarkOS RE.
The core issue is that LED GPIOs differ across genuine R36S devices, SoySauce boards, and clones. These GPIOs also conflict with the working GPIO settings already defined in the DTB files.
Our solution ensures perfect synchronisation between the battery warning LED service (batt_led.service) and the DTB settings via:
- Early-boot hardware detection in
r36_config.sh - Central hardware database in
/boot/dtb/r36_devices.ini(including speaker/headphone GPIOs for SoySauce) - Dynamic GPIO export/setup + DTB-safe LED control in userspace Python scripts
The entire service and R36 Control Centre are already installed in the latest southoz DarkOS RE image.
- Overview
- Supported Hardware Variants & GPIO/DTB Synchronization
- Features (v1.0)
- How It Works
- Using the R36 Control Centre
- Available LED Scripts
- Important Notes & Warnings
- DTB Status Table
- Troubleshooting
- Contributing / Testing
This service solves the biggest pain point for RK3326 R36S-style handhelds on dArkOS RE:
Different mainboards use different GPIO pins for status LEDs (or PMIC control), and many DTBs define these GPIOs → causing conflicts or no LED control in userspace.
Goal: Support all R36 variants — genuine R36S (PMIC LEDs), SoySauce (Y3506), clones (G80C / G80CA / etc.) — without breaking DTB compatibility for screen / audio / other hardware.
The R36 Control Centre (R36 Control.sh) is now the single controller-friendly menu (launched from EmulationStation → Options → R36 Control) that lets you change LED behaviour, gamma, audio, controls, video profiles, and time settings.

(Insert main menu screenshot here)
r36_config.sh reads the exact hardware string from /proc/cpuinfo and maps it in /boot/dtb/r36_devices.ini.
| Variant | Devices Covered | Key GPIO Settings (from r36_devices.ini) | LED Script Example | ALSA Path | Control Scheme |
|---|---|---|---|---|---|
| r36s | Genuine R36S, R36H, R36S Plus, etc. | Default (DTB-managed) | R36S_Green_30_Red.py |
SPK_HP | default / no_function |
| soysauce | Y3506 boards (V03/V04/V05) |
speaker_enable_gpio = 116headphone_detect_gpio = 86
|
SoySauce_Blue_30_Pink_10_Red.py |
SPK_HP | default |
| clone | G80C, GR36, K3326 clones, etc. | Default (DTB-managed) | Clone_Blue_30_Purple_10_Red.py |
SPK_HP | default |
| unknown | Fallback | None | Clone_PMIC_Controlled.py |
SPK_HP | default |
SoySauce synchronisation is critical:
GPIO 116 (speaker enable) and GPIO 86 (headphone detect) are exported, given 666 permissions for the ark user, and initialised with reversed logic every boot — before batt_led.service starts. This prevents speaker mute conflicts and double-power-button issues while respecting DTB settings.
- Automatic hardware detection & LED script selection on first boot/hardware change
- Safe override: LED control moved to Python scripts (no DTB GPIO conflict)
- Gamma correction persistence (SoySauce often oversaturated, clones under-saturated)
- ALSA Playback Path (SPK_HP vs SPK) + optional persistent boot volume
- Control scheme selection (
defaultvsno_functionfor R36H) - Video profile system (resolution-based tweaks from
/usr/local/bin/r36_config/video/) - Speaker/headphone GPIO auto-setup for SoySauce
- Controller-only R36 Control menu (joystick navigation)
- Time Control submenu for Pokémon / RTC games (NTP toggle + calendar/timebox)
- Logging to
/boot/darkosre_device.log - Updated DTBs included (UHS removed from SoySauce for max compatibility)
-
Early boot (
r36-config.service→r36_config.sh— runs beforebatt_led.service):- Reads Hardware string from
/proc/cpuinfo - Looks up variant, gamma, ALSA path, control scheme, resolution, speaker/headphone GPIOs in
r36_devices.ini - If no
/etc/r36_config.inior hardware changed → creates config + selects/copies matching LED script - Sets up SoySauce GPIOs (export, direction, permissions, initial state)
- Applies gamma, ALSA path/volume, control scheme, video profile
- Reads Hardware string from
-
Battery warning (
batt_led.service):- Runs the selected Python script (
/usr/local/bin/batt_life_warning.py) - Monitors battery → controls LEDs via sysfs or exported GPIOs
- Runs the selected Python script (
-
User changes via R36 Control Centre:
- Overrides script, gamma, audio, controls, video, time
- All persisted in
/etc/r36_config.ini
Launch from EmulationStation → Options → R36 Control (or run sudo /usr/local/bin/R36 Control.sh).
Options:
- Select Battery LED Warning Type
- Adjust Gamma Correction
- Audio Controls
- Utilities
- Time Control (Pokémon)
- Exit
Scans /usr/local/bin/r36_config/batt_life_warning/ for scripts prefixed with your variant (R36S_, SoySauce_, Clone_).
Select one → service stops, new script is copied to /usr/local/bin/batt_life_warning.py, service restarts, and active_script is saved.
Choose from 0.4–1.8 (0.1 steps).
Value is saved to config and written to /dev/shm/CURRENT_GAMMA.
Changes apply on next reboot.
Live preview tip: Hold R3 + D-Pad Left/Right (if your gamma tool supports runtime adjustment).
Submenu:
-
Select ALSA Playback Path
-
SPK_HP= Speaker + Headphone jack detection -
SPK= Speaker only
Automatically updates/usr/local/bin/ogageand restartsogage.service.
-
-
Manage Boot Volume
- Set fixed % (10–100 in 5% steps) → saved as
alsa_volumeand applied every boot - Clear → removes persistent volume (use normal volume controls)
- Set fixed % (10–100 in 5% steps) → saved as
-
View Current Config → shows full
/etc/r36_config.ini - Delete Current Config → removes file (defaults restored on reboot)
-
Select Control Scheme
-
default= R36S style (Function button → menu) -
no_function= R36H style (no Function button)
Applies viar36_controls.sh+ matching.inifiles.
-
-
Select Video Profile
Scans/usr/local/bin/r36_config/video/*.iniand applies resolution-specific tweaks.
Controller-only (joystick navigation):
- Enable NTP
-
Disable NTP (stops + disables
systemd-timesyncd) -
Set system clock & date
- Calendar dialogue (date)
- Timebox dialog (HH:MM:SS) — Left/Right moves fields, Up/Down changes digits
Usessudo date+hwclock -w
| File | Fully Charged | 🔌 | 🔋 >30% | 🔋 >10% | <=10% |
|---|---|---|---|---|---|
| Clone_Blue_30_Purple_10_Red.py | TBA | 🔴 | >30% 🔵 | >10% Purple | <=10% 🔴 |
| Clone_Off_30_Purple_10_Red.py | TBA | 🔴 | >30% Off | >10% Purple | <=10% 🔴 |
| Clone_Off_10_Red.py | TBA | 🔴 | Off | Off | <=10% 🔴 |
| Clone_PMIC_Controlled.py | TBA | 🔴 | PMIC | PMIC | PMIC |
| SoySauce_Blue_30_Pink_10_Red.py | TBA | 🔴 | >30% 🔵 | >10% Pink | <=10% 🔴 |
| SoySauce_Off_30_Pink_10_Red.py | TBA | 🔴 | >30% Off | >10% Pink | <=10% 🔴 |
| SoySauce_Off_10_Red.py | TBA | 🔴 | Off | Off | <=10% 🔴 |
| SoySauce_PMIC_Controlled.py | TBA | 🔴 | PMIC | PMIC | PMIC |
| R36S_Green_30_Red.py | TBA | Orange | >30% 🟢 | >30% 🟢 | <=30% 🔴 |
| R36S_Green_20_Red.py | TBA | Orange | >20% 🟢 | >20% 🟢 | <=20% 🔴 |
| R36S_Green_10_Red.py | TBA | Orange | >10% 🟢 | >10% 🟢 | <=10% 🔴 |
| R36S_PMIC_Controlled.py | TBA | 🔴 | PMIC Green/Blue | PMIC | PMIC |
- Genuine R36S often use PMIC-controlled LEDs (Green/Blue) → limited userspace control. Scripts focus on Red warning.
- SoySauce DTBs have UHS removed from SD card → better compatibility (no speed loss).
- Audio init issues on some V12 clones → may need sleep/wake cycle (handled in ogage).
- If LEDs don’t work → check DTB has no conflicting GPIO definitions for LED/charger/battery.
- Unknown hardware → defaults to clone-like behaviour + full script list.
- Logs:
cat /boot/darkosre_device.log
| DTB File | Status |
|---|---|
| G80CA-MB V1.2-20250422 Panel 8 | Completed, GPIO Pin 0 Blue, GPIO Pin 17 Red |
| R36S-V12 2023-08-18 Variant 3 Panel A | Completed, GPIO Pin 0 Blue, GPIO Pin 17 Red |
| Y3506_V05_20251215 2601 | Completed, GPIO Pin 0 Blue, GPIO Pin 1 Red |
| R36S-V21 2024-12-18 | Completed, GPIO Pin 77 Red, PMIC Controlled Green |
| Issue | Likely Cause | Fix |
|---|---|---|
| LED wrong colour / not working | Wrong script selected | R36 Control → 1. Select Battery LED Warning Type |
| Speaker always muted | SoySauce GPIO not synced | Check log for GPIO 116/86 setup |
| Audio path conflicts | ALSA vs DTB mismatch | Audio Controls submenu |
| Controls broken on R36H | Default scheme used | Utilities → Select Control Scheme → no_function
|
| Time drifts (Pokémon) | NTP active | Time Control → Disable NTP |
| Gamma not applied | Needs reboot | Reboot after change |
- Firmware Installation
- Firmware Upgrade
- Audio and Screen Controls
- EmulationStation
- Retroarch Hotkeys
- Kodi
- PortMaster
- Customising your Device
- Arcade (arcade)
- CAPCOM Play System 1 (cps1)
- CAPCOM Play System 2 (cps2)
- CAPCOM Play System 3 (cps3)
- MAME 2003 (mame2003)
- MAME 2010 (mame)
- Nintendo 64 (n64)
- Nintendo Entertainment System (nes)
- Nintendo Famicom (famicom)
- Nintendo Famicom Disk System (fds)
- Super Nintendo Entertainment System (snes)
- NEC PCE Engine (pcengine)
- NEC PC Engine CD (pcenginecd)
- NEC Turbografx 16 (turbografx)
- NEC Turbografx 16 CD (turbografxcd)
- Nintendo Super Famicom (sfc)
- Sega Master System (mastersystem)
- Sega Megadrive (megadrive)
- Sega Genesis (genesis)
- Sega CD (segacd)
- Sega 32x (sega32x)
- Sega Dreamcast (dc)
- Sega Saturn (saturn)
- Sony Playstation (psx)
- SNK Neo Geo (neogeo)
- SNK Neo Geo CD (neogeocd)
- Nintendo DS (nds)
- Nintendo GameBoy (gb)
- Nintendo Gameboy Color (gbc)
- Nintendo Gameboy Advanced (gba)
- Sega Game Gear (gamegear)
- Sony Playstation Portable (psp)
The guides below are for ArkOS-G80CA; once they are above this marker, they are relevant.
- Commodore 64 (c64)
- Amiga (amiga)
- Amiga CD32 (amigacd32)
- ZX Spectrum (zxspectrum)
- Doom (doom)
- SNK Neo Geo Pocket (ngp)
- SNK Neo Geo Pocket Color (ngpc)
- MSX (msx)
- MSX2 (msx2)
- Atari ST (atarist}
- Atari 2600 (atari2600)
- Atari 5200 (atari5200)
- Atari 7800 (atari7800)
- Mattel Intellivision (intellivision)
- Sega SG‐1000 (sg‐1000)
- Atari Lynx (atarilynx}
- Bandai WonderSwan (wonderswan)
- Bandai WonderSwan Color (wonderswancolor)
- Amstrad CPC (amstradcpc)
- Apple II (apple2)
- Atari 800 (atari800)
- BBC Micro (bbcmicro)
- Ports (ports)