STONE TFT LCD + STM32 + Servo Head

by greyli1987 in Circuits > Electronics

523 Views, 2 Favorites, 0 Comments

STONE TFT LCD + STM32 + Servo Head

图片25.png

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.

The hardware component uses a total of 3 hardware modules.

STM32F030 Minimal Version

图片23.png

Product Description


Core: ARM 32-bit Cortex™-M3 CPU

- Up to 72MHz operating frequency, up to 1.25DMips/MHz at 0 wait cycle of memory up to 1.25DMips/MHz at 0 wait cycle access of memory (Dhrystone 2.1)

- Single-cycle multiplication and hardware division

Memory

- Flash program memory from 64Kor 128K bytes

- Up to 20K bytes of SRAM Clock, reset, and power management

- 2.0 to the 3.6-volt power supply and I/O pins

- Power-on/power-off reset (POR/PDR), programmable voltage monitor (PVD)

- 4 to 16 MHz crystal oscillator

- Embedded factory-tuned 8MHz RC oscillator

- Embedded 40kHz RC oscillator with calibration

- PLL for CPU clock generation

- 32kHz RTC oscillator with calibration

Low power consumption

- Sleep, shutdown, and standby modes

- VBAT power supply for RTC and backup registers Two 12-bit analog-to-digital converters, 1μs conversion time (up to 16 input channels)

- Conversion range: 0 to 3.6V

- Dual sample and hold function

- Temperature sensor

DMA

- 7-channel DMA controller

- Peripherals supported: Timer, ADC, SPI, I2C, and USART Up to 80 fast I/O ports

- 26/37/51/80 I/O ports, all I/O ports can be imaged to 16 external interrupts; almost all ports tolerate 5V signals

STONE STVC080WT-01 LCD Display

图片24.png

8-inch Smart TFT-LCD (Thin Film Transistor - Liquid Crystal Display) Industrial Display Module

STONE STVC080WT-01


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.

STONE provides engineers with TOOLBOX software to easily and intuitively set up various functions on the GUI such as text, numbers, curves, image switching, keyboard, progress bar, sliders, dialing, clock and touch buttons, data storage, USB download, video, and audio.

Engineers can easily adopt the TFT-LCD color user interface and touch functionality on a variety of industrial devices while reducing significant development time and costs.

Easy to use:

1. Design a beautiful "graphical user interface" and set up various application functions on the GUI using our toolbox software.

2. Connect directly to customer MCUs via RS232, RS485, or TTL level, plug and play. 3.

3. Write an MCU program to control the TFT LCD module using 4 simple hex commands.

For example, the image switches command:

Send "0xA5 0x5A 0x04 0x80 0x03 0x00 0x01" to display image-01

0xA50x5A: frame title of each command

0x04: Data length

0x80: Write registration instructions

0x03: Image switch instruction

0x000x01: Image_ID, the serial number of the image storage location

Application areas: medical beauty equipment, construction machinery and vehicle equipment, electronic instruments, industrial control systems, power industry, civil electronic equipment, automation equipment, transportation equipment, etc.

Product advantages


1. Touch terminal, thin-film transistor LCD system.

2. Any microcontroller can be controlled by a simple instruction set.

3. Cost-effective HMI (Human Machine Touch Terminal).

Operation steps

1. Design a set of custom user interfaces.

2. Connect the device to the TFT-LCD module via RS232/RS485/TTL serial port.

3. Write a control program in any microcontroller containing the instruction set to control the TFT-LCD module (included in the product).

Auxiliary Software

We provide three software programs to help the operation of the TFT-LCD module.

1. Assistant software: Used to upload pictures, files, and demo instruction sets.

2. Touch Control Software: for generating touch control files.

3. Font software: for generating font files.

Working Principle

With the existing command set provided by the product, this TFT-LCD module can generate command transmission and recognition using the master controller. The master controller receives commands from the TFT-LCD module to operate the industrial device.

Note: The engineer can use any microcontroller to design the master controller.

Servo Head

图片25.png
图片26.png

Features:


High-quality SG90 micro servo.

Can meet the needs of many RC robots, RC planes, RC helicopters, RC boats.

Operating voltage:4.8 v-6v

Torque:1.2 - -1.4kg/cm(4.8 v).

No-load speed:0.12 sec/60 degree(4.8v).

Specification:

Material:Plastic

Model:SG90

Operating voltage:4.8 v-6v

No-load speed:0.12sec/60degree(4.8V)

Torque:1.2 - -1.4kg/cm(4.8 v)

Operating temperature:-30 ~ 60°C

Deadband width:7usec

Each servo size:3 * 3 * 1.1cm / 1.2 * 1.2 * 0.4in

Connector wire length:15cm / 5.9in

Weight per servo:9g / 0.3oz

Package size:13 * 9 * 3cm / 5.1 * 3.5 * 1.2in

Package weight:65g / 2.3oz

Serial Port Program

void USART1_Init(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);

/* Connect GPIOs to USART1 RX&TX */

GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1); //Tx

GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_1); //Rx

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //USART1_TX | USART1_RX

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_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;

USART_Init(USART1,&USART_InitStructure);

USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

USART_Cmd(USART1,ENABLE);

NVIC_InitTypeDef NVIC_InitStructure;

/*****USART1 interrupt Config****/

NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

}

/************************************************

Function name : USART1_IRQHandler

Function: USART1 interrupt

Parameter : None

Return value : None

Author : strongerHuang

*************************************************/

uint8_t reData[9],reDndex=0,reflag=0;

void USART1_IRQHandler(void)

{

if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //Receiving interruptions

{

USART_ClearITPendingBit(USART1,USART_IT_RXNE);

uint8_t res=USART_ReceiveData(USART1);//(USART1->DR); //Read incoming data

reData[reDndex++] = res;

if(reDndex==9)

{

reDndex=0;

reflag = 1;

}

}

}

void USART2_Init(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2,ENABLE);

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);

/* Connect GPIOs to USART1 RX&TX */

GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_1); //Tx

GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_1); //Rx

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; //USART1_TX | USART1_RX

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_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;

USART_Init(USART2,&USART_InitStructure);

USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);

USART_Cmd(USART2,ENABLE);

NVIC_InitTypeDef NVIC_InitStructure;

/*****USART1 interrupt Config****/

NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

}

/************************************************

Function name : USART1_IRQHandler

Function: USART1 interrupt

Parameter : None

Return value : None

Author : strongerHuang

*************************************************/

void USART2_IRQHandler(void)

{

if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) //Receiving interruptions

{

USART_ClearITPendingBit(USART2,USART_IT_RXNE);

uint8_t res=USART_ReceiveData(USART2);//(USART1->DR); //Read incoming data

}

}

void USART3_Init(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);

/* Connect GPIOs to USART6 RX&TX */

GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_4);

GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_4);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11;

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_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;

USART_Init(USART3,&USART_InitStructure);

USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);

USART_Cmd(USART3,ENABLE);

NVIC_InitTypeDef NVIC_InitStructure;

/*****USART1 interrupt Config****/

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);

USART_ITConfig(USART3, USART_IT_ORE, ENABLE); // Open interrupt

}

void USART6_Init(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6,ENABLE);

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);

/* Connect GPIOs to USART6 RX&TX */

GPIO_PinAFConfig(GPIOA,GPIO_PinSource4,GPIO_AF_5);

GPIO_PinAFConfig(GPIOA,GPIO_PinSource5,GPIO_AF_5);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_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_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;

USART_Init(USART6,&USART_InitStructure);

USART_Cmd(USART6,ENABLE);

NVIC_InitTypeDef NVIC_InitStructure;

/*****USART1 interrupt Config****/

NVIC_InitStructure.NVIC_IRQChannel = USART3_6_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

USART_ClearITPendingBit(USART6,USART_IT_RXNE);

USART_ITConfig(USART6, USART_IT_ORE, ENABLE); // Open interrupt

}

void USART3_6_IRQHandler(void)

{

uint8_t res;

if( USART_GetITStatus(USART6,USART_IT_RXNE) != RESET )

{

USART_ClearITPendingBit(USART6,USART_IT_RXNE);

res=USART_ReceiveData(USART6);//(USART1->DR); //Read incoming data

}

else if( USART_GetITStatus(USART3,USART_IT_RXNE) != RESET )

{

USART_ClearITPendingBit(USART3,USART_IT_RXNE);

res=USART_ReceiveData(USART3);//(USART1->DR); //Read incoming data

}

else if(USART_GetITStatus(USART6, USART_IT_ORE) == SET) //Receiving interruptions

{

USART_ClearITPendingBit(USART6,USART_IT_ORE);

}

}

GUI Using Tool Software 4.3 Tool Editing Page

图片27.png

Import the prepared jpg image into the software

STONE TFT LCD + STM32 + Servo Head Effect Picture

图片28.png

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.