STONE TFT LCD Module Acceleration Gyroscope Sensor

TFT LCD Module Acceleration Gyroscope Sensor for the operation effect:

STONE TFT LCD Module Acceleration Gyroscope Sensor

Introduction to display screen

This document will teach you how to use an STM32 MCU +MPU6050 accelerometer gyroscope sensor +STONE STVC070WT-01 serial port display for a DEMO.

STVC070WT-01 is the serial display of our company, its development is simple, easy to use, you can go to the website of our company for all display difference.

It is worth noting that our screen supports serial port communication. Some models support TTL/RS232/RS485, but some only support RS232. If your MCU’s serial port is TTL logic level, you need to add a MAX3232 for level conversion. If you want to know which screen supports TTL and which supports both TTL and RS232, you can check it out on our website

That “industrial type” and “advanced type” screens generally only support RS232 or RS485, and only “civilian type” screens can support TTL/RS232/RS485.

If you choose the “advanced type” or “industrial type“, but your SCM only supports TTL, then you need to do the following conversion:

STONE TFT LCD Module Acceleration Gyroscope Sensor

Other relevant information can be viewed or downloaded on the official website:

Three steps of STONE display screen development

Design the display logic and button logic with STONETOOLsoftware, and download the design file to the display module.
The MCU communicates with the STONE display module through a serial port.
With the data obtained in step 2, the MCU does other actions.

Project introduction

What I’m going to show you today is a Demo of gravity, gyroscope, Euler Angle,

Functions are as follows:

Three text boxes display acceleration values
Three text boxes display gyroscope values
Three text boxes display Euler Angle values
A text box displays the current refresh time
Two buttons adjust the refresh time

First, we need to use Photoshop to design two UI interfaces, and the design results are as follows:

STONE TFT LCD Module Acceleration Gyroscope Sensor

STONE TFT LCD Module Acceleration Gyroscope Sensor

The first image is the main screen image, and the second image is the button effect.

Then we open “TOOL2019” and design the effects in the TOOL:

STONE TFT LCD Module Acceleration Gyroscope Sensor

Two main components are used:

Numerical display unit

Incremental button

After the design, the simulation operation effect can be seen in the simulation interface:

STONE TFT LCD Module Acceleration Gyroscope Sensor

MPU-6050

STONE TFT LCD Module Acceleration Gyroscope Sensor

The mpu-6050 is the world’s first integrated 6-axis motion processing chip. Compared with the multi-component solution, it eliminates the problem of the difference between the combined gyroscope and the accelerator time axis and reduces a lot of packaging space. When connected to the three-axis magnetometer timing, the mpu-6050 provides a complete 9-axis motion fusion output to the I2C or SPI ports (SPI is only available on the mpu-6000).

Sensing range

The angular velocity sensing range of mpu-6050 is ±250, ±500, ±1000 and ±2000°/ SEC (DPS), which can accurately track fast and slow actions. Moreover, users can program and control the detection range of accelerators to be ±2g, ±4g±8g and ±16g. Product data can be transmitted via IIC up to 400kHz or SPI up to 20MHz (SPI is only available on mpu-6000).Mpu-6050 can work under different voltages, the voltage supply of VDD is 2.5v ±5%, 3.0v ±5% or 3.3v ±5%, and the power supply of logic interface VDDIO is 1.8v ±5% (VDD only is used for MPU6000). The mpu-6050’s packaging size of 4x4x0.9mm(QFN) is revolutionary in the industry. Other features include built-in temperature sensors and oscillators that vary only ±1% in the operating environment.

Application

Mobile sensing games augmented reality, EIS: Electronic Image Stabilization (OIS: Optical Image Stabilization) user interface of pedestrian navigator with “zero-touch” gesture.

Smartphone, tablet device, handheld game product, game console, 3D remote control, portable navigation device, UAV, balance car.

Characteristics

The digital output of 6 – or 9-axis rotation matrix, quaternion, Euler Angle forma fusion calculus data.3-axis angular velocity sensor (gyroscope) with 131 LSBs/°/ SEC sensitivity and full grid sensing range of ±250, ±500, ±1000 and ±2000°/ SEC. It can be controlled by program, and the program control range is ±2g, ±4g, ±8g, and ±16g. Remove the sensitivity between the accelerator and the gyroscope axis and reduce the influence of the Settings and sensor drift. The DMP (Digital Motion Processing) engine reduces the load of complex fusion algorithms, sensor synchronization, postural sensing, etc. The motion processing database supports the operating time deviation and magnetic sensor correction algorithms built-in in Android, Linux, and Windows. Temperature sensor with digital output and digital input Sync pin support video electronic shadow phase stabilization technology and GPS programmable control interrupt support gesture recognition, shake, zoom in and out of the picture, rolling, rapid descent interrupt, high-g interrupt, zero motion sensing, touch sensing, shake sensing.The supply voltage of VDD is 2.5v ±5%, 3.0v ±5% and 3.3v ±5%.The operating current of VDDIO is 1.8v ± 5%: 5mA; Standby current of a gyroscope: 5uA; Accelerator operating current: 350uA, accelerator power-saving mode current: 20uA@10Hz I2C in fast mode up to 400kHz, or SPI serial host interface up to 20MHz built-in frequency generator at full temperature range only ±1% frequency variation. The minimum and thinnest packaging (4x4x0.9mm QFN) tailored for portable products have been tested to meet RoHS and environmental standards.

About the pin

SCL and SDA connect to the IIC interface of MCU, through which MCU controls MPU6050.

There is also an IIC interface, AXCL, and XDA, which can be used to connect external slave devices, such as magnetic sensors, to form a nine-axis sensor.VLOGIC is the voltage of the IO port, and the lowest pin can reach 1.8v. Generally, we can directly use VDD. AD0 is the address control pin from the IIC interface (connected to MCU), which controls the lowest order of the IIC address. If GND is connected, then the IIC address of MPU6050 is 0X68 and 0X69 if VDD is connected. Note: the address here does not contain the lowest order of data transfer (the lowest order is used for reading and writing).

Below is the mpu-6050 module I used:

STONE TFT LCD Module Acceleration Gyroscope Sensor

STM32 microcontroller

STM32F103RCT6 MCU has powerful functions. Here are the basic parameters of the MCU:

Series: STM32F10X
Kernel: ARM – COTEX32
Speed: 72 MHZ
Communication interface: CAN, I2C, IrDA, LIN, SPI, UART/USART, USB
Peripheral equipment: DMA, motor control PWM, PDR, POR, PVD, PWM, temperature sensor, WDT
Program storage capacity: 256KB
Program memory type: FLASH
RAM capacity: 48K
Voltage – power supply (Vcc/Vdd) : 2 V ~ 3.6 V
Oscillator: internal
Operating temperature: -40°C ~ 85°C
Package/housing: 64-lqfp

In this project, I will use UART, GPIO, Watch Dog, and Timer of STM32F103RCT6.

The following is the code development record for the project.

STM32 USES Keil MDK software development, about which you must be familiar, so I will not introduce the installation method of this software.

STM32 can be simulated online through j-link or st-link and other simulation tools. The following picture is the STM32 development board I used:

STONE TFT LCD Module Acceleration Gyroscope Sensor

Add serial driver

STM32F103RCT6 has several serial ports. In this project, I used the serial port channel PA9/PA10, and the serial port baud rate was set at 115200.

The associated serial port initialization code can be seen below:

WatchDog

To prevent the system from crashing while the program was running, I added the watchdog. In fact, all projects that use the MCU generally use a watchdog.

STM32 has two built-in watchdogs, providing greater security, time accuracy, and flexibility. Two watchdog devices (independent watchdog and window watchdog) can be used to detect and resolve faults caused by software errors. When the counter reaches a given timeout value, an interrupt (window watchdog only) or system reset is triggered.

Independent watchdog (IWDG)

Driven by a dedicated low-speed clock (LSI), it works even if the master clock fails.

It is suitable for use in situations where the watchdog is required to work completely independently outside the main program and requires low time accuracy.

Window watchdog (WWDG)

Clock driver obtained from APB1 clock frequency division. Detect abnormal application operations through a configurable time window. Suitable for programs that require watchdogs to function in precise timing Windows.

Because of this DEMO program, I will not add the watchdog function.

MPU-6050 Driver

This code USES the IIC communication mode to read the data of MPU6050, and IIC communication USES software simulation IIC. There are many related codes, so I won’t paste them here.

The following code is the driver for MPU6050:

Main Function

The full code content of the main.c file is as follows:

Main. The c file is mainly divided into the following parts:

Contains header files
Macro define the display address of the display screen
Defines a function that sends acceleration and gyroscope data over a serial port
Define variable values
Initializes the peripheral of STM32
Initialize the MPU – 6050

Code logic of While(1) :

Determine if data from the display is received, and set the refresh time
Determine whether data from mpu-6050 has been obtained. If so, send it to the display through a serial port
Delay 1 millisecond to set the refresh time to use

This program has a function to obtain Euler Angle, just add it to the serial port displayer can be displayed.

In this program, the data displayed is raw data collected from MPU6050.

The connection mode of STM32, MPU6050, and the display screen is as follows:

STONE TFT LCD Module Acceleration Gyroscope Sensor

18-STONE TFT LCD Module Acceleration Gyroscope Sensor (11)

Related posts:

Control WS2812B_RGB Lamp by STONE Display Module
Raspberry PI Pico and STONE Display Dazzling Light Control System
Raspberry Pi GUI using STONE HMI Touch Screen Display Module
By Customer : STONE Intelligent TFT Touch Display Beginners Guide
LCD Display in Snack Vending Machine
The Structure and Display Principle of High Brightness LCD
Automotive Car LCD Screen Project Solutions
STONE Touch Screen+ ESP32 for Massage Chair
Bluetooth communication DEMO: NRF51822 UART communicate with STONE HMI display
STONE STVC070WT-01 HMI Screen+Arduino+Musical Metronome

STONE TFT LCD Module Acceleration Gyroscope Sensor

By hmimcu