Arduino touch screen gui


  • ATFC Capacitive HMI TOUCH SCREEN
  • Touch Screen
  • Arduino Touch Screen Tutorial | TFT LCD
  • How to use STONEtech STVC035WT-01 intelligent TFT LCD module with Arduino
  • Accessories
  • ATFC Capacitive HMI TOUCH SCREEN

    As an Amazon Associate I earn from qualifying purchases. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number Arduino Touch Screen Code As the code is a bit longer and for better understanding I will post the source code of the program in sections with description for each section. And at the end of this article I will post the complete source code. Here I would like to say thanks to him for the incredible work he has done.

    You can download these libraries from his website, RinkyDinkElectronics. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries. Next we need to define the fonts that are coming with the libraries and also define some variables needed for the program. In the setup section we need to initiate the screen and the touch, define the pin modes for the connected sensor, the led and the button, and initially call the drawHomeSreen custom function, which will draw the home screen of the program.

    InitTouch ; myTouch. With the setBackColor function we need to set the background color of the text, black one in our case. Next we will set the color to red and draw the red line below the text. Next is the distance sensor button. First we need to set the color and then using the fillRoundRect function we will draw the rounded rectangle.

    Then we will set the color back to white and using the drawRoundRect function we will draw another rounded rectangle on top of the previous one, but this one will be without a fill so the overall appearance of the button looks like it has a frame.

    On top of the button we will print the text using the big font and the same background color as the fill of the button.

    The same procedure goes for the two other buttons. This function will draw the graphics of the first example. However, the getDistance custom function needs to be called repeatedly in order to print the latest results of the distance measured by the sensor.

    If you need more details how the ultrasonic sensor works you can check my particular tutorial for that. Back in the loop section we can see what happens when we press the select unit buttons as well as the back button. If we press the second button, the drawLedControl custom function will be called only once for drawing the graphic of that example and the setLedColor custom function will be repeatedly called.

    In this function we use the touch screen to set the values of the 3 sliders from 0 to With the if statements we confine the area of each slider and get the X value of the slider. So the values of the X coordinate of each slider are from 38 to pixels and we need to map these values into values from 0 to which will be used as a PWM signal for lighting up the LED. The rest of the code in this custom function is for drawing the sliders.

    Back in the loop section we only have the back button which also turns off the LED when pressed. For more details how this part of the code work you can check my particular tutorial.

    Touch Screen

    Connecting the display to the microcontroller and writing the code to integrate the microcontroller with the display. We will first create the GUI for the project after which we will proceed to write the firmware to interface the microcontroller with the display. For this tutorial, we will go with the second option as it allows more flexibility and gives room for the development of truly beautiful GUIs. The design is quite simple, we illustrate label elements to hold the date, the project title, and the values from the microcontroller.

    The values from the microcontroller include; the status of the connection between the microcontroller and the display, the heart rate, and the oxygen levels. It should be noted that while compatibility with other OS is currently being considered, the current version of the software only supports Windows 8 and 10 operating systems. Follow the steps below to create the GUI.

    If you are using any of the other StoneTech displays, you will need to enter the details of that display instead. Next, on the left side of your screen, you will see the project tree under the project window with its assets. Expand the Picture file, and delete the 0. For every new project, the 0. Next, we need to add the background we designed with photoshop into the picture file.

    This will open a dialog box for you to navigate to where the JPG version of our photoshop images is stored. With that done we are now ready to begin adding the GUI elements. The text display elements are capable of holding texts that can be changed programmatically by updating the data stored in their memory addresses.

    Add text displays on the lines as highlighted in the image below. Next, we set the properties of the text displays especially their memory addresses. The properties of each GUI element will be available on the right-hand side of your PC screen after clicking on the element. Note the memory address down as it will play an important role later. Copy Memory Address 7. With all of these done, we compile the GUI and upload it to the screen.

    Because of the little complexity associated with the second option, we will be going with it. When the upgrade is completed, there will be a prompt sound. With the GUI uploaded to the display, we can now connect the display and other components and write the Arduino code to publish data to it. To make the schematics easier to follow, a pin-to-pin map showing how each of the components connects, one to the other, is provided below.

    With this done we can now proceed to the Arduino code to send commands and data to the LCD. The same holds for GUI Components that are meant to send data to the microcontroller, as the microcontroller has to poll their memory address to obtain information from them.

    As a result of these, we need to obtain the memory address of all the GUI components before proceeding. While mine may be different from yours, the memory address of the text displays is provided below.

    Connection sta : 0x Heart rate : 0x Blood oxygen : 0x With this obtained, we can now proceed to write the code for the project. The Max library can be installed using the Arduino Library Manager or by downloading it from the attached link and installing manually by extracting the file, copying its content and pasting it in the Arduino libraries folder. The software serial library comes pre-installed with the Arduino IDE.

    As usual, I will do a brief explanation and attach the complete version of the code under the download section. We start the code by including the libraries we will use. The Wire. The commands are the same for all the elements with the only difference being the memory address. With this done, we then move to the void setup function. We also initialize hardware serial communication so we can use the serial monitor on the Arduino IDE for debugging purposes.

    If the initialization fails, 0x00 meaning 0 is sent to the display, but if successful, 0x01 meaning 1 is sent to it. With this done, we move to the void loop function.

    If the reporting period has elapsed, it means we need to take new measurements, so we call the pox. These new readings are displayed on the serial monitor and also sent to the display. Place a finger on the Max and after a while, you should see the live pulse rate and oxygen levels appear on the display as shown in the image below.

    As an engineer, the key benefit of the display to me is the ease of use both in the creation of the GUI and also the development of the code to tie it together with a microcontroller. Feel free to reach out to me via the comment section if you have any difficulties with recreating this project.

    Arduino Touch Screen Tutorial | TFT LCD

    This can be very helpful and is a great addition if you have just a few extra physical keys, LEDs, beepers, servos, or rotary encoders to control, or if you want to acquire data from an external sensor! Today, we'll see the "how to" in Nextion code, side by side with the equivalent Arduino code to ease the understanding.

    From the next episode on, we'll see here small demo projects for everything in practice. The Sunday Blog: Graphics programming once more — The moving window technique explained The summary is simple: If you can't find an appropriate component in the Nextion Editor, you have to write it yourself I got much feedback about this in the different Nextion-related groups on Facebook.

    People were amazed, but some didn't understand how I made this work. Thus, I decided to go more into details and do a simple animated FM radio frequency display with still more explanations. At this point, I have to say that I'm very grateful for this kind of feedback! So, let's go:. Next, we need to add the background we designed with photoshop into the picture file. This will open a dialog box for you to navigate to where the JPG version of our photoshop images is stored. With that done we are now ready to begin adding the GUI elements.

    How to use STONEtech STVC035WT-01 intelligent TFT LCD module with Arduino

    The text display elements are capable of holding texts that can be changed programmatically by updating the data stored in their memory addresses. Add text displays on the lines as highlighted in the image below. Next, we set the properties of the text displays especially their memory addresses. The properties of each GUI element will be available on the right-hand side of your PC screen after clicking on the element.

    Accessories

    Note the memory address down as it will play an important role later. Copy Memory Address 7. With all of these done, we compile the GUI and upload it to the screen. Because of the little complexity associated with the second option, we will be going with it. When the upgrade is completed, there will be a prompt sound. With the GUI uploaded to the display, we can now connect the display and other components and write the Arduino code to publish data to it.

    To make the schematics easier to follow, a pin-to-pin map showing how each of the components connects, one to the other, is provided below. With this done we can now proceed to the Arduino code to send commands and data to the LCD.

    Amongst the products, customers can find displays with different diagonals e. Riverdi also offers customised versions of their products and professional technical support. All of the products utilise industrial grade materials and components, thus can be used in both consumer and industrial projects.

    This tool allows users to develop display images that can be compiled for numerous system MCUs, including our own FT90x series.


    Arduino touch screen gui