Quad SATA Hat Top, no OLED display information or push button action

So, today I went in and edited rockpi-sata.conf and changed the entry press = power under the [key] section, line 20 from none(default). Saved and rebooted and now the display has flipped back to upside down. I went back in edited the line to press = none and still the same. How would editing that line change the oled section on line 35/36 back to false? Any ideas? Is the correct location for the rockpi-sata.conf still /etc/ ?

Editing press will not affect rotate, and the default value of rotate is false. Can you post your current rockpi-sata.conf?

I discovered an editing error and fixed it. The display is working correctly now (rotated). However, I’m trying to use the ‘press’ feature of the button to poweroff the quad-sata box, but that doesn’t seem to be working. Do I have the correct syntax? My conf file is below.

[fan]

When the temperature is above lv0 (35’C), the fan at 25% power,

and lv1 at 50% power, lv2 at 75% power, lv3 at 100% power.

When the temperature is below lv0, the fan is turned off.

You can change these values if necessary.

lv0 = 35
lv1 = 40
lv2 = 45
lv3 = 50

[key]

You can customize the function of the key, currently available functions are

slider: oled display next page

switch: fan turn on/off switch

reboot, poweroff

If you have any good suggestions for key functions,

please add an issue on https://setq.me/rockpi-sata

click = slider
twice = switch
press = poweroff

[time]

twice: maximum time between double clicking (seconds)

press: long press time (seconds)

twice = 0.7
press = 1.8

[slider]

Whether the oled auto display next page and the time interval (seconds)

auto = true
time = 5

[oled]

Whether rotate the text of oled 180 degrees, whether use Fahrenheit

rotate = true
f-temp = true

@jj_0 @SsilviusS

Could you please tell me the results to help me fix the OLED bug

echo -e "import Adafruit_GPIO\nprint(Adafruit_GPIO.Platform.platform_detect())" | python3

Sorry I can’t anymore. I tried using a fresh Raspberry Pi OS image on an SD-card, this time the install of the Quad SATA software went smoothly. So there was probably something wrong with my original rootfs.

pi@RPi:~ $ echo -e “import Adafruit_GPIO\nprint(Adafruit_GPIO.Platform.platform_detect())” | python3
2

Thank you. It looks normal.

I recently purchased the Quad SATA Hat for Raspberry Pi 4. I installed the script for the hardware as it currently stands. I am able to see and use the 4 hard drives in the system. But the OLED is not working. I have the exact same setup and install process as lopeztel at the beginning of this thread.

I currently do not have the top fan installed so the output of

i2cdetect -y 1

is

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – 51 – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

I believe this is JUST the OLED detected. I am waiting on a replacement fan as the one I received was DOA and was shorting (I blame shipping). When I call the command:

sudo python3 /usr/bin/rockpi-sata/oled.py

I get:

Traceback (most recent call last):
File “/usr/bin/rockpi-sata/oled.py”, line 28, in
disp = disp_init()
File “/usr/bin/rockpi-sata/oled.py”, line 23, in disp_init
[getattr(disp, x)() for x in (‘begin’, ‘clear’, ‘display’)]
File “/usr/bin/rockpi-sata/oled.py”, line 23, in
[getattr(disp, x)() for x in (‘begin’, ‘clear’, ‘display’)]
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 148, in begin
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 292, in _initialize
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 129, in command
File “/usr/local/lib/python3.7/dist-packages/Adafruit_GPIO-1.0.5-py3.7.egg/Adafruit_GPIO/I2C.py”, line 116, in write8
File “/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO-1.1.5-py3.7.egg/Adafruit_PureIO/smbus.py”, line 322, in write_byte_data
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/bin/rockpi-sata/oled.py”, line 32, in
disp = disp_init()
File “/usr/bin/rockpi-sata/oled.py”, line 23, in disp_init
[getattr(disp, x)() for x in (‘begin’, ‘clear’, ‘display’)]
File “/usr/bin/rockpi-sata/oled.py”, line 23, in
[getattr(disp, x)() for x in (‘begin’, ‘clear’, ‘display’)]
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 148, in begin
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 292, in _initialize
File “/usr/local/lib/python3.7/dist-packages/Adafruit_SSD1306-1.6.2-py3.7.egg/Adafruit_SSD1306/SSD1306.py”, line 129, in command
File “/usr/local/lib/python3.7/dist-packages/Adafruit_GPIO-1.0.5-py3.7.egg/Adafruit_GPIO/I2C.py”, line 116, in write8
File “/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO-1.1.5-py3.7.egg/Adafruit_PureIO/smbus.py”, line 322, in write_byte_data
OSError: [Errno 121] Remote I/O error

Does anyone know if this error occurs only when the sensor on the fan is missing?

@TonyPi4

The top-board is broken, please contact Allnet for a new one.

Thanks. My issue was the cable running between the boards was wired incorrectly. It fried 2 top boards.

I have the same issue. Allnet sent me a new top had and sata board and I still have no fan or oled. I did not receive a new 10 pin cable. I saw a small amount of smoke from the fan when first powering up.

pi@raspberrypi:~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – 51 – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Still do not have a working NAS.

@nerka

I think you may have incorrectly connected the wire between them, can you take a picture?

Here are a couple pictures. I did not connect the top hat to the 12v connector if that is what you are thinking.

@nerka

Sorry for the bad experience. The PHD2.0 cable (2*5pin) is inappropriate, please contact Allnet to replace it, along with the top hat.

@TonyPi4 Thank you for pointing out the real reason.

Thanks. Just to clarify, the cable is bad, or it is the wrong cable?

@nerka

It’s a wrong cable. I’ve told Allnet the details.

1 Like

I actually just went through the setup for the quad sata hat as well. The fan works on the top board, but the OLED still isn’t responsive. I also received the same 5*2 cable that is shown in the pictures provided by @nerka. Is that definitively the issue or is there something else I can try first?

@ setq

Unfortunately the OLED does not run on Raspbian 12 (bookworm):

 sudo python3 /usr/bin/rockpi-sata/oled.py                               
Traceback (most recent call last):
  File "/usr/bin/rockpi-sata/oled.py", line 28, in <module>
    disp = disp_init()
           ^^^^^^^^^^^
  File "/usr/bin/rockpi-sata/oled.py", line 22, in disp_init
    disp = Adafruit_SSD1306.SSD1306_128_32(rst=None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 287, in __init__
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_GPIO-1.0.6-py3.11.egg/Adafruit_GPIO/GPIO.py", line 432, in get_platform_gpio
RuntimeError: Could not determine platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/rockpi-sata/oled.py", line 32, in <module>
    disp = disp_init()
           ^^^^^^^^^^^
  File "/usr/bin/rockpi-sata/oled.py", line 22, in disp_init
    disp = Adafruit_SSD1306.SSD1306_128_32(rst=None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 287, in __init__
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
  File "/usr/local/lib/python3.11/dist-packages/Adafruit_GPIO-1.0.6-py3.11.egg/Adafruit_GPIO/GPIO.py", line 432, in get_platform_gpio
RuntimeError: Could not determine platform.

If anyone else is having the problem: I have rewritten the library to use the newer Adafruit_CircuitPython_SSD1306 library:

Just replace the content of /usr/bin/rockpi-sata/oled.py with the following:

import time
import misc
import board
import digitalio
import adafruit_ssd1306
from PIL import Image, ImageDraw, ImageFont
import logging

# Set up logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

font = {
    '10': ImageFont.truetype('fonts/DejaVuSansMono-Bold.ttf', 10),
    '11': ImageFont.truetype('fonts/DejaVuSansMono-Bold.ttf', 11),
    '12': ImageFont.truetype('fonts/DejaVuSansMono-Bold.ttf', 12),
    '14': ImageFont.truetype('fonts/DejaVuSansMono-Bold.ttf', 14),
}

misc.set_mode(23, 0)
time.sleep(0.2)
misc.set_mode(23, 1)

def disp_init():
    reset_pin = digitalio.DigitalInOut(board.D4)  # Use your reset pin
    i2c = board.I2C()
    disp = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, reset=reset_pin)
    disp.fill(0)
    logger.info("Display initialized successfully.")
    return disp

try:
    disp = disp_init()
except Exception as e:
    logger.exception("Error initializing display: %s", str(e))
    misc.open_w1_i2c()
    time.sleep(0.2)
    disp = disp_init()

image = Image.new('1', (disp.width, disp.height))
draw = ImageDraw.Draw(image)

def disp_show():
    im = image.rotate(180) if misc.conf['oled']['rotate'] else image
    disp.image(im)
    disp.show()
    draw.rectangle((0, 0, disp.width, disp.height), outline=0, fill=0)
    logger.debug("Display updated and shown.")

def welcome():
    draw.text((0, 0), 'ROCK Pi SATA HAT', font=font['14'], fill=255)
    draw.text((32, 16), 'loading...', font=font['12'], fill=255)
    disp_show()
    logger.info("Welcome message displayed.")

def goodbye():
    draw.text((32, 8), 'Good Bye ~', font=font['14'], fill=255)
    disp_show()
    time.sleep(2)
    disp_show()  # clear
    logger.info("Goodbye message displayed.")

def put_disk_info():
    k, v = misc.get_disk_info()
    text1 = 'Disk: {} {}'.format(k[0], v[0])

    if len(k) == 5:
        text2 = '{} {}  {} {}'.format(k[1], v[1], k[2], v[2])
        text3 = '{} {}  {} {}'.format(k[3], v[3], k[4], v[4])
        page = [
            {'xy': (0, -2), 'text': text1, 'fill': 255, 'font': font['11']},
            {'xy': (0, 10), 'text': text2, 'fill': 255, 'font': font['11']},
            {'xy': (0, 21), 'text': text3, 'fill': 255, 'font': font['11']},
        ]
    elif len(k) == 3:
        text2 = '{} {}  {} {}'.format(k[1], v[1], k[2], v[2])
        page = [
            {'xy': (0, 2), 'text': text1, 'fill': 255, 'font': font['12']},
            {'xy': (0, 18), 'text': text2, 'fill': 255, 'font': font['12']},
        ]
    else:
        page = [{'xy': (0, 2), 'text': text1, 'fill': 255, 'font': font['14']}]

    return page

def gen_pages():
    pages = {
        0: [
            {'xy': (0, -2), 'text': misc.get_info('up'), 'fill': 255, 'font': font['11']},
            {'xy': (0, 10), 'text': misc.get_cpu_temp(), 'fill': 255, 'font': font['11']},
            {'xy': (0, 21), 'text': misc.get_info('ip'), 'fill': 255, 'font': font['11']},
        ],
        1: [
            {'xy': (0, 2), 'text': misc.get_info('cpu'), 'fill': 255, 'font': font['12']},
            {'xy': (0, 18), 'text': misc.get_info('men'), 'fill': 255, 'font': font['12']},
        ],
        2: put_disk_info()
    }

    return pages

def slider(lock):
    with lock:
        for item in misc.slider_next(gen_pages()):
            draw.text(**item)
        disp_show()
    logger.debug("Slider updated.")

def auto_slider(lock):
    while misc.conf['slider']['auto']:
        slider(lock)
        misc.slider_sleep()
    else:
        slider(lock)
1 Like