Series: Using the GT-SP Touch Panel TFT Display with Arduino

UI Control of GT-SP Display Using an Infrared Receiver Module

UI Control of GT-SP Display Using an Infrared Receiver Module

DownloadDownload sample project & program (for GT Design Studio & Arduino)

Hello everyone, I’m @kissaten, a beginner in electronics. In this series, I’m explaining the process of connecting a 7-inch touch display (GT-SP series “GTWV070S3A00P”) to an Arduino and working on various projects.

In this article, we will explain the process of creating an application that controls screen transitions and the backlight brightness of the GT-SP display from a remote control using an infrared receiver module. We will also touch on troubleshooting communication conflicts when handling both infrared signal reception and display control on a single microcontroller, as well as synchronizing states with touch panel operations.

Hardware Connection and Library Preparation

In this project, we will add a commercially available infrared receiver module and an infrared remote control to the Arduino and GT-SP display environment we have built in previous articles.

Hardware Pin Connection

This assumes the Arduino and GT-SP display are already connected via serial communication and control pins. We will connect the infrared module as an addition as follows.

[Arduino Side] [Infrared Module Side]

  • 5V ⇔ VCC
  • GND ⇔ GND
  • Pin 11 Data ⇔ Output

Picture by [FritzingCC BY-SA)]
「KY-022 Infrared Receiver Module Fritzing Part」by [arduinomodules.infoLicense (CC BY-SA 4.0)]

Installing the Library

We will use an external library to analyze the infrared signals. From the Arduino IDE menu, open “Sketch” > “Include Library” > “Manage Libraries…”, and type “IRremote” in the search box. Find the “IRremote” library in the search results and install it.

Measurement and Confirmation of Infrared Codes

The signals transmitted when a remote control button is pressed vary depending on the remote control model. Therefore, you first need to identify the hexadecimal codes assigned to each button on the remote you are using.

Write the following infrared analysis sketch to the Arduino and open the Serial Monitor (38400bps).

 

When you press a button on the remote while pointing it at the receiver in this state, the code will be displayed in the Serial Monitor in a format like “Command: 0x45”.

In this sample, we will build the system by assigning the following codes to each operation based on the measurement results.
POWER Button: 0x45 Rewind (Move Left) Button: 0x44 Fast Forward (Move Right) Button: 0x43 Play (Select) Button: 0x40 VOL+ Button: 0x46 VOL- Button: 0x15 0 Button: 0x16

Application UI Design

Using GT Design Studio, we will create three screens with different purposes and assign remote control operations to each.

Page 0: HOME

A selection screen with a side-by-side menu and a cursor. Use the left and right buttons on the remote to move the cursor, and the select button to transition to the corresponding page.

Page 1: SETTING

A display brightness adjustment screen using a separate bar graph (Property ID: 0x40). The brightness can be adjusted in approximately 20% increments using the VOL+ and VOL- buttons.

Page 2: ABOUT

An explanation screen showing the system configuration, etc.

As a common operation across all screens, pressing the 0 button returns to the HOME screen, and the POWER button toggles the display on and off.

Bidirectional Synchronization with the Touch Panel

If page transitions or brightness adjustments are made via touch panel operations rather than the remote control, inconsistencies easily occur between the state variables held by the Arduino and the actual screen state.

To solve this, we set a single-character serial transmission in the touch action properties for each button in GT Design Studio as follows.

  • When HOME button is pressed: h
  • When SETTING button is pressed: s
  • When ABOUT button is pressed: a
  • When VOL+ button is pressed: u
  • When VOL- button is pressed: d

By having the Arduino receive these characters and update its internal variables, we achieve state synchronization between the remote control and the touch panel at a practically problem-free level, even if it is not a completely simultaneous operation.

The image above is an example of the event when the SETTING button is pressed. It sets an event that uses DATA_TX_FIX to send “s” to the Arduino and an event to jump to the SETTING page.

The image above is an example of the event when the VOL+ button is pressed. It is an event that sends “u” to the Arduino using DATA_TX_FIX. The program receives this and increases the screen brightness.

Arduino Program

This is the source code for Arduino that implements the specifications and countermeasures mentioned above. The dedicated functions for GT-SP are placed according to the specifications, and the infrared reception processing and serial reception processing are branched within the main loop.

DownloadDownload sample project & program (for GT Design Studio & Arduino)

Mechanism of Cursor Movement

Let’s explain the operation when the left or right buttons on the remote control are pressed on the HOME screen.

Here, we use the “gtsp_ObjPrpSet_val” function to directly overwrite the X coordinate of the cursor on the screen (Object No. 3 in this case) from the Arduino.

If the left button is pressed, the X coordinate is set to 250, and if the right button is pressed, the value is set to 530. After overwriting the values, the “gtsp_PgControl” function is used to reload the page and update the screen display.

Synchronization of Display Brightness and Graph

Let’s explain the operation when the VOL+ and VOL- buttons are pressed on the SETTING screen.
Here, the “update_brightness” function is used to perform addition or subtraction on the current brightness in increments of about 20%.

The calculated brightness value (0-255) is passed to the “set_gtsp_brightness” function, and from there it reaches the display unit as the “0x58” backlight control command to change the actual brightness.

Simultaneously, the program recalculates the “What is the current brightness %?” for UI display, sends it to the graph (Object No. 8) with the “gtsp_ObjPrpSet_val” function, and rewrites the text (Object No. 9) display using the “gtsp_ObjPrpSet_string” function.

Summary

In this article, we explained the method of controlling the UI of the GT-SP display from a remote control using an Arduino and an infrared receiver module.

Communication conflict issues, which are often overlooked when linking different devices, can be avoided by reviewing the processing order on the microcontroller side. Furthermore, in systems with multiple input methods like a touch panel and a physical remote control, a design that properly centralizes state variables on the microcontroller side and synchronizes them with the display side is the key to stable operation.

If you apply this mechanism, the applications of the display will expand even further, not only for remote screen operation but also for automatic control linked with various sensors. Please try incorporating it into your actual projects.

Series: Using the GT-SP Touch Panel TFT Display with Arduino

Series: Using the GT-SP Touch Panel TFT Display with Arduino