1. Introduction
1.1. Formula Student Racing
Formula Student Auto Racing, which is organized by FSAE (Formula Society of Automotive Engineers), is a student-oriented automobile design and manufacturing competition involving mechanical, electronic, software, and other fields. Formula Student Auto Racing is a major university mechanical power and electrical-related majors in which a team of students participate in race car design and manufacturing competitions. the future development trend of FSAE racing cars is superior power performance, better handling stability, lightweight structure, cost minimization, and paying more attention to the racing of energy saving and environmental protection. With the competition between the major university teams continuing to intensify, the development of the excellent performance of the racing car control and display system allows racers to better understand the driving status of the car in the race for the team to provide more advantages [1].
1.2. STM32 Microcontroller
According to the needs of the FSAE racing car actual operation test, the hardware module design of the system’s main chip to take ST company’s STM32F103ZET6 chip and configure the corresponding peripherals to realize the collection, transmission, and display of the message ID function. As a high-performance and low-power microcontroller, the STM32 microcontroller is widely used in Formula Racing’s electronic control system. Based on the requirements in the actual operation test of the FSAE racing car, this design discusses the design scheme of a racing car control and display system with CAN bus communication and STM32F103ZET6, including the system hardware design, software program development, hardware circuit board fabrication, and system debugging [2]. The test results show that the system can realize the precise control of the engine control unit and motor through the cooperation of each module, and it has the characteristics of fast speed, small positioning error, and stable operation.
1.3. CAN Bus
CAN (Controller Area Network) bus is a kind of serial communication network that effectively supports distributed control systems, and it is a kind of serial communication bus specially developed for the automobile industry by the German Bosch Company in the 1980s, which has a high data transmission rate and real-time performance. Due to its high performance, high reliability, and unique design, the CAN bus has been widely used in the automobile industry, aviation industry, safety and security, and other fields. With the continuous development of the CAN bus, its communication format standardization has also been further developed. The American Society of the Automotive Industry proposed the J939 protocol in 2000, becoming the standard for vehicle center controller LAN [3].
2. System hardware module overall design
According to the needs of the FSAE racing car actual operation test, the system hardware module design of the main chip to take ST company’s STM32F103ZET6 chip and configure the corresponding peripherals to realize the message ID acquisition, transmission, and display functions [4]. The racing car display and control system must display the racing car’s driving speed, engine speed, water temperature, battery voltage and gear signal, and other racing car data. This information is mainly through the following two ways of communication: part of the Motoc M84 to pass over the data filtering, by the CAN bus will be the engine-related data information to the STM32 for processing, to be sent to the display module after the signal processing; the other part of the signal processing by the STM32F103ZET6 chip [4]. An independent wiring harness connects the other part and outputs the gear information by collecting relevant signals from the gear sensor.
2.1. Vehicle Controller
The whole car controller is the core of the racing power system control, and its functions include: 1, pedal signal acquisition, 2, Can bus information processing, 3, the whole car sensor information acquisition, 4, instrument display and wireless communication, 5, real-time data storage, 6, pneumatic shift. The main control chip is the core component of the racing car control and display system, this design uses STM32F103ZET6 microprocessor of ST company as the core controller of the system. The main chip operating frequency up to 72MHz, equipped with high-speed memory, general-purpose 16-bit timer, SPI interface, etc. In addition, it also contains standard and advanced communication interfaces: CAN bus interface, USART interface SDIO interface, etc., to further simplify the design of peripheral circuits.
2.2. Pedal Signal Acquisition Program
Through the independent design of the pedal structure, the angle sensor is used to obtain the throttle and brake signals. Rotary encoder reliability is better, has a longer service life, is a digital bus type absolute encoder, and has the advantages of high sensitivity and anti-jamming ability. SSL bus is more common, based on differential signal decoding by MAX490, which greatly reduces the burden on the processor and improves communication speed. The actual test to obtain angular information frequency > 5kHZ [5]. Common analog rotary encoded sensor through the shielded wire effectively grounded, parallel capacitor filtering, processor configuration DMA mode, software multiple measurements, size sorting, depolarization, averaging several ways to share.
2.3. Can bus (based on J1939 protocol) program
Can bus data communication with outstanding reliability, real-time, and flexibility, based on the J1939 protocol Can bus is compatible with most of the automotive devices vehicle controller microprocessor STM32 integrated Can (2.0B) module, can replace the generality of the program based on the JA1040 module with the CTM1051A general-purpose Can isolation transceiver to simultaneously solve the problem of electrical isolation and level shifting problems at the same time [6]. The Dan circuit composition is simple and reliable, equipped with a multi-level cache.
2.4. Vehicle Sensor Information Acquisition
FSAE racing car data acquisition system is a feedback system for racing cars’ tuning and racers’ training. The utilization of the data acquisition system FSAE racing car makes the racing car’s tuning and racer’s training become a closed-loop system, and the real-time feedback data can reflect the racing car’s working condition and racer’s operation habits [7], which is convenient for further improvement of the racing car’s defects and the shortcomings of the racer’s operation. The data acquisition system can also be used to monitor other machines and equipment; it only needs to install the corresponding sensors on the monitored machines and equipment to realize the monitoring and data recording of the machines and equipment, which has strong portability. The space of the FSAE racing car is limited, and the number of wiring harnesses should be reduced as much as possible under the premise of ensuring stable and reliable data transmission. Therefore, the CAN bus is utilized in the design to transmit data, and the CAN collector and instrument are mounted on the CAN bus as network nodes. The instrument will read the engine speed, gear, and other information for display; the CAN collector reads the engine speed, intake pressure, throttle depth, oxygen sensor voltage, racing car lateral, longitudinal acceleration, and other data. Digital signal obtained from the A/D conversion, the microcontroller will encode these data according to certain rules, and then send them to the CAN controller mounted on the CAN network, sent out through a gateway node. The CAN collector reads the data and sends it through the 2.4 GHz wireless module [8], and the receiver of the upper computer receives the data and sends it to the upper computer for processing. The instrument reads the data from the CAN bus and displays the engine speed, current gear, coolant temperature, and other information on the instrument of the Formula Racing quick-release steering wheel.
2.5. Instrument display and wireless communication
To facilitate the driver’s understanding of the real-time information of the racing car, the instrument adopts intelligent PS-LCD with an independent CPU, which can independently and autonomously develop the display interface the second time, but the refresh frequency is low. Through the interface design software Designer online simulation interface design. Through the RS233 protocol communication with the vehicle controller, real-time display of the current state of the car, including speed, voltage, power, faults, and so on. Wireless module selection based on ZigBee communication protocol of 1.6 kilometers of wireless modules, with the upper computer software developed based on Labview software, to complete the real-time monitoring and control [9].
2.6. Real-time data storage
Due to the large amount of sensor information during the operation of the race car, the wireless module transmission information communication rate cannot meet the demand and cannot realize a large amount of real-time data storage through the file management chip CH376S to realize the real-time information reading and writing of U disk or SD card. It has built-in management firmware of FAT32 file system and supports SP interface. Real-time storage of a large amount of data is realized through this module. After testing, the data block writing speed of this module is higher than 1Mb/s, and the comprehensive, effective rate reaches 100Kb/s with good stability [10].
2.7. Pneumatic Shift
2.7.1. Hardware system. It is mainly used to realize the functions of reading vehicle speed from ECU through CAN bus, driving STM32, and storing shift data. The design selects ECU model MoTeC M84, based on CAN 2.0 bus protocol, broadcasts and sends 176-byte messages at 1 Mbps each time, and utilizes HVP230 CAN transceiver to receive the messages [11]; controls the solenoid valve’s on/off through 5V high-level low time delay relay; and sets up the shift mode selector switch to switch between automatic upshift and paddle shift mode.
2.7.2. Software System Design. The software system realizes the functions of shift mode recognition, automatic upshift, downshift clutch cooperation, and shift parameter storage through the STM32 platform. When upshifting, first send the fire break signal to appropriately reduce the engine speed and torque to make the upshift engagement smooth and reduce the power loss caused by the impact; when downshifting, first disengage the clutch to prevent the engine from dragging backward when the vehicle speed is too fast. After debugging, the shift success rate is the most stable when the ignition delay time is 50 ms and the downshift clutch release time is 45 ms in advance. Under the optimal shifting speed of each gear position derived from the real-vehicle test, the shifting time of the racing car can be reduced by 46%, and the straight-line acceleration performance can be improved by about 5% [5].
3. System Software Development
3.1. Design Principles and Processes
The core idea of this software design is to receive the CAN data packet sent by MotoC M84 engine control module and collect the CAN data packet sent by MotoC M84 engine control module [1]. The core idea of this software design is to receive the CAN data packet from MotoC M84 engine control module, collect the data needed to display the speed, rotational speed, water temperature, and gear, and transmit the real-time data to the intelligent serial port screen so that the driver intuitively understands the specific conditions of the car. The design process is as follows. (1) According to the demand for display during the actual operation of the car, the design tasks are reasonably planned to ensure that the data collection and display functions can be accomplished during the actual operation of the car. (2) Determine the peripherals of the main control chip set its working mode according to the design scheme, and call the corresponding library function to realize the configuration of the underlying basic hardware. (3) According to the selected engine control unit communication protocol content, write the relevant communication protocol stack code. (4) Compile the relevant program in the USART HMI upper computer software of the intelligent serial port screen. (5) After matching the corresponding components, debug to make them work coordinated and achieve the expected functions.
3.2. STM32F103ZET6-based system main program design
ECU receives sensor signals for arithmetic processing, integrating a data package for the later main control chip to collect data to use due to the Can communication protocol contains 176-bit data ID, which needs to know the racing car data information: speed, speed, engine temperature, battery voltage, gear signals and so on. Therefore, when writing the main program, it is necessary to consider collecting and verifying the IDs of the relevant data from several data packets, which can be seen from the Can communication protocol of Motoc M84. Rotational speed (RPM) ID is 4:5, engine temperature (Engine Temperature) ID is 12:13, battery voltage (Battery Voltage) ID is 48:49, and speed (Drive Speed) ID is 60:61; in preparation for the main program, the relevant library function header file call affirmation is written in it. When writing the main program, the related library function header file call statement is written in it [12].
3.3. Data transmission rules
As the data transmitted through the wireless serial port contains several car parameters, the host computer needs to “sort” the data. Therefore, the transmission of data needs to be encoded, that is, at the same time, in the sender and receiver to provide an identical format so that the host computer receiver can distinguish between different data. This system provides for each frame 2 B send data, where the first byte for the address bit indicates that the data represents a parameter of the race car; the second byte for the data bit is used to indicate that the parameter’s value is how much. Use 0xF4~0xFF to indicate the speed, RPM, throttle depth, steering angle, lateral acceleration, longitudinal acceleration, suspension displacement, gear position, oxygen sensor voltage, intake pressure, coolant temperature, and brake signal, respectively; and 0x00~0xF3 to indicate the size of the specific value of a parameter. For example, if 0xF4 indicates the vehicle speed, then the data 0xF4, 0x08 indicates that “the current vehicle speed is 8 km/h” [13].
3.4. Data Receiving Process
The host computer will be racing the data sent to the wireless module in the turn cycle of the transmission buffer; in each frame, 2 B, the first byte indicates the data type, and the second byte indicates the specific value of the data. The first byte indicates the data type, and the second byte indicates the specific value of the data. The data type and specific value are sent alternately. The host computer sends the data alternately by checking the CommEvent property of the MSComm value of the CommEvent property in the MSComm control to determine whether data is received from the microcontroller. When the data is received, the value of the CommEvent property is automatically set to comEvReceive. Since the lower computer’s sending and the upper computer’s receiving are not synchronized in time, it is necessary to judge and recognize the data after the upper computer receives it [14]. When the host computer receives a byte of data, determine whether the byte belongs to the interval 0x00 ~ 0xF3. If it is in the interval, it means that only the second byte of a frame of data is received, so the frame of data needs to be invalidated and wait for the next byte of data again. If not in the interval (i.e., the data is in the 0xF4~0xFF), it means that the byte is the first byte of a frame data, then the frame data will be stored in the corresponding variable and pointed to the corresponding racing parameters, continue to wait for the second byte of data. When the second byte of data is sent, the value of the data will be deposited into the racing parameters pointed by the first byte of data to complete the transmission of a data frame. The second byte is assigned to the specific value of the data and deposited into the corresponding variable.
3.5. Data Processing Flow
The received data is converted into binary, and the real value of the data is obtained and displayed on the screen through the TextBOX control is displayed on the screen. At the same time, their values are assigned to the width property of the rectangular bar shape control, which reflects the size of the value in real-time by the length of the rectangular slot. Assigning the value of the Interval property of the timer control is set to the interval of recording data, and the program to call the notepad file is written in the timer control so that the data can be recorded in the notepad file according to the desired time interval, and the data recording period can be adjusted.
4. Conclusion
This design is based on the needs of the FSAE racing car actual operation test, and it discusses CAN bus communication and STM32-based racing car control and display system design and research. The system is based on the hardware circuit design of each module, written from the MotoC M84 engine control module data collection CAN bus transceiver program. The design realizes the USART HMI intelligent serial screen and other instrumentation. The test results of the control of key devices show that the system can realize the precise control of the engine control unit and the motor through the cooperation of each module, and it has the characteristics of fast speed, small positioning error, and stable operation. With the increasing scale of the integrated circuit industry and improvement of manufacturing processes, microcontrollers will be better and more widely applied in racing by bringing faster response, stable handling, and better performance.
References
[1]. MoTeC Pty.Ltd:MoTeC M800 Set 3 Data Protocol [M]2013.
[2]. China Society of Automobile Industry:Rules for Formula Student China 2022 [S].2022.
[3]. Liu Hanjun .Talking about the loading rate and mechanical efficiency of cylinders[J] Hydraulics and Pneumatics,1992.(1) . 24-26.
[4]. Dong Bicheng, Shi Chun, Wu Gang. Development of CAN communication software for electric vehicle central control unit based on AUTOSAR[J]. Instrumentation Technology, 2021(4):65-70.
[5]. ZHANG Xiaozhou,CAO Rui,CHENG Qiyuan.STM32-based FSAE Pneumatic Shift and Digital Acquisition System[A].Control System and Technology.2095-6487(2019)02-0001-02.
[6]. Yang Guangxiang.STM32 Microcontroller Principles and Engineering Practice [M] Wuhan: Wuhan University of Technology Press, 2013.
[7]. Wang Peijie, He Fei, Chen Guoping, et al. Design and Implementation of STM32F7-based Programmable Power Supply Display System[M]. Liquid Crystal and Display, 2021, 36(7):973-982.
[8]. Tang, Lili, and Huang, Wei. Design of STM32-based FSMC interface to drive industrial FT color screen[J]. Modern Electronic Technology, 2013,36(20):139-141+144.
[9]. Ren Keqiang, Wang Chuanqiang. Design of multi-channel serial port driven TFT LCD system based on STM32F4[J].Liquid crystal display system design. 2020.35(5):449-455.
[10]. NAZ A. PIRANDA B. GOLDSTEIN S C. et al. A time syn-chronization protocol for modular robots [C]// Euromiero International Conference on Parallel,Distributed,and Network-Based Processing. [S.l.]: IEEE. 2016: 109-118.
[11]. WANG Jian, LIN Haying. The design of the formula racing car for eollege stadents [M]. Beijing: Beijing Institute of Technology Press, 2016: 281-285.
[12]. ZHUANG Yanxia, SUN Yungiang, YAO Aigin. Real-time data transmission system based on CAN-bus [J]. Journal of data acquisition & processing, 2006. 21(2) • 222-226.
[13]. YAN Fuwa. CAO Kai. Hu Jie. et al. A studv on the data acquisition technology for remote vehicle diagnosis based on Internet and 3G [J]. Automotive engineering, 2013, 35(5): 468-471.
[14]. CAO Bin. TANG. Chuzhou. On the dummv experiment construction of UG and VB motor engine [J]. Modern manufacturing engineering. 2008. 8(2). 84-87.
Cite this article
Jin,S. (2024). STM32 microcontroller and CAN bus based FSAE racing car electrical part design. Applied and Computational Engineering,85,256-261.
Data availability
The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.
Disclaimer/Publisher's Note
The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
About volume
Volume title: Proceedings of the 4th International Conference on Materials Chemistry and Environmental Engineering
© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and
conditions of the Creative Commons Attribution (CC BY) license. Authors who
publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons
Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this
series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published
version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial
publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and
during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See
Open access policy for details).
References
[1]. MoTeC Pty.Ltd:MoTeC M800 Set 3 Data Protocol [M]2013.
[2]. China Society of Automobile Industry:Rules for Formula Student China 2022 [S].2022.
[3]. Liu Hanjun .Talking about the loading rate and mechanical efficiency of cylinders[J] Hydraulics and Pneumatics,1992.(1) . 24-26.
[4]. Dong Bicheng, Shi Chun, Wu Gang. Development of CAN communication software for electric vehicle central control unit based on AUTOSAR[J]. Instrumentation Technology, 2021(4):65-70.
[5]. ZHANG Xiaozhou,CAO Rui,CHENG Qiyuan.STM32-based FSAE Pneumatic Shift and Digital Acquisition System[A].Control System and Technology.2095-6487(2019)02-0001-02.
[6]. Yang Guangxiang.STM32 Microcontroller Principles and Engineering Practice [M] Wuhan: Wuhan University of Technology Press, 2013.
[7]. Wang Peijie, He Fei, Chen Guoping, et al. Design and Implementation of STM32F7-based Programmable Power Supply Display System[M]. Liquid Crystal and Display, 2021, 36(7):973-982.
[8]. Tang, Lili, and Huang, Wei. Design of STM32-based FSMC interface to drive industrial FT color screen[J]. Modern Electronic Technology, 2013,36(20):139-141+144.
[9]. Ren Keqiang, Wang Chuanqiang. Design of multi-channel serial port driven TFT LCD system based on STM32F4[J].Liquid crystal display system design. 2020.35(5):449-455.
[10]. NAZ A. PIRANDA B. GOLDSTEIN S C. et al. A time syn-chronization protocol for modular robots [C]// Euromiero International Conference on Parallel,Distributed,and Network-Based Processing. [S.l.]: IEEE. 2016: 109-118.
[11]. WANG Jian, LIN Haying. The design of the formula racing car for eollege stadents [M]. Beijing: Beijing Institute of Technology Press, 2016: 281-285.
[12]. ZHUANG Yanxia, SUN Yungiang, YAO Aigin. Real-time data transmission system based on CAN-bus [J]. Journal of data acquisition & processing, 2006. 21(2) • 222-226.
[13]. YAN Fuwa. CAO Kai. Hu Jie. et al. A studv on the data acquisition technology for remote vehicle diagnosis based on Internet and 3G [J]. Automotive engineering, 2013, 35(5): 468-471.
[14]. CAO Bin. TANG. Chuzhou. On the dummv experiment construction of UG and VB motor engine [J]. Modern manufacturing engineering. 2008. 8(2). 84-87.