Turing Smart Screen Python


Posted on July 27, 2023


Introduction

This guide will cover how to install the Turing Smart Screen Python package which can be found at https://github.com/mathoudebine/turing-smart-screen-python. Not only does this package provide a sensor panel application, but it also gives access to an easy to use Python library so you can utilize this screen with your own custom projects. I’ll be installing this on a system running Kubuntu today but the process will be more or less the same on other distros including Raspberry Pi systems. This package also works on Windows and Mac as well. You can purchase the screen here on Amazon (affiliate link).

If you're running Windows 10 and are only interested in the sensor panel application then the official software will be much easier to install: https://www.turzx.com/2023/03/02/%E7%9B%B4%E9%93%BE%E4%B8%8B%E8%BD%BDdirectdownload/ By default Windows doesn't come with software that can extract .rar files. 7zip is free software that can do this: https://www.7-zip.org/download.html

If you'd like to install the Turing Smart Screen Python package for Windows then skip to the bottom of the page to see the video guide. The following section is the Linux guide.

Installation

The first thing we need to do is make sure Python is installed on the system. If you’re running a Debian/Ubuntu based distro like I am today then make sure these packages are installed before moving on:

sudo apt update
sudo apt install gcc git python3-pip python3-venv

Next lets clone the Github repo and enter the directory.

git clone https://github.com/mathoudebine/turing-smart-screen-python.git
cd turing-smart-screen-python

Next we need to download some packages with PIP. It's best to create a Python virtual environment before installing packages. The following commands create a new virtual environment and activates it.

python3 -m venv venv
. venv/bin/activate

Next install the packages with the following command. If installing to a Raspberry Pi then run the second line instead.

python3 -m pip install -r requirements.txt

Raspberry Pi:

pip install Pillow pyserial PyYAML psutil pystray babel ruamel.yaml sv-ttk gputil

Next you'll need to install tkinter. If running on a headless Raspberry Pi then you don't need this package. If running a Debian/Ubuntu based distro then you can install tkinter with the following:

sudo apt install python3-tk

If running Linux, also add your user to the dialout group:

sudo usermod -a -G dialout $USER

Make sure to reboot your computer before proceeding. Also make sure to activate the Python virtual environment again. Now the GUI application can be launched. With the GUI app you can easily configure settings and start the screen:

python3 configure.py

If you want to avoid the GUI you can start the screen with the following command:

python3 main.py

Press ctrl-c in the terminal to exit the app. You might need to disconnect and reconnect your panel before starting it again. If you want to configure the device without the GUI app, you can modify the config.yaml file. Additional themes can be downloaded at https://github.com/mathoudebine/turing-smart-screen-python/discussions/categories/themes. The downloaded themes should be extracted and placed in the res/themes/ folder.

Auto Start At Boot

The Github repo contains instructions on how to run the sensor panel automatically when booting up but those steps weren't working for me, even when installing PIP packages locally. Luckily I was able to get it working with a different method:

First create a .sh file with an appropriate name, for example RunAtBoot.sh. Next place the following code inside the file and be sure to specify /path-to-turing-smart-screen-python/

#! /bin/bash
cd /path-to-turing-smart-screen-python/ && . venv/bin/activate && python3 main.py

Now make this file executable:

chmod +x RunAtBoot.sh

Next add this file to your system's Autostart. Most distros will have a GUI application to easily add your script. For vanilla Ubuntu launch the Startup Applications app and add your script there. For systems running KDE search for the Autostart app, this is what I used. After doing this, try rebooting. The sensor panel application should automatically start when you login.

Windows Guide

Conclusion

The theme-editor.py program can also be used to edit existing themes. I won't be covering this, but it's there if you want to check it out. This screen can also be integrated into your own custom Python projects. Take a look at simple-program.py for a simple example to see how the various functions are used. Also take a look at my custom weather app I created for it https://github.com/PhazerTech/turing-smart-screen-python-weather-app
I might be integrating this screen into more projects at some point in the future, so stay tuned.


Have a question or business inquiry? Get in touch!