Design of automobile switch box based on CAN bus and PIC microcontroller

Publisher:BlissfulWhisperLatest update time:2013-09-30 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract : With Microchip's PIC18F45K80 chip as the core, a design method for a practical and multifunctional automotive switch box with low cost and high scalability is given. In addition to the function of real-time monitoring of the vehicle startup process and driving status parameters, compared with other similar products, this switch box also pays more attention to the practicality and scalability of the product, and has the unique function of communicating with other automotive devices.

  0 Introduction

  With the continuous development and progress of modern automobile industry technology, the number of electronic devices installed on vehicles is increasing, so that a large number of control signals need to be exchanged in real time in the integrated control system of automobiles. As a reliable automobile computer network bus, CAN bus has been widely promoted to various application fields of automobile control systems. Applying CAN bus technology to automobile switch boxes can enable each automobile computer control unit to obtain the working data in the switch box through the CAN bus, and can accurately control each relay of the switch box, thereby achieving the purpose of reducing automobile wiring harnesses, improving communication reliability, reducing system costs, avoiding system function duplication, and improving system work efficiency.

  1 Design of automotive switch box

  This switch box adopts the design scheme based on the PIC18F45K80 chip produced by Microchip as the main chip. This chip not only has all the functions of a general single-chip microcomputer, but also integrates a hardware CAN protocol module, and the CAN bus communication can be completed inside the chip. The adoption of this scheme has the following advantages: First, the hardware integrates the CAN protocol module, and no external chip is required, thereby reducing the product manufacturing cost; second, there is no need to write the SPI interface driver, which shortens the development cycle and improves the product competitiveness; third, this system uses mainstream PIC chips, which has strong scalability and high program portability.

  PIC18F45K80 is the main control chip, responsible for the comprehensive transaction processing of the system.

  The system functions are mainly divided into four parts, namely analog signal sampling, digital signal acquisition, control signal output and CAN module communication. The acquisition of analog signals includes power supply voltage sampling, temperature sensor and current sensor sampling, and digital signal acquisition of the on and off of each fuse. The output of the control signal is the control of the vehicle power relay K1, the starting power relay K2, and the starting motor relay K3. CAN module communication is the communication between the microcontroller and other devices on the vehicle through the CAN interface chip, which is also the focus of this system research. Figure 1 shows the overall block diagram of this system.

  Figure 1 shows the overall block diagram of this system.

  2 Hardware design of automobile switch electrical box

  2.1 System main processor PIC18F45K880

  The PIC18F45K80 series is a low-cost extension of Microchip's PIC18F8680, PIC18F4680 and PIC18F4580 enhanced CAN series. The microcontroller has a wide operating voltage range of 1.8~5.5 V, and a built-in 3.3 V regulator on the chip, which can be used as a power supply reference voltage. The operating temperature range is wide: -40~+125 ℃, suitable for automotive working environments. The operating speed is up to 64 MHz, with a maximum of 64 KB on-chip flash program memory, 1 024 bytes of data EEPROM, and 3.6 KB of general registers (SRAM). There are 2 internal oscillators: INTRC (31 kHz) and INTOSC (16 MHz). With an extended watchdog timer (WatchdogTimer, WDT), the programmable period is 4 ms~131 s.

  The PIC18F45K80 includes an Enhanced Controller Area Network (ECAN) module. The ECAN bus module complies with the ISO 11898-1 specification. It has three operating modes: Legacy mode (fully backward compatible with existing PIC18CXX8/FXX8 CAN modules). Enhanced mode. FIFO mode or programmable transmit/receive buffer. The message bit rate can reach up to 1 Mb/s, with 6 buffers that can be used as receive and transmit message buffers, 3 transmit message buffers with priority, 2 receive message buffers and 1 receive message combination buffer.

  2.2 CAN interface circuit module design and implementation

  This switch box uses the CAN bus transceiver chip TJA1050 from NXP Semiconductors as the interface between the CAN protocol controller and the physical bus.

  TJA1050 can provide different transmission performance for the bus and different receiving performance for the CAN controller. TJA1050 fully complies with ISO11898 standard and has high transmission speed (up to 1M baud). It has good electromagnetic compatibility and low electromagnetic radiation (EME) performance, and has a differential receiver with a wide input range, which is resistant to electromagnetic interference (EMI).

  Figure 2 shows the interface application circuit of TJA1050. A 120Ω resistor in the circuit plays a very important role in matching the bus impedance, otherwise, the anti-interference and reliability of data communication will be greatly reduced, or even communication will be impossible.

  Figure 2 shows the interface application circuit of TJA1050

  2.3 Signal acquisition and output control circuit design

  The detection of various electrical working states of the car is one of the important functions of the switch electrical box, which is mainly composed of the fuse state acquisition circuit, the power supply voltage and temperature acquisition circuit, and the starter motor current detection circuit.

  Working status detection of automobile fuses. In order to reliably and accurately detect the on-off status of each fuse, this system uses optocoupler isolation to detect the on-off status of the fuse. The electrical box has a total of 24 fuses, including charging fuses, heater 1~2 fuses, switch power fuses, normal fire power fuses, ON gear 1~10 fuses, and normal fire 1~8 fuses. The fuse detection uses optocoupler isolation detection to avoid interference from other electrical equipment on the vehicle to the electrical box system.

  The switch box needs to monitor the power supply voltage in real time. High voltage is achieved through voltage monitoring. There are three abnormal alarms, such as low voltage and abnormal generator charging: the overvoltage alarm is when the voltage exceeds 32 V, the system voltage alarm is sent to the instrument through the CAN bus; the low voltage alarm is when the vehicle is not started, when the system voltage is lower than the set value of 23.5 V, a low voltage alarm is issued, and the main power switch is cut off for more than 4 minutes; the abnormal generator charging alarm means that after the vehicle is started, if the charging is normal, the current power supply voltage should be greater than 26 V. If the charging is abnormal (the power supply voltage exceeds 32 V or is lower than 26 V), an alarm is sent to the instrument through the CAN bus.

  Since the voltage alarm only needs to detect 3 voltage values, in order to reduce system costs, this design uses a resistor voltage divider for detection.

  The switch electrical box needs to detect the temperature inside the electrical box and send the temperature data to the instrument through the CAN bus. The system uses 3899 200K NTC (negative temperature coefficient thermistor) to detect the temperature, and samples the AD value after dividing the voltage with a standard resistor, and finally finds the actual measured temperature value according to the resistance-temperature table.

  Another thing is the starter motor current detection. The car starting system converts the battery energy into mechanical energy, and the starter drives the engine to rotate and start the engine. When the car starts, the working current of the starter motor is very large, generally up to 300~600 A. In order to prevent the overcurrent of the starter motor from damaging the car battery and other circuits, a current detection circuit is added to the starter motor. BYD BLY2-IOV2M current sensor is selected in the system, and a metal copper sheet is used to pass through the current sensor cavity in the switch electrical box. The sensor adopts the measurement principle of the Hall effect and a completely isolated measurement method, with low power consumption and wide measurement range.

3 Software Design and Implementation of Automobile Switch Electrical Box

  The switch box electrical software mainly consists of two parts, including user function definition design and CAN driver design. The overall program architecture is shown in Figure 3.

  The user function definition program in Figure 3 mainly includes overvoltage monitoring, undervoltage monitoring, fuse circuit breaker monitoring, overcurrent monitoring, battery charge monitoring, module self-test, etc.

  The main function of the SAE_J1939 protocol driver is to parse the CAN messages in the receive buffer of the CAN module and translate the CAN messages in the send buffer.

  The user function definition program in Figure 3 mainly includes overvoltage monitoring

  The data structure of the SAE_J1939 protocol is very different from the CAN message structure. It redefines the 11-bit standard frame and 29-bit extended frame of the CAN message, giving special meaning to each bit. Its structure is defined as follows:

  

  Among them, PDUFormat is the PDU format, PDUSpecific is the specific field, SourceAddress is the device address, DataLength is the data length, Priority is the priority, and Data[J1939_DATA_LENGTH] is the data field of the SAE_J1939 protocol.

  According to the position and role of the SAE_J1939 protocol in the entire system, this design provides a translation and parsing flow chart for receiving and sending messages based on the SAE_J1939 protocol as shown in Figure 4.

  This design provides a translation and parsing flow chart for receiving and sending messages based on the SAE_J1939 protocol as shown in Figure 4.

  Before the CAN module works, it must be initialized.

  The CAN driver is designed to enter the configuration mode of the CAN module at the entrance so as to configure the baud rate, mask, filter, etc. before the CAN module works.

  4 Conclusion

  The automotive switch box based on CAN bus is a networked automotive electrical control system, which is of great significance to the networking development of automotive electrical equipment. It can minimize the automotive wiring harness, transmit the working data of the switch box to each instrument in real time, has high data transmission reliability and installation convenience, and expands the functions of the car. At present, with the rapid popularization of CAN bus technology, more and more automobile manufacturers support the CAN bus standard, and the networking development trend of automotive electronic products is inevitable. The installation of automotive switch boxes based on CAN bus in vehicles will help improve the competitiveness of automotive products, and the increased cost will not be too much, so it is the future development direction of automotive switch boxes.

Reference address:Design of automobile switch box based on CAN bus and PIC microcontroller

Previous article:Design and test of radiator for automotive electronic control equipment (50w)
Next article:Analysis of three types of LCD wide viewing angle technology

Recommended ReadingLatest update time:2024-11-15 16:34

PIC32 digital tube program example
#include #pragma config JTAGEN =OFF char   Led ={0x42, 0xf3, 0x86, 0xa2, 0x33, 0x2a, 0x0a, 0xf2, 0x02, 0x22, 0x40, 0xf1, 0x84, 0xa0, 0x31, 0x28, 0x08, 0xf0, 0x00, 0x20, 0x1e, 0x0e, 0x0f, 0xbf, 0x23, 0x9b, 0x8b}; //led font library void spiout(char image ,int len) {     int i; PORTClearBits(IOPORT_B, BIT_9);     for
[Microcontroller]
Introduction to PIC microcontroller reset system module
The reset function of the PIC16F87X series microcontrollers is well designed. According to the conditions and reasons that cause the internal reset of the microcontroller, the reset system of the PIC microcontroller can be divided into five modules for introduction: 1. Power-on reset Every time the microcontroller
[Microcontroller]
PIC16F877A internal EEPROM read and write experiment using internal functions
/****************************************** ******PIC16F877A internal EEPROM reading and writing experiment******* Author:hnrain Date:2010-12-26 Version:V0.1 Email:hnrain1004@gmail.com Forum: http://bbs.cepark.com _______________________________ Experimental phenomenon: First write data 1 to 8 to bytes 0 to 7 of the
[Microcontroller]
PIC microcontroller SPI bus
Hello everyone, through the previous study, we have learned and become familiar with the usage and learning methods of ICD2 simulation burner and enhanced PIC experiment board. Now we will strike while the iron is hot and take another step forward to learn the working principle and usage of SPI bus. In this way, we ca
[Microcontroller]
PIC microcontroller SPI bus
PIC16F877A internal comparator usage demo
The purpose of the internal comparator is to detect the state change of the external sensor, such as the Hall switch, which outputs a high level when metal is approaching and a low level when metal is not approaching. Why not use the IO port to detect directly? I think a very different place between the comparator and
[Microcontroller]
Using PIC16F877A to collect mouse data
           Recently, I have used the single-chip microcomputer pic16f877a to realize the collection of mouse data. Through the analysis of the underlying communication principle and protocol of the mouse , the single-chip microcomputer pic16f877a is used to realize the collection of mouse data and the realization of LC
[Microcontroller]
Using PIC16F877A to collect mouse data
PIC16F628A LED running light sample program
#include p IC .h     __CONFIG(0x3f38); //Watchdog off, internal RC oscillation, RA6/RA7 as I/O  //----------------------------------- //Delay function  void delay()  {   int i; //define loop variable   for(i=5000;i 0;i--) //Loop count control      {  NOP(); // Time        consumed for one instruction cycle       NO
[Microcontroller]
32-bit MCU Knowledge Explanation: Microchip PIC32 Series (Part 2)
  PIC32 (General Purpose) Starter Kit Development Board Block Diagram   PIC32 (General Purpose) Starter Kit Circuit Diagram (1): PIC32MX CPU   PIC32 (General Purpose) Starter Kit Circuit Diagram (2): PIC18LF4550 DEBUG CPU   PIC32 (General Purpose) Starter Kit Circuit Diagram (3): Application Board Co
[Analog Electronics]
32-bit MCU Knowledge Explanation: Microchip PIC32 Series (Part 2)
Latest Analog Electronics 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号