A Design of ZigBee Wireless Communication and Gyroscope Control based on STM32 and uC / OS II System

DOI : 10.17577/IJERTV4IS110366

Download Full-Text PDF Cite this Publication

Text Only Version

A Design of ZigBee Wireless Communication and Gyroscope Control based on STM32 and uC / OS II System

Li Gen

Department of Electronic Engineering, Tianjin University of Technology and Education

Tianjin 300222, China

Zhang Jianmin

Department of Electronic Engineering, Tianjin University of Technology and Education

Tianjin 300222, China

Niu Minghua

Department of Electronic Engineering, Tianjin University of Technology and Education

Tianjin 300222, China

Li Yong

Sichuan University of Science & Engineering Sichuan 643000, China

Abstract In this paper, a control design based on II STM32 system is presented in this paper. It completes two functions: 1, to control the ZigBee module, wireless communication. 2, the gyroscope is controlled, so that it is required to complete the task. The controller core of the whole scheme is the STM32F103VCT6 processor of the company, which uses its high speed data processing capability and rich integrated peripheral interface resources. It is also beneficial to the program design and function expansion of II STM32 system based on II STM32 system. This module can be used as a sub module to the various intelligent control systems, such as the vehicle intelligent driving, vehicle anti collision system, and so on, have great potential value.

Key WordsSTM32F103uC / OS IIIntelligent Control

Gyroscope;ZigBee;

  1. INTRODUCTION

    Stm32 has the advantages of high performance ratio, flexible configuration, low power consumption, which is very popular in the market.

    II uC/OS (Control Operation System Two Micro) is a real- time operating system (RTOS) which can be based on ROM, which can be cut, preemptive, real-time and multi task kernel. It is suitable for many commercial operating systems (), and has been ported to nearly 40 kinds of system. Its main features

    are open source code, code structure clear, clear, detailed notes, the organization is structured, can be transplanted, can be cut, curable. The kernel belongs to the preemptive, can manage up to 60 tasks.

    In summary, this paper uses STM32 and UCOS as the system platform. On this basis, the paper designs the ZigBee wireless communication module and the gyroscope control module, and realizes the hardware circuit design and software design.

  2. THE DESIGN OF SYSTEM NODULES

FUNCTION

  1. Hardware design

    1 Design and implementation of ZigBee wireless communication module

    The power supply of the ZigBee module is connected with the 3.3V of the SPI, and the STM32 peripheral interface is connected with the SPI, and the register mode is configured as the main mode.[1] The transmission rate is changed according to the actual needs of the user.[2] Application interface diagram of NRF wireless module is shown in Fig.1.

    Fig.1. ZIGBEE hardware interface circuit

    ZIGBEE short-range wireless transceiver module have wireless transceiver switching mode, it likes a bridge of information exchange. The speed of based on the STM32 and uC/OS II system automatic control system is very fast. Each frame of data can contain 1 ~ 32Byte of data, data transmission rate is high, the data is large.[3]

    2) Design and implementation of gyroscope module

    The realization of the gyroscope is based on the user's gesture and motion state, the gyroscope sensor collects angle speed change data, after data fusion processing, calculate the direction of gestures, control of the running track of the gyroscope based on uC/OS II system and STM32. In the module, the L3G4200D gyroscope of ST company will be used, SPI / I2C digital output interface, 16 bit rate data output, SPI mode and its communication with STM32 microprocessor, get the current X, Y, Z axis angular velocity. According to the positive and negative direction of the angular velocity, the angular velocity of the gesture can be controlled which based on uC/OS II system and STM32.

    STM32 microprocessor uses the four wire SPI interface mode and l3g4200D to keep in contact, though pull resistor R21 in

    Fig.2. The hardware circuit diagram of the gyroscope body sense operation

    port chip select port, improve the stability of the chip. C29, R22, C30 make up a low pass filter, which is an internal phase- locked loop filter. The typical value of C29 =470nf, C30 = 10nf, R22 = 10K. Using SCK, MISO, CS, MOSI four line mode of STM32 and output two digital lines (interrupt and Dataready), can be configured by the configuration of the internal L3G4200D interrupt mode and interrupt. The gyroscope body sense operation hardware circuit diagram is shown in Fig.2.

  2. Software design

    uC / OS II system initialization. To create task priority, task stack allocation, and the initialization of the list of the operating system before the operation system. Configure the software and hardware environment into the operating system mode, and provide the operating platform for the multi task creation.

    Send the instruction of forward Send the instruction of backward

    Yes

    X angular velocity

    >20

    No

    Yes Yes

    X angular No

    velocity >0

    X angular velocity

    <-20

    Microprocessor read data

    Data stream convert into angular velocity

    No

    No

    Y angular velocity >0

    Y angular velocity

    <-20

    Yes

    Yes

    Y angular velocity

    >20

    Send the instruction of left

    Yes

    Send the instruction of right

    Fig.3. Gyroscope volume flow chart

    1. ZIGBEE wireless module program design

      This system uses the wireless communication module of 2.4G, which has the function of sending and receiving, and the software design is divided into receiving program and sending program. Send and receive procedures node address must be same, ensure the two wireless transmission module can communicate with each other. ZigBee module is configured to register can set the frequency of the RF transmission receiving channel and automatic retransmission mode.[4][5]

    2. Gyroscope body sense program design

The program design of the gyroscope body sense is mainly in data processing. Program can be based on the algorithm to control the automatic control system based on STM32 and uC/OS II system. The idea of this design is that the output data of the gyroscope is positive and negative, and it means that there are two opposite directions. Judge the direction of the data with an algorithm and input data.[6] The design flow chart is shown in Fig.3.

Microprocessor through the SPI communication protocol

to read data from the gyroscope, respectively, X, Z, Y three axis of the value, the actual program did not use the value of Z axis, on the X, Y value to do analysis. The value of Y and X is changed into angular velocity by data conversion, and the direction of rotation is judged by comparing the size of the method. Although there is a big error in this method, the function of the sense of the body can be realized.

REFERENCES

  1. Xu Youchun, Yong Jin Zhang, Wang Xiao, Shu Fei. Based on uC / OS II system STM32 vehicle safety automatic control system research present situation and the development trend. The Sixth China intelligent traffic will, 2011-09-06.

  2. Peng Fei Lei, Hua Dong Sheng, Gao Kan loan, Hu Jianjun, Xiang. Infrared sensor in the STM32 vehicle traffic safety of UC / OS II system based on automatic control system of obstacle avoidance system application [J]. Computer and information technology, 2010-08-15.

  3. F. Akyildiz,W. Su,Y Sankarasubramaniam,E. Cayirci. Wireless sensor networks: a survey[J]. Computer Networks . 2002 (4)

  4. H.B. Kazemian,K. Ouazzane. Neuro-Fuzzy approach to video transmission over ZigBee[J]. Neurocomputing . 2012

  5. Juan Ignacio Huircán,Carlos Muñoz,Héctor Young,Ludwig Von Dossow,Jaime Bustos,Gabriel Vivallo,Marcelo Toneatti. ZigBee-based wireless sensor network localization for cattle monitoring in grazing fields[J]. Computers and Electronics in Agriculture . 2010 (2)

  6. Rui Feng, Jamal Bahari, John Dewey Jones MEMS thermal gyroscope with self-compensation of the linear acceleration effect Sensors & Actuators: A. Physical, 2013, Vol.203

Leave a Reply