Project Description

With Quad SATA HAT[1] you can turn your RPi / RockPi into a nice little NAS. There are some packages[2] for Raspbian/Ubuntu which will allow you to control the disks and the optional fan and OLED display. But what if you want to install Tumbleweed on your box?

Quad SATA HAT top board

Goal for this Hackweek

The goal of this project is to start with a RPi 4 and SATA HAT and end up with a working NAS solution on Tumbleweed. The provided software is only targeting Debian based distros and even in that case the support is not great.



The Hacking

Step 1: OS installation

As I already have some experience with Raspbian, it is trivial to grab a new SD card, extract a fresh new image onto the card, put it in the Pi and just boot the system. After a while I am able to log in to the system via SSH. All good.

Now, it is Tumbleweed time. I headed to our RPi4 documentation, the recommended step is to take the JeOS image and extract it as in previous step. I like it, but I need to tweak it a little bit. Ultimately, I do not want to have SD card present as I want to boot the system from connected SSD disk. So, lets grab the JeOS Tumbleweed image and extract it on a fresh new SSD disk connected via USB-SATA connector.

I removed the SD card, put the SSD disk into the SATA slot and I am trying the boot process. Unfortunately, I am unable to see any new device in the DHCP log. Even more unfortunately, the RPi 4 has microHDMI output and I probably do not have any such cable around (and frankly, I am to lazy to do a thorough search). So it is time for my USB-TTL UART converter, the config.txt should contain enable_uart=1 and it might also help to include console=ttyS0,115200n8 into default grub command line parameters. The pinout for RPi can be easily found, in my case I need to connect pins 6, 8 and 10 (GND, TX, RX). For the actual connection, minicom or screen can be used. I am not happy with the result (I do not see anything).

After some blind laboring, I am able to find out, that the Pi is not able to boot from the SATA HAT because it does not see it. After consulting the documentation (i.e. searching on the official forum), I found out that the HAT needs to be "activated" by setting pins 25 and 26 to HIGH. OK, additional search and I know how to solve the issue. At first, I need to boot from SD card (the previously installed Raspbian will do), and update EEPROM configuration.

# rpi-eeprom-config --edit


There are several important settings, BOOT_UART=1 will enable serial console during boot. BOOT_ORDER=0xf14 means try USB (4) first, then SD card (1), then repeat (f) if necessary. In my case the USB boot is the SATA HAT. Another useful mode could be 2 for network boot. The most important part are the last two lines, gpio=25,26=op,dh will set pins 25 and 26 to output mode, driving high. That will enable the HAT after power-on, so it will be able to boot from it.

After this, I can successfully boot into the JeOS first boot configuration. As I have already prepared everything for serial console connection, I can do the setup even without monitor and keyboard attached. I can finish the installation, setup network and ssh server.

Step 2: Fan control

There are two controllable fans, one on the board for CPU and one on top for the hard drives. Both are PWM capable and are controlled through pins 12 and 13. The original code uses Python and RPi.GPIO, however that did not work well for me. I also tried another Python libraries for GPIO pins, but was not able to solve performance issues nicely. For the PWM to work correctly, the controlling frequency needs to be high enough to prevent buzzing noises in an audible spectrum from the fans and neither library was able to provide it. After some extended search, I stumbled upon Go-written library go-rpio which was able to do hardware PWM (instead of slower software emulated) and which was able to achieve the optimal 25kHZ frequency.

I created a simple script which allows to set each fan to any of 5 available levels (0%, 25%, 50%, 75%, 100%) and an auto mode, which will read the current CPU temperature and adapt the fan levels. The thresholds are customizable via environment variables. Provided service file for the fan-control utility can read those overrides and start the auto mode upon boot.

Step 3: OLED display

After some fiddling and reverse engineering, I was able to find out, that I need to reset the display before use; the reset procedure is done by flipping pin 22. The display itself is a standard I2C device and instead of deprecated Adafruit Python library, I used a go-based one. Currently, the display can show current time, CPU temperature and disk use percentage. The path for the disk usage can be customized by environment variable OLED_DU_PATH. The output is rotated by 180° by default, which can be disabled by setting OLED_ROTATE=false.

For the I2C to work correctly the appropriate overlay needs to be activated. Inside config.txt or even better inside extraconfig.txt make sure to include line dtparam=i2c1=on.

Step 4: Push button

Pin 17 is connected to the button on the top panel. I was able to use edge detection on the pin to detect push events and use it to turn on/off the OLED display. Maybe in some later version, this could be customisable and can run an arbitrary command. The important part here is to not only switch the pin into an input mode but also activate the pull-up resistor (the button has inverted control -- i.e. pressing the button will trigger the fall-down edge and transition to low state).

Step 5: Combining all together

I created a common module for shared functions and I have two binaries with a corresponding service file to control the fans and the OLED display. The provided spec file will allow OBS to create an installable package for Tumbleweed. After installation, both services need to be enabled (and started) via systemctl enable --now fan-control sys-oled.

Looking for hackers with the skills:

raspberrypi tumbleweed rpm hardware

This project is part of:

Hack Week 23


  • 27 days ago: binary_sequence liked this project.
  • 27 days ago: jgoldschmidt liked this project.
  • 27 days ago: jbaier_cz added keyword "raspberrypi" to this project.
  • 27 days ago: jbaier_cz added keyword "tumbleweed" to this project.
  • 27 days ago: jbaier_cz added keyword "rpm" to this project.
  • 27 days ago: jbaier_cz added keyword "hardware" to this project.
  • 27 days ago: ggardet_arm liked this project.
  • about 1 month ago: mbrugger liked this project.
  • about 2 months ago: harrisonbc joined this project.
  • about 2 months ago: jbaier_cz started this project.
  • about 2 months ago: jbaier_cz originated this project.

  • Comments

    • harrisonbc
      about 2 months ago by harrisonbc | Reply

      Hi - I have one of these HATs and am happy to help test it out with Tumbleweed

      • jbaier_cz
        26 days ago by jbaier_cz | Reply

        The first version of the software, which should be able to control fan speed is available in my repository. The documentation is lacking, but the simple systemctl enable --now fan-control should enable the automatic mode.

    Similar Projects

    Containerized home mirror by lkocman

    I'm running a simple home mirror, but I managed...

    Update Haskell ecosystem in Tumbleweed to GHC-9.6.x by psimons

    [comment]: # (Please use the project descriptio...

    Avahi Integration and Network Connection by vojha

    Avahi Integration and Network Connection


    Parental controls on Tumbleweed/Aeon by fcrozat

    [comment]: # (Please use the project descriptio...

    Tumbleweed on Mars-CM (RISC-V board) by ph03nix

    RISC-V is awesome, Tumbleweed is awesome, choco...

    A set of utilities to produce a "from scratch" OCI/Docker container using Opensuse/SLE rpms by ldragon

    [comment]: # (Please use the project descriptio...

    LSP server for SPEC files by mcepl

    Has anybody ever heard about RPM Spec LSP serve...

    Switch software-o-o to parse repomd data by hennevogel

    Currently search is using...

    A CLI for Harvester by mohamed.belgaied

    [comment]: # Harvester does not officially come...

    Investigate zypper/openSUSE repository refresh optimisations by dirkmueller

    [comment]: # (Please use the project descriptio...

    Unrealtone by emiler

    Project Description

    Device for connecting...

    ESP32 Meteostation by emiler

    Project Description

    The goal is to build ...