Design of EMS LCD touch screen based on single chip microcomputer

Publisher:温馨幸福Latest update time:2014-02-19 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

  Electric vehicles have always been a focus of attention for their cleanliness and environmental protection. With the intensification of the energy crisis and the continuous rise in oil prices, electric vehicles are becoming more and more popular among users. Electric vehicles are generally powered by lithium batteries, which are composed of multiple single cells connected in series to form a battery pack as a power source. However, since the characteristics of each series-connected single cell cannot be guaranteed to be completely consistent, the charging and discharging speeds will be different under the same current. If no balancing intervention is performed, the battery life will be greatly shortened. Therefore, it is necessary to monitor the status, total voltage, and total current of each single cell in real time, and balance the battery charge and discharge in time according to the status. When balancing charge and discharge, the balancing status must also be detected in real time, so there is an electric vehicle battery energy management system (EMS). Practice has proved that EMS can effectively extend the service life of electric vehicle batteries and is a very important management system in electric vehicles.

  EMS mainly includes: information collection module, charge and discharge balancing module, information centralized processing module and display module.

  Figure 1 is a structural diagram of the independently developed electric vehicle battery energy management system (EMS), in which the information acquisition module is mainly used to collect the voltage, temperature, current and other status of the battery pack and single battery in real time. While monitoring the battery in real time, it also provides a basis for opening and closing the balancing module.

Figure 1 EMS structure diagram

  Figure 1 EMS structure diagram

  The balancing module is mainly used to compensate for differences in battery characteristics, determine the battery status based on the information collected by the acquisition module, and balance the charge and discharge of a single battery to achieve consistent status characteristics.

  The information centralized processing module is responsible for processing, analyzing, and calculating the collected data (such as SOC, etc.), monitoring and controlling the work of the equalization module, and communicating with the display module, playing a connecting role in the entire system.

  As the only human-machine interaction interface, the display module is not only responsible for displaying all data and equipment status to users in real time, allowing users to intuitively see the battery status and EMS working effect, but also provides an interface for users to control and communicate with EMS, allowing users to set parameters and change the working status of EMS to achieve the purpose of real-time supervision and control. Without the display module, people cannot see the information of the battery and EMS, and the alarm or prompt information of EMS cannot be notified to customers. Some alarm states cannot be handled in time, which may cause battery damage at the least, or even cause the electric vehicle to lose control and cause serious accidents. Similarly, customers cannot adjust and control EMS according to the situation, nor can they fully play the role of EMS. It can be seen that the human-machine interaction function of the display module is an indispensable part of EMS. From the functions required by the display module, the touch screen is a good choice.

  However, if you buy a touch screen on the market, not only will the display content be limited by the fixed display function of the touch screen itself, which will reduce the flexibility of the display design and affect the display quality, but the price of touch screens on the market is also generally high, which adds a large part of the cost to the product, which will undoubtedly greatly reduce the market competitiveness of the product. Based on this situation, this paper proposes a relatively general LCD touch screen design with the STM32F103 microcontroller as the control core.

  1 Types and working principles of touch screens

  There are many types of touch screens, which can be divided into resistive, capacitive, infrared, surface acoustic wave, vector pressure sensor, etc. Among them, resistive touch screens are the most commonly used.

  The touch screen system generally consists of two parts: the touch screen controller and the touch detection device. Among them, the main function of the touch screen controller is to receive touch information from the touch point detection device, convert it into touch point coordinates, and then send it to the microcontroller. It can also receive commands from the microcontroller and execute them. The touch detection device is generally installed at the front end of the display. Its main function is to detect the user's touch position and transmit it to the touch screen controller.

  The basic principle of the touch screen is that when you touch the touch screen installed on the front of the display with your finger or other object, the touched position (in the form of coordinates) is detected by the touch screen controller and sent to the microcontroller through the interface to determine the input information. The method for obtaining the touch point coordinates is as follows: as shown in Figure 2, when a positive voltage V is added to the X+ of the touch screen and X- is grounded, a uniform voltage gradient will be formed in the X+, X- directions. When the screen is touched, the X coordinate of the touch point can be calculated by reading the voltage of Y+ and converting it through A/D conversion. Similarly, by adding voltage in the Y+, Y- directions, the Y coordinate of the touch point can be calculated by the value on X+. The formula for calculating the coordinates is as follows:

  Where W is the width of the touch screen; H is the height of the touch screen.

  This solution uses a four-wire resistive touch screen and does not use a dedicated touch screen controller. It is directly controlled by STM32F103 to reduce costs, as shown in Figure 2. [page]

Figure 2 Schematic diagram of a four-wire resistive touch screen

 Figure 2 Schematic diagram of a four-wire resistive touch screen

  2 Introduction to the main components used in the solution

  2.1 Introduction to STM32F103

  The main control device STM32F103 microcontroller in the solution uses the 32-bit ARMCortex-M3 core specially designed by ARM for embedded applications that require high performance, low cost and low power consumption.

  It has up to 128KB of embedded flash memory, 20kB of SRAM and a wide range of peripherals: two 1μs 12-bit ADCs, a full-speed USB (OTG) interface, a CAN interface, three 4 M/S UARTs, two 18 M/S SPIs, two I2 Cs, etc. It also integrates reset circuits, low voltage detection, voltage regulators, precise RC oscillators, etc., which greatly facilitates user development. This series of microcontrollers is not only powerful but also has very low power consumption. It consumes 36 mA at 72 MHz (all peripherals are in working state), equivalent to 0.5 mA/MHz, and drops to 2μA when in standby mode, making it the product with the lowest power consumption in the 32-bit market. In summary, the performance of the STM32F103 series MCU can fully meet all the control needs of the LCD touch screen. The built-in A/D can be used for touch screen control, and the rich I/O interface can be used for communication with the TFT LCD module. In addition, its own CAN controller can be used as an interface for communication with the outside world. Using STM32F103 as the main controller can reduce the use of devices and simplify the overall circuit, thus achieving the goal of reducing EMS costs.

  2.2 TFT LCD screen module

  This solution uses a 3.5-inch TFT LCD screen module with an operating voltage of 3.3 V and a maximum operating current of 70 mA. It supports a resolution of 320×240, has a built-in 230K memory, can display up to 256K colors, can display text and graphics, uses an LED backlight design, and can adjust the backlight brightness using software. It has a built-in simplified Chinese character library, supports a 2D BTE engine, and has a geometric graphics acceleration engine. It can perform complex operations on display objects such as screen rotation, scrolling, graphic patterns, double-layer mixed display, and text magnification, etc. These functions will save users time in the development of TFT screen applications, improve the execution efficiency of MCU software, make the picture more gorgeous, and make the display function richer, greatly enhancing the display capability of the display screen. It provides an 8-bit or 16-bit bus interface to facilitate the connection with the MCU, with strong adaptability and flexible connection design.

  3 Hardware connection design

  3.1 Overall Architecture

  The LCD touch screen system is mainly composed of a microcontroller STM32F103F103, a TFT LCD module, a four-wire resistive touch screen, and a CAN bus interface for communicating with the outside world. The hardware module connection is shown in Figure 3, where the touch detection device of the four-wire resistive touch screen is installed in front of the TFT LCD screen to detect the position touched by the user. This solution uses the built-in A/D conversion function of the STM32F103, and the STM32F103 implements the function of the touch screen controller to directly control the four-wire resistive touch screen, detect touch information and calculate the touch point coordinates. Then the STM32F103 communicates with the TFT LCD module through the I/O interface, and displays the processed valid information through the TFT LCD screen. Since the STM32F103 has a built-in CAN bus controller, the CAN bus interface can be directly led out from the pins of the STM32F103 to communicate with the EMS, complete the actual information collection, set parameters and other functions.

Figure 3 Overall block diagram of the solution

  Figure 3 Overall block diagram of the solution

  3.2 Interface circuit between STM32F103F103 and four-wire resistive touch screen

  As shown in Figure 4, STM32F103F103 is directly connected to the four-wire resistive touch screen through its own I/O port to realize the touch screen controller function. Among them, PA8, PA9, PA10, and PA11 are respectively used as the control terminals of the four transistors. By controlling the on and off of the transistors, the Y+, Y-, X+, and X- of the four-wire touch screen are controlled. PA1 and PA2 are two A/D conversion channels, which are connected to Y+ and X+ respectively to calculate the X and Y coordinates of the touch point. PA3 is connected to the internal interrupt to detect whether the touch screen has a touch action. When the touch screen is running normally, PA8, PA9, and PA11 are set to output 0, and PA10 = 1, that is, only VT2 is turned on. When there is a touch action, D1 is turned on to give PA3 an interrupt signal. After receiving the interrupt request, STM32F103 immediately sets PA8=1 and turns on VT1, so that voltage is added in the Y+ and Y- directions, and the A/D conversion channel PA2 is started at the same time. The Y coordinate of the touch point is calculated by inputting the voltage on X+. Then, PA8 and PA10 are set to 0, and PA9 and PA11 are set to 1, and the A/D conversion channel PA1 is started. The coordinate of the touch point X is calculated by inputting the voltage on Y+. [page]

Figure 4 STM32F103 and four-wire resistive touch screen interface circuit

Figure 4 STM32F103 and four-wire resistive touch screen interface circuit

  3.3 Interface circuit between STM32F103F103 and TFT LCD module controller

  As shown in Figure 5, STM32F103F103 is connected to the TFT LCD module through the I/O interface. Although the built-in LCD controllers in many TFT LCD modules support SPI interface communication (such as ILI9325), the slow SPI transmission speed is not conducive to the rapid transmission of LCD data. Therefore, many LCD modules choose to use parallel port communication.

  Among them, PB0-PB15 are connected to D0-D15 respectively as data communication ports, and PA0, PA4, PA5, PA6, and PA7 are connected to RESET, CS, RS, WR, and RD respectively as control ports to realize reset, chip select, instruction data switching, read and write and other control functions.

Figure 5 STM32F103F103 and TFT LCD module interface circuit

  Figure 5 STM32F103F103 and TFT LCD module interface circuit

  4 Software Design

  The software is programmed in C language. On the one hand, it mainly completes the configuration of STM32F103 for I/O pins, which is used to control the terminal status of the four-wire resistive touch screen, detects whether there is touch information through interruption, configures the A/D conversion channel, reads the voltage and calculates the touch point coordinates according to the formula. On the other hand, it mainly completes the communication control with the TFT liquid crystal module to achieve the correspondence between the touch point coordinates and the LCD screen coordinates and effectively complete the display task. The software development environment is MDK. MDK integrates the compiler RVCT of the ARM development tool RealView DevelopmentSuite (RVDS for short) with Keil's engineering management, debugging and simulation tools, supports ARM7, ARM9 and the latest Cortex-M3 core processors, automatically configures the startup code, integrates the Flash burning module, powerful Simulation device simulation, performance analysis and other functions. Compared with ARM's previous toolkit ADS, the latest version of the RealView compiler can improve performance by more than 20%. The specific process is shown in Figure 6.

Figure 6 Program flow chart

  Figure 6 Program flow chart

  5 Conclusion

  This paper proposes a design scheme for an EMS LCD touch screen based on the STM32F103F103 microcontroller. The high speed and low power consumption of the STM32F103F103 can fully meet the requirements of the main control chip of the touch screen. The TFT LCD can meet more complex, colorful and flexible display tasks, which is in line with the development trend of the display performance rising continuously. This design makes full use of the advantages of the STM32F103 chip, abandons the traditional touch screen controller to control the touch screen, and uses its own A/D to complete the touch screen function. This scheme greatly simplifies the hardware circuit structure, the communication is more reliable, and the programming is more concise. In the end, it can not only meet the EMS display requirements, display and set the data required by the system excellently, but also reduce the cost of the system, and achieve good results through actual use. In view of the rapid development of electric vehicles, this scheme can have a good application prospect.

Keywords:MCU Reference address:Design of EMS LCD touch screen based on single chip microcomputer

Previous article:Design and implementation of China Mobile Multimedia Broadcasting Intelligent Network Monitoring System
Next article:ST launches new series of STM32 ultra-low-power microcontrollers

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号