Lightweight Installation (SATA HAT only, no cpu fan, no lcd, no buttons)

After reading the code in more detail it seems that the pigpiod is really only used for the fan control, the actual drive control uses the RPi.GPIO library instead. I am actually a bit confused why pigpio is needed at all, since RPi.GPIO also offers PWM control and could have been used in

For the standalone case I think only and the would be needed, these need to be modified to not call fan or oled. Essentially just a which calls misc.disk_turn_on()

I would give it a try myself however since you wrote the code I think you would do a better job :slight_smile:

RPi.GPIO is not used because it does not offer hardware PWM functionality… it offers software PWM functionality, but that was causing fan whine…

That’s why Setq switched over to pigpio because the lib offers hardware PWM functionality.

1 Like

I see… I am currently using the PWM from RPi.GPIO with a Noctua PWM fan without issues.

gpiozero looks like it may be another option.

The hardware PWM of gpiozero via RPIO or PiGPIO, and the RPIO is not available in Raspberry Pi 4 at present.


I’ve provided you with a new script that uses pure bash and doesn’t rely on anything.

Use the following command to install:

curl -sL | sudo -E bash -

1 Like

Works perfectly, thank you!

One issue I encountered with this, the system hangs on boot waiting to mount the drives (via /etc/fstab) since the service is not running yet and the drives are not yet powered.

My fix was to edit the service so that it runs before the system tries to mount the drives

I modified /lib/systemd/system/quad-sata-lite.service

Description=ROCK Pi SATA Hat

1 Like

Thanks for sharing, I added it to the script.

Would this work for the regular quad sata with top hat? I do note that there is dependency on pigpio service starting first…

Yes should work, I had done the same with the original script while I tested it before setq made the lite script. Just edit the pigpiod service located at:


Description=Daemon required to control GPIO pins via pigpio
ExecStart=/usr/local/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod

So it turns out neither RPi.GPIO nor pigpiod are needed to get hardware PWM from the Pi, you can load a pwm kernel overlay and access the BCM2835 hardware PWM directly, see below

I am now using this method and have a simple bash script running the PWM, 0% CPU load compared to the ~7% I was seeing with pigpiod and the ~17% I was seeing with RPi.GPIO

actually for PiGPIO, the 7% was due to alerts and sampling… if u set the flag -m to the service, the CPU load from PiGPIO drops to 0…

but good find though…

It is quite nice, because if you combine this with the lite script that setq wrote, no additional packages are needed to run the SATA Hat and to control the fans.

But for those that need the top hat oled… I think there’s probably a way to change the pwm implementation… doesn’t seem like much change to the code, just the calls would be different… the main arguments Ike dutycycle are largely there already…

Hi all,
great thread. I am looking at doing the very same thing that the op is doing - ie lightweight installation, so this is very valuable :).
@setq would you mind sharing the script you wrote for a minimal install?

Apologies, I forgot the other part of the question, which is can I run the hat without GPIO connections at all, ie with only the USB links between the two? Purpose would be to improve heat dissipation for the Pi.

@tgc The current version must connect to GPIO.

Thanks for the prompt answer @setq, appreciate it. What happens if I don’t connect them? Anything bad hardware wise, or sw just won’t work?
Also I guess I can extend the gpio to increase airflow… Do you know which pins are used?

setq posted the script earlier in the thread, it’s hosted here:

Reading the script you can see that GPIO 26 (pin 37) and GPIO 25 (pin 22) are used to turn on/off the sata controller:


You can also see it on the pinout section of the wiki:
Pin 37 (GPIO 26) = SATA 3/4
Pin 22 (GPIO 25) = SATA 1/2

If you don’t connect the GPIO then it won’t work, those pins turn on the jms561 sata controller. Without the controller the USB bus wont connect to the sata ports .