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

I have purchased the SATA HAT without the top board and I would like to install the minimum software on my Pi in order to have the sata ports accessible. I have my own fan running on PWN_33 so this port should also not be accessed, I don’t want any extra services controlling the GPIO pins.

I looked in the install script and it seems there are basically 5 functions called

apt_check --> installs any missing python3 packages (and few others)
pip_install --> installs the screen software (Adafruit SSD1306)
pig_install --> install piggpio v77, used to control GPIO pins
deb_install --> installs the raspi-sata-0.14.deb package
dtb_enable --> not exactly sure what this does

Which sections are needed to get access to the SATA ports? It seems to me that perhaps only the deb_install section would be needed, is this correct?

Thanks

I tried installing only the raspi-sata-0.14.deb package however it seems to need pigpiod, so this does not work.

Would it be possible to have a new version of the install script which only installs what is required for this use case? (sata ports only)

Do you need to use PWM to control the CPU fan? If so, then the pigpiod is required.

I have a passive heatsink on the CPU, so no PWM control is needed for the CPU fan.

All right. I will provide you with a special installation script.

1 Like

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 fan.py

For the standalone case I think only main.py and the misc.py would be needed, these need to be modified to not call fan or oled. Essentially just a main.py 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.

https://gpiozero.readthedocs.io/en/stable/migrating_from_rpigpio.html?highlight=pwm#pwm-pulse-width-modulation

gpiozero looks like it may be another option.

https://gpiozero.readthedocs.io/en/stable/api_pins.html

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

@quadnas

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 https://rock.sh/get-rockpi-sata-lite | sudo -E bash -

2 Likes

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

[Unit]
Description=ROCK Pi SATA Hat
Before=local-fs.target

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:

/lib/systemd/system/pigpiod.service

[Unit]
Description=Daemon required to control GPIO pins via pigpio
Before=local-fs.target
[Service]
ExecStart=/usr/local/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target

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

https://jumpnowtek.com/rpi/Using-the-Raspberry-Pi-Hardware-PWM-timers.html

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…