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

Displaying Real-Time Graphs from Temperature Sensor Data

Displaying Real-Time Graphs from Temperature Sensor Data

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 read temperature values from a DHT11 sensor at fixed intervals and plot them sequentially on a line graph using the GT-SP display. When the graph reaches 20 data points, the oldest data shifts to the left. The latest temperature value will also be displayed using a text object on the right side.

 

This time, the received sensor data will be shown as a graph on the left and as a numeric value on the right.

Graph Settings

 

First, place a Graph Object. We will use a polyline graph for this example.

  • Style > Graph Type: POLYLINE<96>

Next, set the number of data points to be displayed.

  • Setting > Data Count: 20 (default value)

Define the display range for the graph.

For line graphs, both minimum and maximum values can be set.

  • Setting > Min Range: 40
  • Setting > Max Range: 100 (default value)

Set the graph position and size.

  • General > Position X: 0
  • General > Position Y: 0
  • General > Size X: 480
  • General > Size Y: 480

Adjust the graph’s style.

  • Style > Chart Frame Type: None
  • Style > Chart Horizontal Margin: 42
  • Style > Chart Vertical Margin: 42

Customize the graph data line style.

  • Style Graph > Lane-0 Maker Type: Dot<3>

Set the background image for the graph.

  • Image > Background Image0: Select the prepared image from the dialog.

When creating a background image, make sure that the minimum and maximum values and the margins match the settings.

Checking the Graph Display

To preview the appearance, enter test data in Data > Lane-0 Data.

Use comma-separated values. For example:

 

Text Settings

To display the latest temperature, place a Text Object.

  • Enter sample text for layout purposes.

Font Settings

Use the following outline font for text display: 

Font: Orbitron https://fonts.google.com/specimen/

    For how to set up fonts, refer to the previous article:

    Embedding Outline Fonts and Using the Draw Shape Tool

    In this example, the font size is 72pt (82) and the color is green (#00DF00).

    Displaying Temperature Unit with Image

    Add an Image Object below the text object to show the temperature unit (°F).

    • Since the Orbitron font doesn’t include the Fahrenheit symbol, we use an image as a substitute.

    Overall Page Settings

    Set the background color of PAGE_0 to black.

    • PAGE_0 > Back Color: #000000

    Connecting the DHT11 Sensor

    The DHT11 used in this example is a modular type sensor. It has three pins: GND, 5V, and DATA, which should be connected to the Arduino accordingly.
    In this setup, the DATA pin is connected to Digital Pin 10 on the Arduino. However, depending on the DHT11 module you have, the pin order may differ, so please check the pin layout before wiring.

    The connection between the GT-SP module and the Arduino is omitted here to keep things simple.
    If you need detailed wiring information, please refer to the previous articles.

    Picture by [Fritzing (CC BY-SA)]

    Arduino Program

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

    About the Function gtsp_ObjPrpSet_Graphval

    In this example, a new function is introduced to send graph data using an array.

    • Unlike previous examples where values were sent as strings, the graph now receives 2-byte numerical data instead.

    • In this article, the graph values are stored in an array and then sent to the GT-SP all at once through the function.

    • When a graph value is set to 0x8000, it will not be plotted on the graph.

      This value represents an unused slot. Therefore, when initializing the array, 0x8000 should be assigned to all elements to indicate that they are empty.

     

    Data Acquisition Interval

    In this sample, temperature data is read every 2 seconds. You can change the delay() value to adjust the update rate.

    Summary

    In this example, we displayed real-time temperature data from the DHT11 sensor on the GT-SP series display as both a line graph and a text value. By combining visual and numerical representations, it becomes easier to monitor environmental changes in real time.

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

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