Arduino Based NAS Display

https://github.com/atmelino/NASDisplay

Hardware Components

- Arduino UNO
- LCD shield
- USB B to A cable or USB B to motherboard USB 2 connector
- A server with a free USB-2 connector on the motherboard
LCD_shield https://wiki.dfrobot.com/LCD_KeyPad_Shield_For_Arduino_SKU__DFR0009

Arduino Software

Upload the NASDisplay.ino file to the Arduino.
The version on github works with a GPIO pin based LCD display (not the I2C version): LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // select the pins used on the LCD panel Is the Arduino connected?
lsusb Output: Bus 001 Device 002: ID 2341:0001 Arduino SA Uno (CDC ACM)
Permission denied: '/dev/ttyACM0'
sudo usermod -a -G dialout [your_username] log out and log back in
actually, only worked after reboot

Test communication with Arduino
sudo apt-get install minicom minicom -D /dev/ttyACM0 Press CTRL-A Z
Press P
Press C for 9600 baud

Server Software

The server software consists of a python script that communicates with the Arduino.

Software Versions

The 2019 version of the python software was using the PySensors packages.
This package no longer works with modern python versions.

The 2025 version of the python software uses the psutil package which also provides CPU temperature.

Software Development as non-admin

Download python script onto your server
cd ~ mkdir github cd github git clone https://github.com/atmelino/NASDisplay.git
Install lm-sensors to get access to hardware sensors sudo apt-get install lm-sensors Install required python libraries
pip install pyserial pip install psutil
To run the python script:
python3 NASDisplay.py

Software Development as root

Since we want to be able to shut down the computer with a python script, we need to run the service as root.

Login as root user
sudo -i If we try to run the script now, we will get an error that the psutil library is missing.
This is because we installed it as a non-admin user, and the root user can't see it.
ModuleNotFoundError: No module named 'psutil'
The serial and sensor packages need to be installed such that they are available to root.

sudo su
cd ~
umask 022
apt-get install python3-psutil

Autostart Display script at Boot

We want the script to start automatically when the server starts, and we will use the systemd mechanism by adding the NASDisplay software as a systemd service.

In the NASDisplay.service file, the lines will be

[Service]
User=root

Copy the NASDisplay.service file to /etc/systemd/system/: /etc/systemd/system/NASDisplay.service https://github.com/atmelino/NASDisplay/blob/master/systemd/NASDisplay.service

Modify as needed (for example, user name and path of python script)

Start the service:
sudo systemctl start NASDisplay.service
Check the status:
sudo systemctl status NASDisplay.service
If there is an error, check the journal to see the output from the service:
journalctl -u NASDisplay.service -b
If there was an error, it might be that the psutil library is missing.
In that case, go back to the terminal and try to run the script as root.

When it works:
To start automatically at boot:
sudo systemctl enable NASDisplay.service

Useful commands

Start the service:
sudo systemctl start NASDisplay.service
Stop the service:
sudo systemctl stop NASDisplay.service
check status:
sudo systemctl status NASDisplay.service
during development
sudo systemctl daemon-reload
sudo systemctl restart NASDisplay.service
To start automatically at boot:
sudo systemctl enable NASDisplay.service
To list all services:
sudo systemctl list-unit-files
or
sudo systemctl list-unit-files | grep NASDisplay.service
To see output from service:
journalctl -u NASDisplay.service -b
To shorten journal file:
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s

----------------------------------------------
old
pip install pyserial pip install PySensors modemmanager causes problems by probing serial ports
remove modemmanager:

sudo apt-get purge modemmanager
https://askubuntu.com/questions/216114/how-can-i-remove-modem-manager-from-boot

https://stackoverflow.com/questions/36898474/how-to-install-a-module-for-all-users-with-pip-on-linux