LEDs controller using TFT Display(Stone-HMI)


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 .

Component List

[1] STONE-HMI Display [STWI056WT/N-01]

[2] Raspberry-Pi

[3] TTL to USB converter

[4] 9v-12v Power Supply

[5] USB cables

[6] LEDs

GUI Designing

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.

Website Link :- https://www.stoneitech.com/support/download/software

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
red_led= 14
green_led= 15
yellow_led= 18

import serial
serialcomm = serial.Serial('/dev/ttyUSB0', 115200)
while True:  

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:  

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.

Output Video

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.

click here

Leave a Reply

Your email address will not be published. Required fields are marked *