Controlling the lights on the Arduino through STONE LCD
Introduction: This time I will use the stone LCD to control the lights on the Arduino.
Function: Control the lights on the Arduino to light up or turn off through the software interface of the LCD.
Required tools:
1.Arduino uno development board
2.STONE STVI070WT LCD serial display module
Hardware Introduction
STONE STVC070WT-03
TFT LCD display introduction
In this project, I intend to use STONE STVC070WT-03, a TFT LCD display, to display the interface.
This display has an integrated driver chip and a host computer for the user to use. The user only needs to add the designed UI images through the host computer for buttons, text boxes and other logic, and then generate a configuration file to download to the display and run.
STVC070WT-03 This display supports communication with MCU through TTL signal, so we can communicate with Arduino MCU directly.
If you do not understand how to use MAX3232, you can refer to the following pictures:
The official website has detailed information and introduction: https://www.stoneitech.com/
If you need video tutorials and tutorials for use, you can also find them on the official website.
Development Steps
Three steps for STONE display development:
l Design the display logic and button logic with STONE TOOL software and download the design file to the display module.
l The MCU communicates with the STONE LCD display module through the serial port.
l With the data obtained in step 2, the MCU does other actions.
STONE TOOL software installation
Download the latest version of STONE TOOL software from the official website (currently the latest version is TOOL2019), and then install it.
After the software installation is complete, open the software with the following interface.
Click on the "File" button in the upper left corner to create a new project, which we will introduce later.
Arduino
Arduino is an easy-to-use and accessible open-source electronics prototyping platform, which contains a hardware part (various Arduino-compliant development boards) and a software part (the Arduino IDE and related development kits).
The hardware part (or development board) consists of a microcontroller (MCU), flash memory (Flash), and a set of general-purpose input/output interfaces (GPIO), which you can think of as a microcomputer motherboard.
The software part is mainly composed of the Arduino IDE on the PC and the related Board Support Package (BSP) and a rich library of third-party functions. Users can use the Arduino IDE to easily download the BSP and function libraries related to the development board you have and use them to write your programs.
Arduino is an open-source platform, and so far there have been many models and many derivative controllers, including Arduino Uno, Arduino Nano, Arduino Yún, etc. In addition, the Arduino IDE is also available today. In addition, the Arduino IDE now not only supports Arduino series development boards, but also adds support for Intel Galileo, NodeMCU and other popular development boards by introducing BSP.
The copyright of the book is owned by the author. Please contact the author for permission and credit for any form of reproduction.
The Arduino senses the environment through a wide variety of sensors, giving feedback and influencing the environment by controlling lights, motors, and other devices. The micro-controller on the development board can be programmed in the Arduino programming language, compiled to a binary file, and burned into the micro-controller. Programming the Arduino is done through the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino-based projects can contain only Arduino, or Arduino and other software running on the PC, which communicate with each other (e.g., Flash, Processing, MaxMSP).
Development Environment
The development environment for Arduino is the Arduino IDE, which can be downloaded from the Internet.
Visit the Arduino official website for software download at https://www.arduino.cc/en/Main/Software?setlang=cn
After installing the Arduino IDE, the following screen will open the software.
By default, the Arduino IDE has created two functions for us: the setup function and the loop function.
If you don’t understand it, you can go to the web directly to find it.
Arduino TFT LCD Display Project Implementation Process
Hardware Connections
To ensure that the work of writing the code that follows goes smoothly, we must first determine the reliability of the hardware connections.
Only two pieces of hardware were used in this project.
1、 Arduino uno development board
2、 STONE STVC070WT-03 TFT-LCD Display
TFT LCD Display User Interface Design
First of all, we need to design a UI display picture, you can use PhotoShop software to design it, or you can use other graphic design tools to design it, after designing the UI display picture, save the picture as JPG format.
Open STONE TOOL2019 software and create a new project:
Remove the image loaded by default from the new project, and add the UI image we designed.
Add the text display component, design the number of digits and decimal points of the display, and get the location where the text display component is stored in the display.
The result is as follows:
Addresses, keys and values of text display components.
l open : 0020 0001
l close : 0020 0002
Generating Configuration Files
After the above UI design is completed, you can generate the configuration file, and then download the configuration file to the STVI070WT TFT LCD display, this part of the operation is introduced in the STONE development materials.
Then click “Download to u-disk” to download the configuration file to u-disk, and then insert the u-disk into STVC070WT, you can finish the upgrade.
Control Arduino through TFT LCD
First we need to get the address of the component in the STONE TFT LCD display that shows the heart rate and oximetry data.
In my project, the address is as follows.
open component address: 0020
close component address: 0020
The modified code would be as follows:
uint8_t buff[9]={0};
void setup()
{
Serial.begin(115200); //设定的波特率
pinMode(LED_BUILTIN,OUTPUT);
}
void loop()
{
while (Serial.available() > 0)
{
for(uint8_t i=0;i<9;i++)
{
buff[i] =uint8_t(Serial.read());
Serial.write(buff[i]);
delay(2);
}
//digitalWrite(LED_BUILTIN,HIGH);
}
if(buff[8]==1)
{
digitalWrite(LED_BUILTIN,HIGH);
}
else if(buff[8]==2)
{
digitalWrite(LED_BUILTIN,LOW);
}
}