Stone Lcd + Acceleration Gyroscope Sensor

Introduction: Stone Lcd + Acceleration Gyroscope Sensor

About: I am an embedded engineer working in Beijing. I like to share my projects with you.

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

STVC070WT 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 the 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:

We can see 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:

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 STONE TOOL software 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.

Step 2: Project Introduction

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:

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:

Two main components are used:

Numerical display unit

Incremental button

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

Step 3: MPU-6050

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, a portable navigation device, UAV, balance car.


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 a 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 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:

Step 4: 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:

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.

Please contact us if you need a complete code: We will reply to you within 12 hours.

Step 5: MPU-6050 Driver

This code USES 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.

Please contact us if you need a complete code: We will reply to you within 12 hours.

Please see the following picture for the operation effect:

To learn more about the project click here

Be the First to Share


    • Space Contest

      Space Contest
    • Halloween Contest

      Halloween Contest
    • Lamps and Lighting Contest

      Lamps and Lighting Contest