Added small LCD Display/screen for information about use space disk

hi,

anyone know how to added small LCD Display/screen 16x2 (or other/ similar like qnap) for information used space disk or other information.

thanks

my hardware:

  • Gigabyte A520i AC
  • AMD Ryzen 7 PRO 4750G
  • using truenas community edition (25.04-RC.1)

please help

It‘s even on YT:

1 Like

hi, thank you for your replay, by the way
that tutorial is for i2c raspberry, my motherboard dont have, i mean LCD that connect to usb.

It’s not that hard, to pull stats via ssh. I am using this:

1 Like

that awesome, yes i want wimilar like this, but my problem is, i dont have GPIO like Raspberry to connected OLed, what should i do? have you tutorial how to connected that oled to my device?

thank you so much for your time

I think the idea is, “get a Raspberry Pi and connect it to the appropriate display.” TrueNAS doesn’t directly support displaying system stats on a LCD/OLED display, and it also doesn’t support installing software in the base OS. I’m not saying there’s no way to do it, but I don’t think you’re going to find a simple step-by-step guide.

Edit: You could enable developer mode on your NAS, and then this guide would get you close:

…but your changes would still be lost with any updates, and your system would be unsupported in terms of bug reports.

1 Like

WOW, thank you, that is what i need, thank you so much

There are even more simple ways …

Here is the repo:

1 Like

Eh, maybe. That repo’s awfully light on details (it takes a good bit of digging to even find what device it’s for). You’ll need to translate German to English or whatever other language you prefer. And it won’t work with 25.04 or later, as the REST API is going away. But advantage is, you don’t need developer mode on the NAS.

Edit: If I were trying something like this, I’d probably run it on a Pi Zero, grabbing data from TrueNAS via its API, and then putting it onto whatever display I was using, whether that little I2C OLED unit, a 1602 text LCD, or whatever. The downside to this approach is that it would need to connect to the NAS via the network, so its network address already needs to be known.

1 Like

i just found, i dont know its work or not on truenas, its using MQTT

I’m building a small tool to add in my case 5.25" free slot cover, i have made just some quick test but for me result are promising.
I’m using a 2€ pico PI with a 2€ 16x2 lcd (with l2c interface), so really cheap and easy/fast to assemble.
I’m using this library, because other for me not working and don’t know why.
Basically i have upload to the pico a micro python script that show data received by a bash script via USB like a slideshow… for the moment i have mapped only “hw monitor info”, but the goal is to map more info as possible.
If you are interested i will share more info when i can!

2 Likes

awesome, plase share, that will be great.

thanks for your replay

It could probably be made to, but it’d take a good bit of adaptation.

Edit: Broadly speaking, there are two possible paths:

  • Show the stats on a “dumb” display that’s directly connected to your NAS
  • Connect the display to some other microcontroller or computer, pass data between that and the NAS, and use that to run the display.

On the former, it’d be great if there were a USB display you could plug in and send text to using something like echo "foo bar baz" > /dev/ttyUSB0. In that case, the first method would be fairly trivial–write or adapt a script to collect the values you want, and send them directly out to the display. But based on the existence of lcdproc, it doesn’t appear they work that way. So the first option means you need to install lcdproc, which means putting your NAS into developer mode, which in turn puts it into an unsupported state.

The suggestions here, then, including the link you just shared, are mainly dealing with the second method: connect the display to some other computing device (whether a Raspberry Pi, an ESP, an Arduino, or something else), get the reporting data onto that device, and use it to manage the display. That means your display device gets at least a little more expensive,[1] because it’s now “computer + display.” But it also means that the job of putting information on the display, which would have required additional software to be installed on your NAS, is now handled by a different device. No mods to your NAS, no developer mode, no unsupported system. Depending on the details of how it’s implemented, perhaps no changes needed to your NAS at all.

tl;dr: there are lots of ways to do this, but AFAIK all of them will require a good bit of custom coding on your part; I’m not aware of any sort of prepackaged solution to do this.


  1. Not necessarily a lot more expensive, though; ESPs, for example, are very cheap. ↩︎

1 Like

Those are just the results of a quick test, i neither know if the approach is correct… so hopefully with sharing i will take some tip/int in the right direction :smile:

Following the guide i mentioned above, i managed to control the lcd with the pico; is well explained, don’t think will be need add anything more.

After the setup, i upload a script main.py into the pico, so everytime is connected he will put itself listening to standard input

import machine
import utime
import sys
import select
from pico_i2c_lcd import I2cLcd

PIN_SDA = 8
PIN_SCL = 9
FREQ = 400000
ADDR = 0x27
ROW = 2
COL = 16

i2c = machine.I2C(0, sda=machine.Pin(PIN_SDA), scl=machine.Pin(PIN_SCL), freq=FREQ)
lcd = I2cLcd(i2c, ADDR, ROW, COL)  

counter = 0
lcd.clear()
message = "Waiting data"
lcd.putstr(message)

while True:
    if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
        message = sys.stdin.readline().strip()
        try:
            label, value = message.split(":", 1)
            lcd.clear()
            
            lcd.move_to(0, 0)
            lcd.putstr(label)
            
            lcd.move_to(0, 1)
            lcd.putstr(value)
        except ValueError:
            pass
        counter = 0
        utime.sleep(4.0)     
    else:      
        #lcd.move_to(0, 1)
        #message = "   "
        #lcd.putstr(message)
        lcd.clear()
        lcd.move_to(0, 1)
        if (counter == 0):
            lcd.putstr("")
            counter = counter +1
        elif (counter == 1):
            lcd.putstr(".")
            counter = counter +1
        elif (counter == 2):
            lcd.putstr("..")
            counter = counter +1
        elif (counter >= 3):
            lcd.putstr("...")
            counter = 0    
        utime.sleep(2.5)
        
  • starting variables should be adjusted according to your setup
  • the split of label → value is a trick i thinked was a good way to maximize the small size of the display
  • i’m not so proud of how to simulate the “waiting dot” but it works :smile:

Then I connected the pico to TN and intercepted the port with sudo dmesg | grep tty:

truenas% sudo dmesg | grep tty
[3971062.471806] cdc_acm 1-8:1.0: ttyACM0: USB ACM device

ttyACM0 is what i need and use in the bash above:

#!/bin/bash

# CHANGE IT
SERIAL_PORT="/dev/ttyACM0"

send_message() {
    MESSAGE="$1"
    echo "$MESSAGE" > "$SERIAL_PORT"
    sleep 4
}

while true; do
    # CPU TEMP
    cpu_temp=$(sensors | grep "Core 0" | awk '{print $3}')
    cpu_temp_cleaned=$(echo "$cpu_temp" | tr -d '°C')
    message="CPU Temp:${cpu_temp_cleaned} C"
    send_message "$message"

    # CPU USAGE
    cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}')
    message="CPU Usage:$cpu_usage%"
    send_message "$message"

    # RAM
    total_ram=$(free -m | grep Mem | awk '{print $2}')
    message="Total RAM:$total_ram MB"
    send_message "$message"

    # RAM used
    ram_used=$(free -m | grep Mem | awk '{print $3}')
    message="RAM Used:$ram_used MB"
    send_message "$message"
done

from shell i run the script and data are displayed.




As i say

  • i don’t know if is a good approach, if can impact somehow on the system (probably he should run with less frequency)
  • data displayed are actually poor, but i plan to get something more usefull from some midctl (like if docker container need upgrade, pool data, ecc ecc)
3 Likes

Consider writing the script in Python using the API client (GitHub - truenas/api_client) if you’re planning to use the API anyway (which is what midclt does)–Python makes it a lot easier to parse the output in order to send the desired information to the display. You can do something like:

info=c.call("system.info")
print(f"Installed RAM: {info['physmem']}")
print(f"ECC: {info['ecc_memory']}")
print(f"Uptime: {info['uptime']}")
print(f"Load Avg: {info['loadavg']}")

Presumably you’d want to reaplce the print statements with output to serial, but the concept is the same.

3 Likes

100% agree. I was already considering that… but at the end i used a bash script more for “curiosity” to use bash is some pratical way one time in my life :smile: Gonna go back a step, better now than later.
Thanks for the confirm!

Another option would be RainMeter (https://www.rainmeter.net/). You would need a small script that periodically writes the information you need to a text file and then set up a rainmeter skin to grab the information from the text file.

I have lots of these passive skins on my desk top that just update me on the status of my backups, local weather, main computer cpu usage, disk space (including mapped network drives), etc.

I’m dumb, or this software Is just for Win machine?

I likewise don’t see any way in which RainMeter does anything to address OP’s request.