Professional Documents
Culture Documents
Stone TFT LCD Stm32 Servo Head
Stone TFT LCD Stm32 Servo Head
by greyli1987
This project shows how to use the STONE display, STM32 microcontroller, and a servo head. The goal of the project is to
be able to control the servo head via the STONE display.
Core: ARM 32-bit Cortex™-M3 CPU - 32kHz RTC oscillator with calibration
- Embedded factory-tuned 8MHz RC oscillator - 26/37/51/80 I/O ports, all I/O ports can be imaged to 16
external interrupts; almost all ports tolerate 5V signals
- Embedded 40kHz RC oscillator with calibration
8-inch Smart TFT-LCD (Thin Film Transistor - Liquid construction machinery and vehicle equipment,
Crystal Display) Industrial Display Module electronic instruments, industrial control systems, power
industry, civil electronic equipment, automation
STONE STVC080WT-01 equipment, transportation equipment, etc.
Product advantages
The smart TFT LCD module with Cortex-M4 32-bit CPU
can be controlled by any MCU through the UART port
with simple hexagonal commands. 1. Touch terminal, thin- lm transistor LCD system.
STONE provides engineers with TOOLBOX software to 2. Any microcontroller can be controlled by a simple
easily and intuitively set up various functions on the GUI instruction set.
such as text, numbers, curves, image switching,
keyboard, progress bar, sliders, dialing, clock and touch 3. Cost-e ective HMI (Human Machine Touch Terminal).
buttons, data storage, USB download, video, and audio.
Operation steps
Engineers can easily adopt the TFT-LCD color user
interface and touch functionality on a variety of 1. Design a set of custom user interfaces.
industrial devices while reducing signi cant
development time and costs. 2. Connect the device to the TFT-LCD module via
RS232/RS485/TTL serial port.
Easy to use:
3. Write a control program in any microcontroller
1. Design a beautiful "graphical user interface" and set containing the instruction set to control the TFT-LCD
up various application functions on the GUI using our module (included in the product).
toolbox software.
Auxiliary Software
2. Connect directly to customer MCUs via RS232, RS485,
or TTL level, plug and play. 3. We provide three software programs to help the
operation of the TFT-LCD module.
3. Write an MCU program to control the TFT LCD module
using 4 simple hex commands. 1. Assistant software: Used to upload pictures, les, and
demo instruction sets.
For example, the image switches command:
2. Touch Control Software: for generating touch control
Send "0xA5 0x5A 0x04 0x80 0x03 0x00 0x01" to display les.
image-01
3. Font software: for generating font les.
0xA50x5A: frame title of each command
Working Principle
0x04: Data length
With the existing command set provided by the product,
0x80: Write registration instructions this TFT-LCD module can generate command
transmission and recognition using the master
0x03: Image switch instruction controller. The master controller receives commands
from the TFT-LCD module to operate the industrial
0x000x01: Image_ID, the serial number of the image device.
No-load speed:0.12sec/60degree(4.8V)
Torque:1.2 - -1.4kg/cm(4.8 v)
High-quality SG90 micro servo.
Operating temperature:-30 ~ 60°C
Can meet the needs of many RC robots, RC planes, RC
helicopters, RC boats. Deadband width:7usec
Operating voltage:4.8 v-6v Each servo size:3 * 3 * 1.1cm / 1.2 * 1.2 * 0.4in
Model:SG90
void USART1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_1;
GPIO_Init(GPIOA, &GPIO_InitStructure);
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_Init(USART1,&USART_InitStructure);
USART_Cmd(USART1,ENABLE);
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/************************************************
Parameter None
Author strongerHuang
*************************************************/
uint8_t reData[9],reDndex=0,reflag=0;
void USART1_IRQHandler(void)
USART_ClearITPendingBit(USART1,USART_IT_RXNE);
reData[reDndex++] = res;
if(reDndex==9)
reDndex=0;
reflag = 1;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2,ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_1;
GPIO_Init(GPIOA, &GPIO_InitStructure);
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_Init(USART2,&USART_InitStructure);
USART_Cmd(USART2,ENABLE);
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/************************************************
Parameter None
Author strongerHuang
*************************************************/
void USART2_IRQHandler(void)
USART_ClearITPendingBit(USART2,USART_IT_RXNE);
void USART3_Init(void)
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_4);
GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_4);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_1;
GPIO_Init(GPIOB, &GPIO_InitStructure);
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_Init(USART3,&USART_InitStructure);
USART_Cmd(USART3,ENABLE);
NVIC_InitStructure.NVIC_IRQChannel = USART3_6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
USART_ClearITPendingBit(USART3,USART_IT_RXNE);
void USART6_Init(void)
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6,ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);
GPIO_PinAFConfig(GPIOA,GPIO_PinSource4,GPIO_AF_5);
GPIO_PinAFConfig(GPIOA,GPIO_PinSource5,GPIO_AF_5);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_1;
GPIO_Init(GPIOA, &GPIO_InitStructure);
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_Init(USART6,&USART_InitStructure);
USART_Cmd(USART6,ENABLE);
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = USART3_6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
USART_ClearITPendingBit(USART6,USART_IT_RXNE);
void USART3_6_IRQHandler(void)
uint8_t res;
USART_ClearITPendingBit(USART6,USART_IT_RXNE);
USART_ClearITPendingBit(USART3,USART_IT_RXNE);
USART_ClearITPendingBit(USART6,USART_IT_ORE);
We just need to connect the STM32 board, the servo head, the display and the power supply. Drag the progress bar at
the top of the STONE display to control the activity of the servo head.