1 Introduction
With the development of automotive electronics, there are more and more electronic products in cars, and the number of electronic control units in electronic control systems such as car engines, chassis and body is increasing. At the same time, the communication between them is becoming more and more important. The use of network technology in cars can greatly improve the reliability of information transmission between systems, and at the same time can greatly reduce the number of automotive wiring harnesses and reduce the cost of automotive electrical systems. In recent years, the application of CAN systems in cars has become more and more extensive. CAN (Controller Area Network) is the abbreviation of control area network. It was first introduced by BOSCH in Germany and is used for data communication of measurement and execution components inside cars. Due to its high performance, high reliability, good real-time performance and unique design, it has been widely used in data communication between various detection and execution agencies of control systems. The CAN bus complies with the ISO11898 standard, with a maximum transmission rate of 1Mbps, a maximum transmission distance of 10km, and a transmission medium of twisted pair. This paper proposes and implements a method of using a single-chip microcomputer to form a CAN system and using Bluetooth wireless transmission technology to collect and process car operation data.
During the operation of the car, on-board radio frequency devices such as car stereo systems, GPS navigation equipment, satellite digital audio radio service (SDARS) devices, GSM radio transceivers and other electrical equipment may cause interference or be interfered with. These radio frequency interference signals will have an adverse effect on the data flow of the car's wireless system. If traditional wireless data transmission technology is used, the rate and accuracy of the transmitted data cannot be very high, so it is impossible to achieve fast and accurate data transmission. Using Bluetooth wireless transmission technology in cars can solve this problem well.
The Bluetooth module used in this article adopts the BC417 chip of the British CSR company, and forms a module with the 8M FLASH chip 39VF800A of the SST company.
Figure 1 Schematic diagram of Bluetooth module
The main features of this module are as follows:
1) Adopt CSR mainstream Bluetooth chip, compliant with Bluetooth V210 standard.
2) The upper baseboard of the serial port module has an RS232 interface and a TTL interface. You can choose any one of the interfaces to use. Use a 313~5V power supply. The serial port is transparent to the user.
3) The Bluetooth chip uses forward error correction coding, high communication efficiency, automatic frequency hopping, and strong anti-interference ability.
4) The baud rate is 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400, which can be set in the program according to actual needs.
5) Sleep current: less than 1MA, working current: 40MA.
2 System hardware structure schematic diagram
This paper uses MICROCHIP's 18F4580 chip with built-in CAN controller and CAN transceiver chip MCP2515 to form a CAN network system, and uses the 10-bit AD sensor of the 18F4580 chip to measure the throttle position signal of the automobile engine. At the same time, the intelligent digital sensor DS18B20 is used to measure the water temperature signal of the engine. The Bluetooth module is used to wirelessly transmit the measured signal to the host computer, and the data receiving and processing program is written using VC++ to realize the real-time display and storage of data, and the curve diagram of the change relationship between data value and time can be displayed, and the measurement results are intuitive. The hardware schematic diagram of the system is shown in Figure 2.
Figure 2 Schematic diagram of the measurement system
3.1 Measurement of throttle signal
The throttle position sensor on the car engine measured here is an adjustable resistor type. The throttle position output signal is a voltage signal of 0 to 5V. According to the relationship between the actual throttle opening and the output voltage, the measured voltage signal is calibrated, and the throttle opening can be converted according to the measured voltage signal. Therefore, the 10-bit AD conversion circuit embedded in the PIC18F4580 microcontroller is used here to complete the measurement of the throttle position sensor output voltage. In order to improve the measurement accuracy, the 5V reference voltage of the microcontroller AD is isolated and stabilized from the system power supply. [page]
This system uses Microchip's MPLAB development environment to embed the PICC18C program compiler, and uses C program to write data acquisition and CAN data receiving and sending programs. The AD conversion subroutine is written in assembly language. The program takes into account the modularity and good maintainability of C program, and at the same time has the advantage of high efficiency of assembly language.
The signal is sent to the CAN network through the CAN controller in an extended frame format. The subroutines for data acquisition and CAN data transmission are as follows:
InitSPI(); //SPI interface initialization
Init_MCP2515(); //MCP2515 initialization
…
TRISA=0B00000001; //AN0>>>>DCinputDC channel input, turn on RA0
ADCON0=0B00000001; //AN0 channel, allow ADC to work,
ADCON1=0B00001110; //Except RA0 which is an analog input port, other RA ports and RE ports are ordinary digital ports
ADCON2=0B10100001; //Conversion result is right-aligned, 8TAD, 1/8FOSC.
#asm
ADCON0EQU0FC2H
GOEQU001H
bsfADCON0,GO //Start conversion
ADWAIT:
btfscADCON0,GO
gotoADWAIT //Wait for conversion to complete
#endasm
write_MCP2515(TXB0CTRL,0x03); //Set to send the highest priority
write_MCP2515(TXB0SIDH,0xFF);//EID28--21
write_MCP2515(TXB0SIDL,0xEB); //EID20--EID18, extended frame enable, EID17--EID16
write_MCP2515(TXB0EID8,0xFF);//EID15--EID8
write_MCP2515(TXB0EID0,0xFF);//EID7--EID0
write_MCP2515(TXB0DLC,0x02); //The length of the sent data is 8 bytes
write_MCP2515(TXB0D0,ADRESH); //Sent data
write_MCP2515(TXB0D1,ADRESL);
…
send_TXB0(); //Request to send
while((read_MCP2515(TXB0CTRL)&0x08)==0x08);//wait
Send completed
…
3.2 Measurement of water temperature signal
The water temperature signal in this article is measured using the DS18B20 intelligent digital sensor from DALLAS. DS1820 is the world's first temperature sensor that supports the "one-wire bus" interface. The unique and economical characteristics of the one-wire bus allow users to easily build a sensor network and introduce a new concept for the construction of the measurement system. The measurement temperature range is -55℃~+125℃, and the accuracy is ±015℃ within the range of -10~+85℃. The field temperature is directly transmitted in a digital manner using the "one-wire bus", which greatly improves the system's anti-interference ability. It is suitable for field temperature measurement in harsh environments, such as: environmental control, equipment or process control, temperature measurement consumer electronics products, etc. After the DS1820 completes the acquisition of the temperature signal, it receives the data through the PIC18F4580 chip, and sends the data to the CAN bus in an 8-bit binary format using a standard frame format through the embedded CAN controller. [page]
4 CAN network transmission system
The collected signal is sent out through the CAN controller embedded in PIC18F4580. Here, the MCP2551CAN transceiver produced by MICROCHIP is selected to complete the transmission of network signals, and a terminal resistor with a resistance of 120 ohms is added to the CAN network terminal. The signal received by the transceiver at the receiving end of the CAN network is transmitted to another PIC18F4580 chip, and the network signal is taken out through the CAN controller inside the base. If an extended frame is received, the received data is the throttle position signal; if a standard frame is received, the received data is the water temperature signal. After the signal is processed, it is sent to the MAX232 chip through the base's own UART port in the form of a data packet, and the TTL signal level is converted to a 232 level. The hardware schematic diagram of the CAN communication board of the throttle part is shown in Figure 3.
Figure 3 Schematic diagram of CAN communication board for measuring throttle position signal
5. Bluetooth wireless transmission system
The MAX232 chip transmits the converted signal to the Bluetooth master (transmitter) module composed of CSR's BC417. The BC417 Bluetooth module can set the data transmission rate. Under the condition of ensuring the quality of the transmitted signal, the high transmission rate can be used as much as possible. The transmission rate in this article is 38400bps. After receiving the data signal, the slave (receiver) module composed of another BC417 Bluetooth chip converts the level through the MAX232 chip and transmits it to the serial port of the host microcomputer.
6 Host computer signal receiving and processing system
After the serial port of the host computer receives the signal, an object-oriented program is written using the VC++ development tool to process the data packet. In order to intuitively display the data value and its relationship with time, this program can display the actual throttle position signal and water temperature value, and can also display the change curve of the throttle position signal. The interface of the host computer program is shown in Figure 4.
This article uses the SerialPort class to implement this function. This method only requires users to set the relevant communication parameters, without having to worry about the implementation method of the encapsulation. The program is modular and maintainable [5]. The serial port event response method is used in use. In order to more intuitively display the curve of data changing over time, a display interface implemented by encapsulating the BUTTON class control is written. This control can easily set the data coordinates, background, data unit, data update speed and other properties, and the display effect is good.
Figure 4 Upper computer interface diagram
7 Conclusion
The system operates well and can measure vehicle operating parameters conveniently, quickly and reliably, providing a good platform for wireless real-time measurement of vehicle network parameters and vehicle fault diagnosis.
Previous article:Design of automatic bus stop announcement system based on ZigBee
Next article:Design of motor protection device based on CAN bus
- Popular Resources
- Popular amplifiers
- Investigation of occupancy perception in autonomous driving: An information fusion perspective
- Practical Development of Automotive FlexRay Bus System (Written by Wu Baoxin, Guo Yonghong, Cao Yi, Zhao Dongyang, etc.)
- Design and implementation of electric vehicle information security gateway
- CVPR 2023 Paper Summary: Vision Applications and Systems
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [GD32L233C-START Review] IV. USART
- Electric vehicle charger schematic, file name is chip name
- SD card creative stickers
- How do you entertain yourself while staying at home?
- The difference and relationship between embedded Linux and embedded development of 51/430/STM32
- 【DM642】Porting of H.264 source code on DM642
- [2022 Digi-Key Innovation Design Competition] Material Unboxing
- Prize-giving live broadcast: Book a session on "Meeting the test challenges in 5G signal generation" and win Keysight gifts
- Simple stopwatch based on MSP430f149 microcontroller
- A power backup solution for NVR/DVR systems