{"id":2143,"date":"2018-05-08T16:19:34","date_gmt":"2018-05-08T13:19:34","guid":{"rendered":"http:\/\/saisa.eu\/blogs\/Guidance\/?p=2143"},"modified":"2018-05-08T16:27:40","modified_gmt":"2018-05-08T13:27:40","slug":"touchscreen-on-raspberry-pi-to-show-key-performance-data","status":"publish","type":"post","link":"https:\/\/saisa.eu\/blogs\/Guidance\/?p=2143","title":{"rendered":"Touchscreen on Raspberry PI, to show key performance data"},"content":{"rendered":"<p>A tiny touchscreen on portable Raspberry PI (RPI) might be very helpfull for showing sensor values or key performance data like memory, CPU level or disk space left. My intention is to build a portable air quality monitoring tool based on RPI. This monitoring system will be able to show values of temperature, humidity and dust level.<\/p>\n<p>This blog is about the first step, to use the screen for something simple, like showing key performance data. The figure below shows how the 3.2&#8243;screen looks like when attached on top of the RPI. I got my <a href=\"https:\/\/www.joy-it.net\/en\/tft-display-3-2-v2\/\">TFT Display 3.2 V2<\/a> on a good discount on a local computer store \ud83d\ude42 &#8230;<\/p>\n<p><img loading=\"lazy\" alt=\"raspberry-touchscreen01\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2018\/05\/raspberry-touchscreen01.png\" width=\"600\" height=\"442\" \/><\/p>\n<p><strong>Operating System<\/strong><\/p>\n<p>First I tried to get the screen working with the current raspbian OS. After some trial and error, I decided to try the <a href=\"https:\/\/www.waveshare.com\/wiki\/3.2inch_RPi_LCD_(B)\">manufacturer&#8217;s<\/a> OS image. And as it was working right away, then I continued with that path. Remember to use &#8220;sudo raspi-config&#8221; command to configure your keyboard, localization, time etc.<\/p>\n<p>One can clean up and remove the unnecessary packages, eg. wolfram-engine, libreoffice, sonic-pi and minecraft.<\/p>\n<div style=\"OVERFLOW: auto; HEIGHT: 324px; WIDTH: 600px\">\n<pre>\n<br \/>dpkg --get-selections &gt; packages.txt\n<br \/>dpkg-query -Wf '${Installed-Size}\\t${Package}\\n' | sort -n &gt; packages-space.txt\n<br \/>sudo apt-get purge wolfram-engine\n<br \/>sudo apt-get clean\n<br \/>sudo apt-get autoremove\n<br \/>sudo apt-get purge libreoffice*\n<br \/>sudo apt-get clean\n<br \/>sudo apt-get autoremove\n<br \/>sudo apt-get purge sonic-pi minecraft-pi\n<br \/>sudo apt-get clean\n<br \/>sudo apt-get autoremove\n<br \/>sudo apt-get purge scratch scratch2 squeak-vm squeak-plugins-scratch\n<br \/>sudo apt-get clean\n<br \/>sudo apt-get autoremove\n<\/pre>\n<\/div>\n<p>Link: <a href=\"http:\/\/raspi.tv\/2016\/how-to-free-up-some-space-on-your-raspbian-sd-card-remove-wolfram-libreoffice\">How To Free Up Some Space On Your Raspbian SD Card? Remove Wolfram &amp; LibreOffice<\/a><\/p>\n<p><strong>Text mode in console<\/strong><\/p>\n<p>At first I tried to use the text mode in console, but this display (with 320&#215;240 pixels) is still too small for anything more serious work. It is better to use the ssh (putty) over wifi to operate anything on command line. However, if you wish to use the text mode, then one can use &#8220;sudo raspi-config&#8221; to activate booting into text mode. And the font for the console can be set in console-setup file by adding 2 lines, see below (see <a href=\"https:\/\/www.raspberrypi-spy.co.uk\/2014\/04\/how-to-change-the-command-line-font-size\/\">link<\/a>).<\/p>\n<pre>\n<br \/>sudo vi \/etc\/default\/console-setup\n<br \/>FONTFACE=\"Terminus\"\n<br \/>FONTSIZE=\"6x12\"\n<\/pre>\n<p>It is possible to utilize a virtual keyboard (eg. matchbox-keyboard) , and use the mouse for typing (see <a href=\"http:\/\/ozzmaker.com\/virtual-keyboard-for-the-raspberry-pi\/\">link<\/a>). And\/or one could simply activate a screensaver called termsaver, which has several utilities like matrix, clock and system monitor.<\/p>\n<pre>\n<br \/>sudo apt-get install termsaver\n<br \/>termsaver matrix\n<br \/>termsaver clock\n<br \/>termsaver sysmon\n<\/pre>\n<p><strong>Graphic mode in touchscreen<\/strong><\/p>\n<p>As the goal is to create a portable &#8220;low security&#8221; gadget for measuring the temperature, then one could easily activiate the windowing mode with automatic login (by using again the famous command &#8220;sudo raspi-config&#8221;). At reboot, the X-server environment is automatically started. In order to launch your custom script\/tool, then one can follow the instructions <a href=\"https:\/\/www.raspberrypi-spy.co.uk\/2014\/05\/how-to-autostart-apps-in-rasbian-lxde-desktop\/\">here<\/a>, and add the corresponding line in autostart file:<\/p>\n<pre>\n<br \/>vi \/etc\/xdg\/lxsession\/LXDE-pi\/autostart\n<br \/>@\/usr\/bin\/python \/home\/pi\/Display\/pitkgui-custom.py\n<\/pre>\n<p><strong>Custom start script in the touchscreen<\/strong><br \/>\n<a href=\"https:\/\/github.com\/bunk3r\/pitkgui\/blob\/master\/pitkgui.py\">pitkgui<\/a> script in <a href=\"https:\/\/github.com\/bunk3r\/pitkgui\">github<\/a> was used as a base for the customized script, and it can be modified to provide different performance values to be monitored. The screenshot below shows the output of the customized script (<a title=\"Zipped file\" href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2018\/05\/pitkgui-custom.zip\">pitkgui-custom.py<\/a>). (The screenshot is taken with scrot command. One can install it with &#8220;sudo apt-get install scrot&#8221; command).<\/p>\n<p><img loading=\"lazy\" alt=\"2018-05-07-001551 320x240 scrot\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2018\/05\/2018-05-07-001551_320x240_scrot.png\" width=\"320\" height=\"240\" \/><\/p>\n<p>The custom1 and custom2 buttons are still unused, and will be used later for the humidity and dust level sensors. (The 3 hardware buttons outside of the screen could be used by another script&#8230;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A tiny touchscreen on portable Raspberry PI (RPI) might be very helpfull for showing sensor values or key performance data like memory, CPU level or disk space left. My intention is to build a portable air quality monitoring tool based &hellip; <a href=\"https:\/\/saisa.eu\/blogs\/Guidance\/?p=2143\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,68,74,67,34,63,80,82,51,10,7],"tags":[],"_links":{"self":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/2143"}],"collection":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2143"}],"version-history":[{"count":2,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/2143\/revisions"}],"predecessor-version":[{"id":2145,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/2143\/revisions\/2145"}],"wp:attachment":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}