﻿ 基于STM32的汽车方向盘转角检测系统设计

# 基于STM32的汽车方向盘转角检测系统设计Design of Automobile Steering Wheel Angle Detection System Based on Stm32

Abstract: Automobile steering wheel is an important part of automobile driving, so the automobile steering wheel angle detection system is particularly important. In this paper, STM32 is used as the main control module to complete the design of automobile steering wheel angle detection system based on STM32. STM32 built-in can interface and AD converter, angle sensor and can communication can directly transmit information with MCU without external complex circuit. In the selection of angle sensor, MLX90316 is selected, which can detect the angle through the change of magnetic field, and it can overcome the multiple interferences on the car and make the detection more accurate. The advantage of using can communication is that multiple nodes on the vehicle only need to be connected to the bus to realize the communication between nodes at the same time, eliminating the connection between nodes, which is of great benefit to the design and installation of automobile steering wheel. To a certain extent, this overcomes the problems of reduced steering wheel angle detection accuracy and less collected data caused by mechanical wear, and has a certain practical application value.

1. 引言

2. 总体方案设计

Figure 1. Overall system design block diagram

Figure 2. Schematic diagram of double magnetic wheel angle

${N}_{S}={C}_{S}/L$ (1)

${N}_{A}={C}_{A}/L$ (2)

${N}_{B}={C}_{B}/L$ (3)

${\varphi }_{A}={\varphi }_{S}\cdot {N}_{s}/{N}_{A}$ (4)

${\theta }_{A}={\varphi }_{S}\cdot {N}_{s}/{N}_{A}-360{n}_{A}$ (5)

${\varphi }_{S}=\left(\theta +360{n}_{A}\right){N}_{A}/{N}_{S}$ (6)

${\varphi }_{S\mathrm{max}}={360}^{\circ }×\left({N}_{A}+{N}_{B}\right)/\left({N}_{S}×\left({N}_{A}-{N}_{B}\right)\right)-{0.1}^{\circ }$ (7)

3. 系统硬件设计与实现

3.1. STM32处理模块

STM32处理模块 [9] STM32F103C8T6有两个晶振电路，一个是HSE，常用外部高频，常为8 MHz。另一个为外部低频晶振，也称时钟晶振，计时用，或系统待机或低功耗时用，为32.768 kHz，其引脚图如图3

Figure 3. STM32F103C8T6 pin diagram

STM32F103C8T6有48个引脚，第1、9、24、36和48脚VCC是接电源的，可接+3.3 V电源，第8、23、35和47脚VSS用来接地。PA口、PB口、PC口和PD口这4组端口都可以用作普通的输入/输出端口即I/O。STM32F103C6T6自带CAN通讯，可以直接和CAN模块相接。

3.2. 角度传感器电路和EEPROM电路

STM32处理模块为主设备，角度传感器为从设备。角度传感器要给STM32处理模块输出信息的话，就要通过引脚MISO来实现。角度传感器的时钟信号由STM32处理模块提供，引脚NSS是作为片选引脚，可以使主设备和从设备避免冲突。因为软件设计过程中需要存储采集的角度数据和采集完成后处理的角度数据，所以需要EEPROM电路，其电路如图5所示。

Figure 4. Angle sensor circuit of STM32F103C8T6

Figure 5. EEPROM circuit of STM32F103C8T6

3.3. CAN通讯模块电路

CAN通讯电路如图6

Figure 6. CAN communication circuit

STM32内部有CAN接口 [10]，总线数据的封装可以在单片机的内部进行，而单片机只需要外接CAN总线收发器SN65HVD232即可，CAN模块的CAN_TX和CAN总线收发器的TXD相连接，CAN_RX和CAN总线收发器的RXD相连接。引脚TXD是接收来自微控制器的信号并转发出去。引脚RXD是读出来自总线的数据并发送给微控制器。

3.4. 看门狗电路和LED指示电路

Figure 7. Watchdog circuit

LED指示电路如图8所示。

Figure 8. LED indicating circuit

4. 系统软件设计

Figure 9. System flow chart

5. 仿真测试

6. 结束语

Figure 10. Simulation of steering wheel angle detection

Figure 11. Simulation results

[1] 高岩. 简述单片机的发展趋势及其在设备自动化系统改造中的应用[J]. 科技风, 2020(13): 120+124.

[2] 薛鹏祥. 浅谈汽车检测技术发展及现状[J]. 汽车实用技术, 2021, 46(1): 182-184.

[3] 王洪月, 臧向迪, 李昱萱. 浅析传感器分类应用与发展前景[J]. 南方农机, 2017, 48(13): 107+111.

[4] 郭忠新, 张蕾. 磁电式方向盘转角传感器的应用与研究[J]. 汽车电器, 2019(1): 48-50.

[5] 张永东. 汽车方向盘转角传感器的开发应用[J]. 汽车电器, 2019(7): 40-41.

[6] 王洪广. 防水防尘式汽车方向盘转角传感器的设计[J]. 内燃机与配件, 2021(7): 20-21.

[7] 郑伟峰. 新型角度检测装置及其检测方法研究[J]. 传感器与微系统, 2021, 40(5): 15-17+21.

[8] 刘尚, 童亮, 路艳群, 等. 汽车电子节气门角度传感器的故障检测与重构[J]. 仪表技术与传感器, 2017(11): 97-103.

[9] 邢启明, 孙宁. 基于STM32的学校周边道路交通状况监测与调控系统[J]. 电子设计工程, 2021, 29(16): 1-5.

[10] 陈永辉, 郝长峰, 张峰, 等. 基于Kinco触摸屏与DanFoss控制器之间的自定义CAN通讯[J]. 现代机械, 2021(3): 86-90.

[11] 孙万麟. 基于Proteus的多功能电子密码锁控制系统设计及实现[J]. 机械制造与自动化, 2021, 50(4): 216-218.

[12] 孙万麟. Proteus软件应用于技术类课程的电路设计及仿真[J]. 微型电脑应用, 2021, 37(7): 63-66.

Top