{"id":2067,"date":"2021-01-03T21:46:24","date_gmt":"2021-01-03T21:46:24","guid":{"rendered":"https:\/\/sp2hari.com\/?p=2067"},"modified":"2021-01-03T21:49:38","modified_gmt":"2021-01-03T21:49:38","slug":"setting-up-raspberry-pi-touchscreen-display","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2021\/01\/03\/setting-up-raspberry-pi-touchscreen-display\/","title":{"rendered":"Setting up raspberry pi &#038; touchscreen display"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This is a step by step guide to build a raspberry pi with the touchscreen display. Before we get started, this is the final result of the setup at my work table. <\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2.jpg\" alt=\"\" class=\"wp-image-1967\" width=\"768\" height=\"576\" srcset=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2.jpg 1024w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2-300x225.jpg 300w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2-768x576.jpg 768w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/11\/table-2-400x300.jpg 400w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 1<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Install Raspberry OS. The easiest way to do this from a Mac is to use a Raspberry Pi Imager. Installing Raspberry Pi Imager and installing the OS in the SD card took less than 15 minutes and most of the time I was simply watching the progress bar move ahead. There is nothing much to do here after the installation is started. Probably a good time to make some coffee. <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 2<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">During the first boot, the system might recommend for updating all software and packages. If this happens, I strongly recommend updating all the packages. In case, if this doesn&#8217;t happen, run the following three commands in your terminal<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">sudo apt-get update\nsudo apt-get upgrade\nsudo reboot<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Step 3<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, it is very obvious to note that the screen is rotated. To change the screen rotation, add the line &#8220;display_rotate=2&#8221; to \/boot\/config.txt<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">sudo sh -c 'echo display_rotate=2 >> \/boot\/config.txt'\nsudo reboot<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Step 4<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">While the screen rotation is fixed, the touch (click) is still messed up. Touching (clicking) on the top right still triggers a click on the bottom left. Here is the article which explains both the display and touchscreen rotation issues. <a href=\"https:\/\/www.instructables.com\/Rotate-Raspberry-Pi-Display-and-Touchscreen\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.instructables.com\/Rotate-Raspberry-Pi-Display-and-Touchscreen\/<\/a><\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">sudo vim \/usr\/share\/X11\/xorg.conf.d\/40-libinput.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add <em>Option &#8220;TransformationMatrix&#8221; &#8220;-1 0 1 0 -1 1 0 0 1&#8221;<\/em> to be added to the section with touchscreen. The whole section should be as follows<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Section \"InputClass\"\n    Identifier \"libinput touchscreen catchall\"\n    MatchIsTouchScreen \"on\"\n    MacthDevicePath \"\/dev\/input\/event*\"\n    Driver \"libinput\"\n    Option \"TransformationMatrix\" \"-1 0 1 0 -1 1 0 0 1\"\nEndSection<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Step 5<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, it is better to enable ssh to enable remote access to the raspberry pi. It makes life so much easier. <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">sudo systemctl enable ssh<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Step 6<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The only step remaining is to run a script every time the raspberry pi boots. <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">sudo sh -c 'echo @bash \/home\/pi\/init.sh >> \/etc\/xdg\/lxsession\/LXDE-pi\/autostart'\nsudo reboot<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">For the last step, create a file called init.sh (the same name as we used in the previous step) in the \/home\/pi folder with the following contents<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">#!\/bin\/bash\nchromium-browser --noerrdialogs --disable-infobars --kiosk https:\/\/sp2hari.com\/timetracker\/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is all we need to build kiosk from a raspberry pi. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a step by step guide to build a raspberry pi with the touchscreen display. Before we get started, this is the final result of the setup at my work table. Step 1 Install Raspberry OS. The easiest way to do this from a Mac is to use a &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-2067","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/2067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=2067"}],"version-history":[{"count":12,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/2067\/revisions"}],"predecessor-version":[{"id":2096,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/2067\/revisions\/2096"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=2067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=2067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=2067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}