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

Controlling a DC Motor and Displaying Graphs Using a Slider

Controlling a DC Motor and Displaying Graphs Using a Slider

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 combine the functions we have covered so far to create a system that controls the rotation speed of a DC motor using a GT-SP slider. I will explain how to link the slider operation to the motor’s movement and reflect those values on the screen using a graph and text.

Screen Layout for This Project

In this project, we will create the following control panel.

We will place a vertical slider on the right side of the screen, and prominently display the label “FAN SPEED” along with the current value on the left side. Additionally, a horizontal graph (BLOCK STACK) showing the motor’s output transition will be placed at the bottom of the screen.

This design allows you to see the entire control flow: operations on the screen directly translate to the movement of physical parts, and the results are fed back to the screen.

Creating the Screen in GT Design Studio

Using GT Design Studio, we will place the necessary objects for the operation screen.

  • Slider object (Vertical, Setting range: 0–100)
  • Graph object (BLOCK STACK, Horizontal)
  • Text object (For label: “FAN SPEED”)
  • Text object (For displaying the slider value)

To send the value to the Arduino when the slider is operated, add “DATA_TX_VAL” to the slider’s event settings, and specify “SLIDER_0 [VAL]” as the value to send. This allows the current slider value to be sent to the Arduino. The slider value will be retrieved every second and drawn on the BLOCK STACK graph.

Furthermore, to make the status easier to grasp, we will incorporate a process in the Arduino program where the colors of the text and graph objects change automatically according to the value. By switching the color to gray, green, yellow, and red based on numerical ranges (such as stopped, low output, and high output), we can achieve an intuitive interface.

Additionally, to improve visibility, the text size of the text object displaying the numerical value is enlarged. For the graph object, we adjusted the angle and hid or removed the color of unnecessary elements like frames.

The angle of the graph object can be set by changing “Chart Angle” under “Style” to “Rotate<1>”.

Hardware Configuration and Wiring

For the physical hardware, we will use a DC motor, a motor driver (L293D), and an external power supply module.

Since the output from the Arduino pins alone does not provide enough power to drive the motor, we need to clearly separate their roles. The Arduino will only send weak power and control signals to the motor driver, while the actual strong power required to rotate the motor will be supplied from the external power supply module.

Picture by [Fritzing (CC BY-SA)]

The specific wiring procedure is as follows. To prevent electric shocks or short circuits, ensure that the Arduino’s USB cable and the external power supply are disconnected before starting the work.

Setting up the power supply module

Insert the power supply module into the breadboard and set the output jumper pins to the 5V side.

Placement of the motor driver (L293D), insert the L293D chip across the center groove of the breadboard. Ensure the side with the semicircular notch faces upward.

Concerning the Power and Ground (GND) wiring, when using separate control and drive power supplies, we will share the GND (the system’s baseline). This is the most crucial point.

  • Connect pin 16 of the L293D to the Arduino’s 5V pin. (Control power)
  • Connect pin 8 of the L293D to the positive side of the power supply module. (Drive power)
  • Connect pins 4, 5, 12, and 13 of the L293D all to the negative side of the breadboard.
  • Connect the Arduino’s GND pin to the negative side of the breadboard to make the overall GND common.

Wire the control signal lines by connecting the lines that transmit instructions from the Arduino to the DC motor.

  • Connect the Arduino’s pin 9 to the L293D’s pin 1. (Speed adjustment)
  • Connect the Arduino’s pin 8 to the L293D’s pin 2. (Rotation direction)
  • Connect the Arduino’s pin 10 to the L293D’s pin 7. (Rotation direction)

DC motor connection. Finally, connect the two wires from the DC motor to pins 3 and 6 of the L293D, respectively.

By properly separating the power supply systems in this way, you can drive the DC motor stably without putting excessive load on the Arduino.

Arduino Program

We will create a program to link the operations on the GT-SP with the movement of the DC motor. The main processing steps are as follows:

  1. Read the GT-SP slider value (0–100) and convert it to the DC motor’s rotation speed for control.
  2. Update the slider value on the screen.
  3. Send a command to change the text color of the text object based on the numerical range.
  4. Send the latest value every 1 second to update the BLOCK STACK graph.
  5. Send a command to change the graph color based on the numerical range.

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

 

Summary

In this article, we introduced how to control a DC motor using multiple objects, such as a slider, a graph, and text. By combining the basic operations we’ve accumulated so far, it’s possible to realize practical interfaces and hardware integration.

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

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