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. Visit Here .
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 STWI056WT/N-01 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 .
 STONE-HMI Display [STWI056WT/N-01]
 TTL to USB converter
 9v-12v Power Supply
 USB cables
Let’s start first with interface designing but before that you have to install Stone Designer and the Driver for USB so let see how to install these software.
Step-1 :- Go to this website and download these software and then install them in your computer.
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.
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 640X480 size display , and select project path also after done with filling all the details click on ‘Create’ .
After done with above part select the background image for the project for this follow steps as shown in the figure.
step-1 :- Select ‘image’ from Resources to upload the image.
Step-2:- Click on Add button to add a new image in it , so I added an image as you can see in the above image as name ‘background’.
Step-3:- Note down that image name for further steps.
Step-4:- Now drag image widget from top and put it in the edit section.
Step-5:- Now go to at properties and select image as ‘1’ and click on enter.
After done with this ,drag buttons for every LEDs and set on respective position then compile the design by click on compile button. Now plug USB with your PC and copy that ‘default’ folder in memory of Display. So now let’s move further to understand how code is working.
Working & Raspberry-Pi coding
Code:- Let’s first understand how code is working ?
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) red_led= 14 green_led= 15 yellow_led= 18 GPIO.setup(red_led,GPIO.OUT) GPIO.setup(green_led,GPIO.OUT) GPIO.setup(yellow_led,GPIO.OUT) GPIO.output(red_led,GPIO.HIGH) GPIO.output(green_led,GPIO.LOW) GPIO.output(yellow_led,GPIO.HIGH) ###################### import serial serialcomm = serial.Serial('/dev/ttyUSB0', 115200) while True: l=serialcomm.read(size=20) q=l[19:20] r=q if(r==116): GPIO.output(red_led,GPIO.HIGH) elif(r==117): GPIO.output(red_led,GPIO.LOW) elif(r==73): GPIO.output(green_led,GPIO.HIGH) elif(r==72): GPIO.output(green_led,GPIO.LOW) elif(r==13): GPIO.output(yellow_led,GPIO.HIGH) elif(r==12): GPIO.output(yellow_led,GPIO.LOW)
Below part of code is responsible for data receiving from Display .Here serialcomm.read(size=20) will receive 20 bytes of data at once and here information present in the last byte so here that is why I am taking only last byte in the next link of code and this byte is store in the q variable and now it is in character data type but we want in the integer type to process so that is why I have converted into int and this integer holding by variable r.
while True: l=serialcomm.read(size=20) q=l[19:20] r=q
And here we are getting different-different number for each button when the pressed. You can see output for each button given in the below image.
Now connect Raspberry -Pi through vnc server and paste that code which is given above and it will look like this as given in below image.
Before run this code first connect display USB to Raspberry-Pi as you can see in the above image it is usb0 which is connect to display in your case it may be different.
Now before run the code connect the circuit as per the circuit diagram.
After connection now everything is ready now you can run the code , by click on Run button. We have we have completed with this project let’s see the output video, find video below.
Thankyou so much to read the article till now there is YouTube video on this project so please go through that video to understand the whole procedure in a better manner there is link for video go and check it out.