<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Stone HMI Display with Raspberry Pi]]></title><description><![CDATA[<div>
<h1>
<a></a><b style="font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'">Table of Contents</b>
</h1>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[1]<span> </span></span></span><span style="font-size:12pt"><a></a>Description</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[2]<span> </span></span></span><span style="font-size:12pt"><a></a>Component</span><span style="font-size:12pt"> </span><span style="font-size:12pt">List</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[3]<span> </span></span></span><span style="font-size:12pt"><a></a>Software/ Tools</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Installation</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[4]<span> </span></span></span><span style="font-size:12pt"><a></a>GUI Designing &amp;</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Uploading</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[5]<span> </span></span></span><span style="font-size:12pt"><a></a>Working &amp; Raspberry-Pi</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Coding</span>
</p>
<h2 style="text-align:justify">
<a></a><span>[1]<span> </span></span><b><a></a>Description</b>
</h2>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Stone Technologies is a professional Manufacturer of HMI Intelligent TFT LCD modules. Depending on the application the Stone Technologies offers Industrial Type, Advanced type, and Civil Type Intelligent TFT LCD modules available in different sizes. </span><span><a href="https://www.stoneitech.com/product/by-application/industrial-type"><b><u><span style="font-size:12pt">Visit Here </span></u></b><u><span style="font-size:12pt">.</span></u></a></span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">In this project I am going to control LEDs with the help of this Stone HMI display. Command data, through Display will send to the Raspberry-pi and this data is in the form of frame because this Display sends data in the form of frame and receive in the frame of HEX code. Here I am using </span><b><span style="font-size:12pt">STWI056WT/N-01 </span></b><span style="font-size:12pt">model for our in this project, if you want to understand data frame and how it is working? you can download the Datasheet from here .</span>
</p>
<h1 style="text-align:left">
<span>[2]<span> </span></span><b>Component List</b>
</h1>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[1]<span> </span></span></span><span style="font-size:12pt"><a></a>STONE-HMI Display</span><span style="font-size:12pt"> </span><span style="font-size:12pt">[</span><b><span style="font-size:12pt">STWI056WT/N-01</span></b><span style="font-size:12pt">]</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[2]<span> </span></span></span><span style="font-size:12pt"><a></a>Raspberry-Pi</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[3]<span> </span></span></span><span style="font-size:12pt"><a></a>TTL to USB</span><span style="font-size:12pt"> </span><span style="font-size:12pt">converter</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[4]<span> </span></span></span><span style="font-size:12pt"><a></a>9v-12v Power</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Supply</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[5]<span> </span></span></span><span style="font-size:12pt"><a></a>USB cables</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[6]<span> </span></span></span><span style="font-size:12pt"><a></a>LEDs</span>
</p>
</div>
<div>
<h1 style="text-align:left">
<a></a><span>[3]<span> </span></span><b>Software/ Tools</b><b> </b><b>Installation</b>
</h1>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">before proceeding further we have to install Stone Designer and the Driver for USB so let see how to install these software. Below Drive link is given from that you can download the Designer tool and USB driver software.</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<p>
<a></a><b><span style="font-size:12pt">Step-1 :- </span></b><span style="font-size:12pt">Go to this Drive you will get a window as given below in the image and download these software and then install them in your computer.</span>
</p>
<p style="text-align:left">
<span><a href="https://www.stoneitech.com/support/download/software"><b><u><span style="font-size:12pt">Drive ink :-</span></u></b></a></span><b><u><span style="font-size:12pt"> </span></u></b><i><u><span style="font-size:12pt">https://drive.google.com/drive/folders/1SbTuj9sqHLb9zV7pmEXOIyxWa9PAdOPH?usp=sharing</span></u></i><i></i>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.fb353916a5e4e6c3847d289ff46cdf68.png" data-fileext="png"><img data-ratio="38.50" width="1000" alt="image.thumb.png.a266cd6b607ec2489dbe5b536fd95491.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a266cd6b607ec2489dbe5b536fd95491.png" /></a><a></a><span style="font-size:12pt">From here you have to download 1</span><sup><span style="font-size:12pt;vertical-align:super">st</span></sup><span style="font-size:12pt"> and 3</span><sup><span style="font-size:12pt;vertical-align:super">rd</span></sup><span style="font-size:12pt"> file, because first one is for GUI-Designer tool and 3</span><sup><span style="font-size:12pt;vertical-align:super">rd</span></sup><span style="font-size:12pt"> is for USB driver.So download these software and let’s go for GUI design.</span>
</p>
</div>
<div>
<h1 style="text-align:left">
<a></a><span>[4]<span> </span></span><b><a></a>GUI Designing &amp;</b><b> </b><b>Uploading</b>
</h1>
<p>
<a></a><span style="font-size:12pt">Let’s start first with interface designing. After installed , go to to Stone-Designer icon and click on that after that designer software will open and you will get this type of interface as shown in image.</span>
</p>
 
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.5d6c5806ed096f131021bfa5db3060aa.png" data-fileext="png"><img data-ratio="50.60" width="1000" alt="image.thumb.png.5002f33a362dd403e83e4603ee29715c.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5002f33a362dd403e83e4603ee29715c.png" /></a><span style="font-size:9.5pt"> </span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After opened you have to create a new project for this select ‘Project’ from top and from that select ‘new’ and you will ask for the some details as shown in the below figure , now give the name of project and select screen size as per your display size, here I’m using </span><b><span style="font-size:12pt">640X480 </span></b><span style="font-size:12pt">size display , and select project path also after done with filling all the details click on ‘Create’ .</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.d3fd3cf6a18f814623fed8de35d1d4a1.png" data-fileext="png"><img data-ratio="50.70" width="1000" alt="image.thumb.png.64e54e81b6785a6e38ad6060bcd40863.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.64e54e81b6785a6e38ad6060bcd40863.png" /></a>
</p>
</div>
<div>
<p>
<a></a><span style="font-size:12pt">After done with above part select the background image for the project for this follow steps as shown in the figure.</span>
</p>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-1 </span></b><span style="font-size:12pt">:- Select ‘image’ from Resources to upload the image as back ground image and there are also other images which we will use for button purpose in further process, those images are given below, if you want you can design by your own.</span>
</p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.f476f264bc0ff1c4990ca9590002bd41.png" data-fileext="png"><img data-ratio="52.40" width="1000" alt="image.thumb.png.dc197a94830adf34985d7770014510ca.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.dc197a94830adf34985d7770014510ca.png" /></a>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-2 :- </span></b><span style="font-size:12pt">Add these image in the GUI tool by clicking on that ‘+’ button as given in the below image.</span>
</p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.d9bcbe918fa93b476eb742b930262fdd.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.36819d5290eaebcf2dd305d94a65416f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.36819d5290eaebcf2dd305d94a65416f.png" /></a>
</div>
<div>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-3:- </span></b><span style="font-size:12pt">Now add first background image by clicking on blank screen and you will get more option in the right as shown in the image. From this select background image option and select that image which we have added just before this as per the below image.</span>
</p>
<p dir="auto"><a href="/assets/uploads-legacy/monthly_2023_06/image.png.e094f4daa3f9b67b0671fda22d2bf301.png" data-fileext="png"><img data-ratio="53.30" width="1000" alt="image.thumb.png.c4af9ac6a55121140d6a61242981da6a.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.c4af9ac6a55121140d6a61242981da6a.png" /></a></p>
<p>
<a></a><b><span style="font-size:12pt">Step-4 :- </span></b><span style="font-size:12pt">Now add buttons for RGB one by one, you can see in the image one button is already added so first will apply changes in it and then similarly will do for other button.</span>
</p>
<p>
<a></a><span style="font-size:12pt">Now select first button which we have added and go in properties of this which is in right side as given in image.</span>
</p>
<p>
<br />
<span style="font-size:10.5pt;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"> <span> </span></span><a href="/assets/uploads-legacy/monthly_2023_06/image.png.3612a51fa1e2383e5f62f479a85fabd3.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.ab943b82ad45a65dd0c46528b6dd73f9.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.ab943b82ad45a65dd0c46528b6dd73f9.png" /></a>
</p>
</div>
<div>
<p>
<a></a><b><span style="font-size:12pt">Step-4 :- </span></b><span style="font-size:12pt">From that select background image as Red image because this Button is for Red LED. And similarly do other settings like text color and size, so now we have done with first button, and you can follow same procedure for other buttons also.</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<h2>
<a></a><b><u>But After added all the buttons you have to note down their name, which is highlighted in the below image.</u></b><b> </b><b><u>So you have to note for each button and you can give the name in the sequence like button1,button2.. and</u></b><b> </b><b><u>so on. This thing will require in the coding part, so keep it in your mind.</u></b>
</h2>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.38b87943d8241e298beb09b2020ba249.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.3f4ba2d8672fb170427d3c1ad9e9ead6.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.3f4ba2d8672fb170427d3c1ad9e9ead6.png" /></a>
</p>
<b><span style="font-size:10.5pt"> </span></b>
<p>
<a></a><span style="font-size:12pt">In this end it will look like this with all the buttons. So now GUI-Design is ready now we can proceed further.</span>
</p>
</div>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b61fa6175befb885e1927f48e85b0256.png" data-fileext="png"><img data-ratio="53.30" width="1000" alt="image.thumb.png.a49654d9af05adcdebbb311701e00f6a.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a49654d9af05adcdebbb311701e00f6a.png" /></a>
</p>
<div>
<p style="text-align:justify">
<span> </span><a></a><b><span style="font-size:12pt">Step-5 :- </span></b><span style="font-size:12pt">This step is for, to upload the </span><b><span style="font-size:12pt">GUI-Design </span></b><span style="font-size:12pt">in the display.For this first connect the display with power supply of 9-12 volt through power port. And then connect USB to USB to your PC with Display. It will look like this.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.3b49100bedc6dfa6d0d0c85e644f60cb.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.a42133b028a2ec9f5e541e883955725f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a42133b028a2ec9f5e541e883955725f.png" /></a>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
 
</td>
</tr>
</tbody>
</table>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After connected the display now first we have to download the </span><b><span style="font-size:12pt">‘Default’ </span></b><span style="font-size:12pt">folder through GUI-Tool. For this go to at </span><b><span style="font-size:12pt">Debug </span></b><span style="font-size:12pt">and <span> </span>click on </span><b><span style="font-size:12pt">Download </span></b><span style="font-size:12pt">then select the location where you want to download it.</span>
</p>
<br />
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b9b0222f410ff77653b234d4d5c63b66.png" data-fileext="png"><img data-ratio="56.00" width="1000" alt="image.thumb.png.a4ecd8462979f6ea74eff7caac21bd8b.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a4ecd8462979f6ea74eff7caac21bd8b.png" /></a><span style="font-size:14.5pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Now we have </span><b><span style="font-size:12pt">Default </span></b><span style="font-size:12pt">folder in our local machine will upload in the Display memory, for this first connect the display as mentioned above in the image through USB to USB communication with your PC. You will get a storage device in your PC there you have to delete first previous </span><b><span style="font-size:12pt">Default </span></b><span style="font-size:12pt">folder as mentioned in below image.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.f50bf83cd1754f019566cb9217019d25.png" data-fileext="png"><img data-ratio="52.70" width="1000" alt="image.thumb.png.451f9a3838f692e70340875bafe746ee.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.451f9a3838f692e70340875bafe746ee.png" /></a>
</p>
 
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After that you can paste that folder here which we have copied from GUI design. As you can see in the below image.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.646418487f787f44243a33db5b8c59d6.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.1b6804c19de31fc1924d856b2dc3cd20.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.1b6804c19de31fc1924d856b2dc3cd20.png" /></a>
</p>
<br />
<span style="font-size:10.5pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After pasted the default folder in display storage, just remove USB from Display and also remove the power supply, and after 2-3 sec just connect the power supply again to the display. Then you will get like this GUI which we have designed.</span>
</p>
<p>
<span style="font-size:12pt;text-align:justify;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'">Now we have done with GUI design and uploading part , so its time to go through code and its working.</span><span style="font-size:10pt;text-align:justify;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"> </span>
</p>
<p>
<span style="font-size:10pt"> </span><a href="/assets/uploads-legacy/monthly_2023_06/image.png.710b807355512f04e5b9cad2dece95f3.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.659d32591fb196a3c039a9c8c37e76b6.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.659d32591fb196a3c039a9c8c37e76b6.png" /></a>
</p>
<p>
<span style="font-size:14.5pt"> </span>
</p>
<h1 style="text-align:justify">
<a></a><span style="font-size:14pt"><span>[5]<span> </span></span></span><b><span style="font-size:14pt"><a></a>Working &amp; Raspberry-Pi</span></b><b><span style="font-size:14pt"> </span></b><b><span style="font-size:14pt">Coding</span></b>
</h1>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Now first connect Raspberry-Pi through VNC server or you can connect directly through display as per your convenience. Then there are two codes which are given below. The first one is for testing the all buttons which we have created and second one the Whole code with I/O setup and it has</span><span style="font-size:12pt"> </span><span style="font-size:12pt">logic.</span>
</p>
<h2 style="text-align:justify">
<a></a><b>Testing Code :-</b>
</h2>
<p>
<b><span style="font-size:10pt"> </span></b>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<span></span>
</td>
</tr>
</tbody>
</table>
<b><span style="font-size:9pt"> </span></b>
<p>
<b><span style="font-size:9pt"> </span></b>
</p>
<p style="text-align:center">
<a></a><span style="font-size:12pt">import serial</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<p>
<a></a><span style="font-size:12pt">serialcomm = serial.Serial('/dev/ttyUSB0', 115200)<a></a> while</span><span style="font-size:12pt"> </span><span style="font-size:12pt">True:</span>
</p>
<p>
<a></a><span style="font-size:12pt">l=serialcomm.read(size=20)<a></a> q=l[7:14]</span>
</p>
<p style="text-align:center">
<a></a><span style="font-size:12pt">Print(q)</span>
</p>
<p>
<span style="font-size:10pt"> </span>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<span></span>
</td>
</tr>
</tbody>
</table>
<span style="font-size:9pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Here the purpose of testing code is to check all buttons so for this you need to connect first USB-0 of Raspberry-Pi to you Display TTL connector and then copy this code in </span><b><span style="font-size:12pt">Thonny </span></b><span style="font-size:12pt">of Raspberry-Pi as given in below image and then click on run button to test</span><span style="font-size:12pt"> </span><span style="font-size:12pt">it.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.131fe02a167e30970d0563514d36052f.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.87a530f0891bf132e8df402f6af140d3.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.87a530f0891bf132e8df402f6af140d3.png" /></a><span style="font-size:12pt"> </span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">By click any button which is on display will get a particular button name which we have assigned in the starting as we discussed it earlier. You can see after pressing </span><b><span style="font-size:12pt">Button-1 </span></b><span style="font-size:12pt">on display we are getting output string as </span><b><span style="font-size:12pt">button1 </span></b><span style="font-size:12pt">because we have done the slicing of whole from which we are getting from</span><span style="font-size:12pt"> </span><span style="font-size:12pt">display.</span>
</p>
<p>
<a></a><span style="font-size:12pt">l=serialcomm.read(size=20)</span><span style="font-size:12pt"> <a></a></span><span style="font-size:12pt"> q=l[7:14]</span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt"><a></a>Here as in testing code these line of code, here l is variable which is receiving the frame from display size of 20, and then q is storing the sliced value as per our requirement.</span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">And accordingly in complete code we made the logic as per individual button. Below logic is given as button6 will press then it will ON the LED2 high and if button7 will press it will of the LED2 as Off. Similarly all logic are working for others LEDs.</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button6'):</span>
</p>
<p>
<a></a><span style="font-size:12pt"> </span><span style="font-size:12pt"> </span><span style="font-size:12pt">GPIO.output(led2,GPIO.HIGH)</span><span style="font-size:12pt"> </span>
</p>
<p>
<a></a><span style="font-size:12pt">    </span><span style="font-size:12pt">elif(q==b'button7'):</span>
</p>
<p>
<a></a><u><span style="font-size:12pt"> </span></u><u><span style="font-size:12pt"> </span></u><u><span style="font-size:12pt">GPIO.output(led2,GPIO.LOW)</span></u><u><span style="font-size:12pt"> </span></u>
</p>
</div>
<div>
<h2>
<a></a><b>Complete Code :-</b>
</h2>
<p>
<a></a><span style="font-size:12pt">import RPi.GPIO as GPIO<a></a> GPIO.setmode(GPIO.BCM)<a></a> GPIO.setwarnings(False)<a></a> led1 =</span><span style="font-size:12pt"> </span><span style="font-size:12pt">26</span>
</p>
<p>
<a></a><span style="font-size:12pt">led2 =</span><span style="font-size:12pt"> </span><span style="font-size:12pt">19</span>
</p>
<p>
<a></a><span style="font-size:12pt">red_led= 13</span>
</p>
<p>
<a></a><span style="font-size:12pt">green_led= 6</span>
</p>
<p>
<a></a><span style="font-size:12pt">blue_led= 5<a></a> status1=0<a></a> status2=0</span>
</p>
<p>
<a></a><span style="font-size:12pt">GPIO.setup(red_led,GPIO.OUT)<a></a> GPIO.setup(green_led,GPIO.OUT)<a></a> GPIO.setup(blue_led,GPIO.OUT)<a></a> GPIO.setup(led1,GPIO.OUT)<a></a> GPIO.setup(led2,GPIO.OUT)<a></a> GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(green_led,GPIO.LOW)<a></a> GPIO.output(blue_led,GPIO.LOW)<a></a> GPIO.output(led1,GPIO.LOW)<a></a> GPIO.output(led2,GPIO.LOW)<a></a> ######################</span>
</p>
<p>
<a></a><span style="font-size:12pt">import serial</span>
</p>
<p>
<a></a><span style="font-size:12pt">serialcomm = serial.Serial('/dev/ttyUSB0', 115200</span>
</p>
</div>
<div>
<p>
<a></a><span style="font-size:12pt">while True:<a></a> l=serialcomm.read(size=20)<a></a> q=l[7:14]</span>
</p>
<p>
<a></a><span style="font-size:12pt">if(q==b'button1'):<a></a> print(q)</span>
</p>
<p>
<a></a><span style="font-size:12pt">GPIO.output(red_led,GPIO.HIGH)<a></a> </span><span style="font-size:12pt">GPIO.output(green_led,GPIO.LOW)<a></a> </span><span style="font-size:12pt">GPIO.output(blue_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button2'):<a></a> </span><span style="font-size:12pt">GPIO.output(green_led,GPIO.HIGH)<a></a> </span><span style="font-size:12pt">GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(blue_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button3'):<a></a> GPIO.output(blue_led,GPIO.HIGH)<a></a> GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(green_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button4'):<a></a> GPIO.output(led1,GPIO.HIGH)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button5'):<a></a> </span><span style="font-size:12pt">GPIO.output(led1,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button6'):<a></a> GPIO.output(led2,GPIO.HIGH)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button7'):<a></a> </span><span style="font-size:12pt">GPIO.output(led2,GPIO.LOW)</span>
</p>
</div>
<p>
<a></a><span style="font-size:12pt">Now we have understand the logic behind the code let’s run the second code that is complete code in Raspberry-Pi but before this make the circuit connection like as given below in the circuit diagram.</span>
</p>
<h2>
<a></a><b><span style="font-size:12pt">Circuit Diagram :-</span></b>
</h2>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b37654b1e43f49a6d9d8230b8fb36539.png" data-fileext="png"><img data-ratio="54.70" width="1000" alt="image.thumb.png.d72796e8e2fc6401c12ddf851137363f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.d72796e8e2fc6401c12ddf851137363f.png" /></a>
</p>
<p style="text-align:left">
<a></a><b>Output :-</b>
</p>
<p>
<a></a><span style="font-size:12pt">Now we have completed the whole project and the now you can test you project , the final setup will look like this.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.3b3a5c35dba3a4d3b2079c563ac287d9.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.2b3d9c710b51d9720751cf4d2fac1caa.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.2b3d9c710b51d9720751cf4d2fac1caa.png" /></a>
</p>
<p>
<span style="font-size:14.5pt"> </span>
</p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.e222510a93bb378de3a367c3da658116.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.1ddbb1ab09095e7023030e6666661c52.png" data-ratio="38.5" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.7cd634e259f79ad9d0f17beb0e7fc598.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.3d185041848b583de237c35c48eac346.png" data-ratio="52.9" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.05e69ad98f22f9c87095a970950b8160.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.ed25feed5d1eeff9a9e0480f48359318.png" data-ratio="52.9" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.9ce7e0b44a023654fbaa5d5f394746ab.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.9ed063975201b2176a57e70081db01d2.png" data-ratio="53.3" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.13e62d4daf7c8214f35cddbc779195f7.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.820c56e2e08e4f46454a132e714e1725.png" data-ratio="53.3" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.f9dfd79656beaab8f7d58fb6d85fcc42.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5c70481c0ae3be021ca3956f7342ebb6.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.bdecc155dd80efb741302ad1a7059468.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.bde3da80a77a1f1d22fcea6e6635d167.png" data-ratio="56" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.0fdac35c35eae905d340a77975ac2ca0.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5c7e44b7578c503092db819f42601c68.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.0ecafa58426debbbe3cbf63dddb16a60.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.acdfac6bc73553c7c2e6d2e4a1a47f88.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>]]></description><link>https://www.xtremehardware.com/forum//topic/42932/stone-hmi-display-with-raspberry-pi</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Apr 2026 20:02:02 GMT</lastBuildDate><atom:link href="https://www.xtremehardware.com/forum//topic/42932.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jun 2023 03:25:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stone HMI Display with Raspberry Pi on Tue, 20 Jun 2023 03:25:38 GMT]]></title><description><![CDATA[<div>
<h1>
<a></a><b style="font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'">Table of Contents</b>
</h1>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[1]<span> </span></span></span><span style="font-size:12pt"><a></a>Description</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[2]<span> </span></span></span><span style="font-size:12pt"><a></a>Component</span><span style="font-size:12pt"> </span><span style="font-size:12pt">List</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[3]<span> </span></span></span><span style="font-size:12pt"><a></a>Software/ Tools</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Installation</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[4]<span> </span></span></span><span style="font-size:12pt"><a></a>GUI Designing &amp;</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Uploading</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[5]<span> </span></span></span><span style="font-size:12pt"><a></a>Working &amp; Raspberry-Pi</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Coding</span>
</p>
<h2 style="text-align:justify">
<a></a><span>[1]<span> </span></span><b><a></a>Description</b>
</h2>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Stone Technologies is a professional Manufacturer of HMI Intelligent TFT LCD modules. Depending on the application the Stone Technologies offers Industrial Type, Advanced type, and Civil Type Intelligent TFT LCD modules available in different sizes. </span><span><a href="https://www.stoneitech.com/product/by-application/industrial-type"><b><u><span style="font-size:12pt">Visit Here </span></u></b><u><span style="font-size:12pt">.</span></u></a></span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">In this project I am going to control LEDs with the help of this Stone HMI display. Command data, through Display will send to the Raspberry-pi and this data is in the form of frame because this Display sends data in the form of frame and receive in the frame of HEX code. Here I am using </span><b><span style="font-size:12pt">STWI056WT/N-01 </span></b><span style="font-size:12pt">model for our in this project, if you want to understand data frame and how it is working? you can download the Datasheet from here .</span>
</p>
<h1 style="text-align:left">
<span>[2]<span> </span></span><b>Component List</b>
</h1>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[1]<span> </span></span></span><span style="font-size:12pt"><a></a>STONE-HMI Display</span><span style="font-size:12pt"> </span><span style="font-size:12pt">[</span><b><span style="font-size:12pt">STWI056WT/N-01</span></b><span style="font-size:12pt">]</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[2]<span> </span></span></span><span style="font-size:12pt"><a></a>Raspberry-Pi</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[3]<span> </span></span></span><span style="font-size:12pt"><a></a>TTL to USB</span><span style="font-size:12pt"> </span><span style="font-size:12pt">converter</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[4]<span> </span></span></span><span style="font-size:12pt"><a></a>9v-12v Power</span><span style="font-size:12pt"> </span><span style="font-size:12pt">Supply</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[5]<span> </span></span></span><span style="font-size:12pt"><a></a>USB cables</span>
</p>
<p style="text-align:left">
<a></a><span style="font-size:12pt"><span>[6]<span> </span></span></span><span style="font-size:12pt"><a></a>LEDs</span>
</p>
</div>
<div>
<h1 style="text-align:left">
<a></a><span>[3]<span> </span></span><b>Software/ Tools</b><b> </b><b>Installation</b>
</h1>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">before proceeding further we have to install Stone Designer and the Driver for USB so let see how to install these software. Below Drive link is given from that you can download the Designer tool and USB driver software.</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<p>
<a></a><b><span style="font-size:12pt">Step-1 :- </span></b><span style="font-size:12pt">Go to this Drive you will get a window as given below in the image and download these software and then install them in your computer.</span>
</p>
<p style="text-align:left">
<span><a href="https://www.stoneitech.com/support/download/software"><b><u><span style="font-size:12pt">Drive ink :-</span></u></b></a></span><b><u><span style="font-size:12pt"> </span></u></b><i><u><span style="font-size:12pt">https://drive.google.com/drive/folders/1SbTuj9sqHLb9zV7pmEXOIyxWa9PAdOPH?usp=sharing</span></u></i><i></i>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.fb353916a5e4e6c3847d289ff46cdf68.png" data-fileext="png"><img data-ratio="38.50" width="1000" alt="image.thumb.png.a266cd6b607ec2489dbe5b536fd95491.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a266cd6b607ec2489dbe5b536fd95491.png" /></a><a></a><span style="font-size:12pt">From here you have to download 1</span><sup><span style="font-size:12pt;vertical-align:super">st</span></sup><span style="font-size:12pt"> and 3</span><sup><span style="font-size:12pt;vertical-align:super">rd</span></sup><span style="font-size:12pt"> file, because first one is for GUI-Designer tool and 3</span><sup><span style="font-size:12pt;vertical-align:super">rd</span></sup><span style="font-size:12pt"> is for USB driver.So download these software and let’s go for GUI design.</span>
</p>
</div>
<div>
<h1 style="text-align:left">
<a></a><span>[4]<span> </span></span><b><a></a>GUI Designing &amp;</b><b> </b><b>Uploading</b>
</h1>
<p>
<a></a><span style="font-size:12pt">Let’s start first with interface designing. After installed , go to to Stone-Designer icon and click on that after that designer software will open and you will get this type of interface as shown in image.</span>
</p>
 
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.5d6c5806ed096f131021bfa5db3060aa.png" data-fileext="png"><img data-ratio="50.60" width="1000" alt="image.thumb.png.5002f33a362dd403e83e4603ee29715c.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5002f33a362dd403e83e4603ee29715c.png" /></a><span style="font-size:9.5pt"> </span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After opened you have to create a new project for this select ‘Project’ from top and from that select ‘new’ and you will ask for the some details as shown in the below figure , now give the name of project and select screen size as per your display size, here I’m using </span><b><span style="font-size:12pt">640X480 </span></b><span style="font-size:12pt">size display , and select project path also after done with filling all the details click on ‘Create’ .</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.d3fd3cf6a18f814623fed8de35d1d4a1.png" data-fileext="png"><img data-ratio="50.70" width="1000" alt="image.thumb.png.64e54e81b6785a6e38ad6060bcd40863.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.64e54e81b6785a6e38ad6060bcd40863.png" /></a>
</p>
</div>
<div>
<p>
<a></a><span style="font-size:12pt">After done with above part select the background image for the project for this follow steps as shown in the figure.</span>
</p>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-1 </span></b><span style="font-size:12pt">:- Select ‘image’ from Resources to upload the image as back ground image and there are also other images which we will use for button purpose in further process, those images are given below, if you want you can design by your own.</span>
</p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.f476f264bc0ff1c4990ca9590002bd41.png" data-fileext="png"><img data-ratio="52.40" width="1000" alt="image.thumb.png.dc197a94830adf34985d7770014510ca.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.dc197a94830adf34985d7770014510ca.png" /></a>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-2 :- </span></b><span style="font-size:12pt">Add these image in the GUI tool by clicking on that ‘+’ button as given in the below image.</span>
</p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.d9bcbe918fa93b476eb742b930262fdd.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.36819d5290eaebcf2dd305d94a65416f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.36819d5290eaebcf2dd305d94a65416f.png" /></a>
</div>
<div>
<p style="text-align:justify">
<a></a><b><span style="font-size:12pt">Step-3:- </span></b><span style="font-size:12pt">Now add first background image by clicking on blank screen and you will get more option in the right as shown in the image. From this select background image option and select that image which we have added just before this as per the below image.</span>
</p>
<p dir="auto"><a href="/assets/uploads-legacy/monthly_2023_06/image.png.e094f4daa3f9b67b0671fda22d2bf301.png" data-fileext="png"><img data-ratio="53.30" width="1000" alt="image.thumb.png.c4af9ac6a55121140d6a61242981da6a.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.c4af9ac6a55121140d6a61242981da6a.png" /></a></p>
<p>
<a></a><b><span style="font-size:12pt">Step-4 :- </span></b><span style="font-size:12pt">Now add buttons for RGB one by one, you can see in the image one button is already added so first will apply changes in it and then similarly will do for other button.</span>
</p>
<p>
<a></a><span style="font-size:12pt">Now select first button which we have added and go in properties of this which is in right side as given in image.</span>
</p>
<p>
<br />
<span style="font-size:10.5pt;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"> <span> </span></span><a href="/assets/uploads-legacy/monthly_2023_06/image.png.3612a51fa1e2383e5f62f479a85fabd3.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.ab943b82ad45a65dd0c46528b6dd73f9.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.ab943b82ad45a65dd0c46528b6dd73f9.png" /></a>
</p>
</div>
<div>
<p>
<a></a><b><span style="font-size:12pt">Step-4 :- </span></b><span style="font-size:12pt">From that select background image as Red image because this Button is for Red LED. And similarly do other settings like text color and size, so now we have done with first button, and you can follow same procedure for other buttons also.</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<h2>
<a></a><b><u>But After added all the buttons you have to note down their name, which is highlighted in the below image.</u></b><b> </b><b><u>So you have to note for each button and you can give the name in the sequence like button1,button2.. and</u></b><b> </b><b><u>so on. This thing will require in the coding part, so keep it in your mind.</u></b>
</h2>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.38b87943d8241e298beb09b2020ba249.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.3f4ba2d8672fb170427d3c1ad9e9ead6.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.3f4ba2d8672fb170427d3c1ad9e9ead6.png" /></a>
</p>
<b><span style="font-size:10.5pt"> </span></b>
<p>
<a></a><span style="font-size:12pt">In this end it will look like this with all the buttons. So now GUI-Design is ready now we can proceed further.</span>
</p>
</div>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b61fa6175befb885e1927f48e85b0256.png" data-fileext="png"><img data-ratio="53.30" width="1000" alt="image.thumb.png.a49654d9af05adcdebbb311701e00f6a.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a49654d9af05adcdebbb311701e00f6a.png" /></a>
</p>
<div>
<p style="text-align:justify">
<span> </span><a></a><b><span style="font-size:12pt">Step-5 :- </span></b><span style="font-size:12pt">This step is for, to upload the </span><b><span style="font-size:12pt">GUI-Design </span></b><span style="font-size:12pt">in the display.For this first connect the display with power supply of 9-12 volt through power port. And then connect USB to USB to your PC with Display. It will look like this.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.3b49100bedc6dfa6d0d0c85e644f60cb.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.a42133b028a2ec9f5e541e883955725f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a42133b028a2ec9f5e541e883955725f.png" /></a>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
 
</td>
</tr>
</tbody>
</table>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After connected the display now first we have to download the </span><b><span style="font-size:12pt">‘Default’ </span></b><span style="font-size:12pt">folder through GUI-Tool. For this go to at </span><b><span style="font-size:12pt">Debug </span></b><span style="font-size:12pt">and <span> </span>click on </span><b><span style="font-size:12pt">Download </span></b><span style="font-size:12pt">then select the location where you want to download it.</span>
</p>
<br />
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b9b0222f410ff77653b234d4d5c63b66.png" data-fileext="png"><img data-ratio="56.00" width="1000" alt="image.thumb.png.a4ecd8462979f6ea74eff7caac21bd8b.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.a4ecd8462979f6ea74eff7caac21bd8b.png" /></a><span style="font-size:14.5pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Now we have </span><b><span style="font-size:12pt">Default </span></b><span style="font-size:12pt">folder in our local machine will upload in the Display memory, for this first connect the display as mentioned above in the image through USB to USB communication with your PC. You will get a storage device in your PC there you have to delete first previous </span><b><span style="font-size:12pt">Default </span></b><span style="font-size:12pt">folder as mentioned in below image.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.f50bf83cd1754f019566cb9217019d25.png" data-fileext="png"><img data-ratio="52.70" width="1000" alt="image.thumb.png.451f9a3838f692e70340875bafe746ee.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.451f9a3838f692e70340875bafe746ee.png" /></a>
</p>
 
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After that you can paste that folder here which we have copied from GUI design. As you can see in the below image.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.646418487f787f44243a33db5b8c59d6.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.1b6804c19de31fc1924d856b2dc3cd20.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.1b6804c19de31fc1924d856b2dc3cd20.png" /></a>
</p>
<br />
<span style="font-size:10.5pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">After pasted the default folder in display storage, just remove USB from Display and also remove the power supply, and after 2-3 sec just connect the power supply again to the display. Then you will get like this GUI which we have designed.</span>
</p>
<p>
<span style="font-size:12pt;text-align:justify;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'">Now we have done with GUI design and uploading part , so its time to go through code and its working.</span><span style="font-size:10pt;text-align:justify;font-family:'-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"> </span>
</p>
<p>
<span style="font-size:10pt"> </span><a href="/assets/uploads-legacy/monthly_2023_06/image.png.710b807355512f04e5b9cad2dece95f3.png" data-fileext="png"><img data-ratio="52.90" width="1000" alt="image.thumb.png.659d32591fb196a3c039a9c8c37e76b6.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.659d32591fb196a3c039a9c8c37e76b6.png" /></a>
</p>
<p>
<span style="font-size:14.5pt"> </span>
</p>
<h1 style="text-align:justify">
<a></a><span style="font-size:14pt"><span>[5]<span> </span></span></span><b><span style="font-size:14pt"><a></a>Working &amp; Raspberry-Pi</span></b><b><span style="font-size:14pt"> </span></b><b><span style="font-size:14pt">Coding</span></b>
</h1>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Now first connect Raspberry-Pi through VNC server or you can connect directly through display as per your convenience. Then there are two codes which are given below. The first one is for testing the all buttons which we have created and second one the Whole code with I/O setup and it has</span><span style="font-size:12pt"> </span><span style="font-size:12pt">logic.</span>
</p>
<h2 style="text-align:justify">
<a></a><b>Testing Code :-</b>
</h2>
<p>
<b><span style="font-size:10pt"> </span></b>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<span></span>
</td>
</tr>
</tbody>
</table>
<b><span style="font-size:9pt"> </span></b>
<p>
<b><span style="font-size:9pt"> </span></b>
</p>
<p style="text-align:center">
<a></a><span style="font-size:12pt">import serial</span>
</p>
<p>
<span style="font-size:12pt"> </span>
</p>
<p>
<a></a><span style="font-size:12pt">serialcomm = serial.Serial('/dev/ttyUSB0', 115200)<a></a> while</span><span style="font-size:12pt"> </span><span style="font-size:12pt">True:</span>
</p>
<p>
<a></a><span style="font-size:12pt">l=serialcomm.read(size=20)<a></a> q=l[7:14]</span>
</p>
<p style="text-align:center">
<a></a><span style="font-size:12pt">Print(q)</span>
</p>
<p>
<span style="font-size:10pt"> </span>
</p>
<table>
<tbody>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<span></span>
</td>
</tr>
</tbody>
</table>
<span style="font-size:9pt"> </span>
</div>
<div>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">Here the purpose of testing code is to check all buttons so for this you need to connect first USB-0 of Raspberry-Pi to you Display TTL connector and then copy this code in </span><b><span style="font-size:12pt">Thonny </span></b><span style="font-size:12pt">of Raspberry-Pi as given in below image and then click on run button to test</span><span style="font-size:12pt"> </span><span style="font-size:12pt">it.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.131fe02a167e30970d0563514d36052f.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.87a530f0891bf132e8df402f6af140d3.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.87a530f0891bf132e8df402f6af140d3.png" /></a><span style="font-size:12pt"> </span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">By click any button which is on display will get a particular button name which we have assigned in the starting as we discussed it earlier. You can see after pressing </span><b><span style="font-size:12pt">Button-1 </span></b><span style="font-size:12pt">on display we are getting output string as </span><b><span style="font-size:12pt">button1 </span></b><span style="font-size:12pt">because we have done the slicing of whole from which we are getting from</span><span style="font-size:12pt"> </span><span style="font-size:12pt">display.</span>
</p>
<p>
<a></a><span style="font-size:12pt">l=serialcomm.read(size=20)</span><span style="font-size:12pt"> <a></a></span><span style="font-size:12pt"> q=l[7:14]</span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt"><a></a>Here as in testing code these line of code, here l is variable which is receiving the frame from display size of 20, and then q is storing the sliced value as per our requirement.</span>
</p>
<p style="text-align:justify">
<a></a><span style="font-size:12pt">And accordingly in complete code we made the logic as per individual button. Below logic is given as button6 will press then it will ON the LED2 high and if button7 will press it will of the LED2 as Off. Similarly all logic are working for others LEDs.</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button6'):</span>
</p>
<p>
<a></a><span style="font-size:12pt"> </span><span style="font-size:12pt"> </span><span style="font-size:12pt">GPIO.output(led2,GPIO.HIGH)</span><span style="font-size:12pt"> </span>
</p>
<p>
<a></a><span style="font-size:12pt">    </span><span style="font-size:12pt">elif(q==b'button7'):</span>
</p>
<p>
<a></a><u><span style="font-size:12pt"> </span></u><u><span style="font-size:12pt"> </span></u><u><span style="font-size:12pt">GPIO.output(led2,GPIO.LOW)</span></u><u><span style="font-size:12pt"> </span></u>
</p>
</div>
<div>
<h2>
<a></a><b>Complete Code :-</b>
</h2>
<p>
<a></a><span style="font-size:12pt">import RPi.GPIO as GPIO<a></a> GPIO.setmode(GPIO.BCM)<a></a> GPIO.setwarnings(False)<a></a> led1 =</span><span style="font-size:12pt"> </span><span style="font-size:12pt">26</span>
</p>
<p>
<a></a><span style="font-size:12pt">led2 =</span><span style="font-size:12pt"> </span><span style="font-size:12pt">19</span>
</p>
<p>
<a></a><span style="font-size:12pt">red_led= 13</span>
</p>
<p>
<a></a><span style="font-size:12pt">green_led= 6</span>
</p>
<p>
<a></a><span style="font-size:12pt">blue_led= 5<a></a> status1=0<a></a> status2=0</span>
</p>
<p>
<a></a><span style="font-size:12pt">GPIO.setup(red_led,GPIO.OUT)<a></a> GPIO.setup(green_led,GPIO.OUT)<a></a> GPIO.setup(blue_led,GPIO.OUT)<a></a> GPIO.setup(led1,GPIO.OUT)<a></a> GPIO.setup(led2,GPIO.OUT)<a></a> GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(green_led,GPIO.LOW)<a></a> GPIO.output(blue_led,GPIO.LOW)<a></a> GPIO.output(led1,GPIO.LOW)<a></a> GPIO.output(led2,GPIO.LOW)<a></a> ######################</span>
</p>
<p>
<a></a><span style="font-size:12pt">import serial</span>
</p>
<p>
<a></a><span style="font-size:12pt">serialcomm = serial.Serial('/dev/ttyUSB0', 115200</span>
</p>
</div>
<div>
<p>
<a></a><span style="font-size:12pt">while True:<a></a> l=serialcomm.read(size=20)<a></a> q=l[7:14]</span>
</p>
<p>
<a></a><span style="font-size:12pt">if(q==b'button1'):<a></a> print(q)</span>
</p>
<p>
<a></a><span style="font-size:12pt">GPIO.output(red_led,GPIO.HIGH)<a></a> </span><span style="font-size:12pt">GPIO.output(green_led,GPIO.LOW)<a></a> </span><span style="font-size:12pt">GPIO.output(blue_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button2'):<a></a> </span><span style="font-size:12pt">GPIO.output(green_led,GPIO.HIGH)<a></a> </span><span style="font-size:12pt">GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(blue_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button3'):<a></a> GPIO.output(blue_led,GPIO.HIGH)<a></a> GPIO.output(red_led,GPIO.LOW)<a></a> GPIO.output(green_led,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button4'):<a></a> GPIO.output(led1,GPIO.HIGH)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button5'):<a></a> </span><span style="font-size:12pt">GPIO.output(led1,GPIO.LOW)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button6'):<a></a> GPIO.output(led2,GPIO.HIGH)</span>
</p>
<p>
<a></a><span style="font-size:12pt">elif(q==b'button7'):<a></a> </span><span style="font-size:12pt">GPIO.output(led2,GPIO.LOW)</span>
</p>
</div>
<p>
<a></a><span style="font-size:12pt">Now we have understand the logic behind the code let’s run the second code that is complete code in Raspberry-Pi but before this make the circuit connection like as given below in the circuit diagram.</span>
</p>
<h2>
<a></a><b><span style="font-size:12pt">Circuit Diagram :-</span></b>
</h2>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.b37654b1e43f49a6d9d8230b8fb36539.png" data-fileext="png"><img data-ratio="54.70" width="1000" alt="image.thumb.png.d72796e8e2fc6401c12ddf851137363f.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.d72796e8e2fc6401c12ddf851137363f.png" /></a>
</p>
<p style="text-align:left">
<a></a><b>Output :-</b>
</p>
<p>
<a></a><span style="font-size:12pt">Now we have completed the whole project and the now you can test you project , the final setup will look like this.</span>
</p>
<p>
<a href="/assets/uploads-legacy/monthly_2023_06/image.png.3b3a5c35dba3a4d3b2079c563ac287d9.png" data-fileext="png"><img data-ratio="53.60" width="1000" alt="image.thumb.png.2b3d9c710b51d9720751cf4d2fac1caa.png" src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.2b3d9c710b51d9720751cf4d2fac1caa.png" /></a>
</p>
<p>
<span style="font-size:14.5pt"> </span>
</p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.e222510a93bb378de3a367c3da658116.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.1ddbb1ab09095e7023030e6666661c52.png" data-ratio="38.5" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.7cd634e259f79ad9d0f17beb0e7fc598.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.3d185041848b583de237c35c48eac346.png" data-ratio="52.9" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.05e69ad98f22f9c87095a970950b8160.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.ed25feed5d1eeff9a9e0480f48359318.png" data-ratio="52.9" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.9ce7e0b44a023654fbaa5d5f394746ab.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.9ed063975201b2176a57e70081db01d2.png" data-ratio="53.3" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.13e62d4daf7c8214f35cddbc779195f7.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.820c56e2e08e4f46454a132e714e1725.png" data-ratio="53.3" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.f9dfd79656beaab8f7d58fb6d85fcc42.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5c70481c0ae3be021ca3956f7342ebb6.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.bdecc155dd80efb741302ad1a7059468.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.bde3da80a77a1f1d22fcea6e6635d167.png" data-ratio="56" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.0fdac35c35eae905d340a77975ac2ca0.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.5c7e44b7578c503092db819f42601c68.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>
<p><a href="/assets/uploads-legacy/monthly_2023_06/image.png.0ecafa58426debbbe3cbf63dddb16a60.png"><img src="/assets/uploads-legacy/monthly_2023_06/image.thumb.png.acdfac6bc73553c7c2e6d2e4a1a47f88.png" data-ratio="53.6" width="1000" alt="image.png" /></a></p>]]></description><link>https://www.xtremehardware.com/forum//post/559230</link><guid isPermaLink="true">https://www.xtremehardware.com/forum//post/559230</guid><dc:creator><![CDATA[john-B]]></dc:creator><pubDate>Tue, 20 Jun 2023 03:25:38 GMT</pubDate></item></channel></rss>