Design of temperature detection node based on CAN bus

Publisher:EternalWhisperLatest update time:2010-07-14 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the test of the electronic ignition module, in order to simulate the real working conditions of the electronic ignition system, the electronic ignition module is often placed in an environment higher than normal temperature for electronic ignition experiments to obtain ignition parameter data closest to the real working conditions of the car. Due to the heat generated by the electronic ignition module itself, the temperature of its core components becomes an important factor affecting the performance of the electronic module; in addition, it is also necessary to consider whether the ambient temperature meets the requirements of simulating the real working conditions.

This article introduces a design scheme of temperature detection node using LM35 temperature sensor and PICMicro to detect the core module temperature and ambient temperature of electronic ignition module in the process of simulating automobile electronic ignition. It will explain the module structure, working principle and sampling value quantization method.

Node principle and structure

The temperature detection node is composed of sensor circuit, signal conditioning circuit, microcontroller application system, CAN bus interface, etc. The basic working principle of the circuit is: the sensor circuit outputs the sensed temperature signal to the signal conditioning circuit in the form of voltage, and the signal is input to the A/D sampling circuit after conditioning, and the ADC sends the digital value to the microcontroller system. The microcontroller system will monitor the real-time temperature. When the temperature exceeds the warning value and the dangerous value, the microcontroller will actively send a warning message to the host computer to remind the operator to check. The module logic structure is shown in Figure 1.


Figure 1 Logical structure of temperature detection node

The sensor circuit uses the temperature sensor LM35, the power supply voltage is 15V DC, the working current is 120mA, the power consumption is extremely low, the current changes very little when working in the full temperature range, and the voltage output adopts the differential signal mode, which is directly output from pins 2 and 3. The LM35 output signal passes through an LP filter composed of RC to filter out high-frequency noise interference.

The core MCU of this node is PIC16F87x, which is a low-power 8-bit microcontroller launched by Microchip. PIC16F87x has a reduced instruction set and an execution speed of 200ns. The CAN controller uses Microchip's MCP2510, the bus driver uses PCA82C250, the bus isolation circuit uses optocoupler 6N317, and the signal conditioning circuit uses LF412. The hardware structure of the temperature monitoring module is shown in Figure 2.


Figure 2 Hardware structure of temperature monitoring module

The signal conditioning circuit mainly completes the functions of sensor signal amplification and limiting, and adjusts the DC voltage of the sensor circuit output, which varies in the range of about 2V, to the voltage range that meets the AD interface of PICMicro. It should not exceed the AD sampling range, but also have a considerable signal accuracy. The microcontroller collects the temperature data of the sensor through the A/D sampling channel and calculates the temperature range.

The peripheral device circuit is the necessary peripheral device for the operation of the PIC16F87x minimum system. The PIC16F87x exchanges data with the MCP2510 through the SPI bus to complete the sending and receiving of CAN bus data packets. Its interface circuit is shown in Figure 3.


Figure 3 Interface circuit between PIC16F877 and MCP2510

Among them, SCK is the SPI bus clock, the SPI interface of the PIC16F87x module is connected to the SI, SO, and SCK of the MCP2510, and RA4 and RA1 control the chip reset and chip select of the MCP2510 respectively. INT accepts the interrupt request of the MCP2510.

System software design

System software process

In order to avoid malfunction due to interference, the software adopts some redundancy and fault-tolerant processing. When the A/D module processes the sampled data, software filtering measures are used to filter out the spike interference that may appear in the circuit.

The method is to sample five times continuously, remove the maximum and minimum values ​​through comparison and judgment, and take the average value after summing up the values ​​of the remaining three times. The average value is used as the effective data for the CPU to divide the temperature range. The parsing and encapsulation of the data packet follow the CAN application layer protocol. The main program flow is shown in Figure 4.


Figure 4 Main program flow

[page]

When the CPU detects an abnormal temperature, it will send an abnormal temperature alarm to the host computer according to the abnormal temperature range. This is the only data frame that the CPU of this node actively sends to the host computer. The temperature-related data of this node is stored in the buffer. When no data request from the host computer is received, the data in the buffer will be continuously refreshed by new data to ensure the real-time nature of the node data. The interruption process is shown in Figure 5.


Figure 5 CAN receive interrupt process

Quantization method of sample value

The accurate quantization of the sampling value is the key to the normal operation of the temperature control circuit. Here, the following conversion method is used for quantization. Assume that the voltage after signal conditioning is Ui, then -10V

Ui=-10V+ΔT•Kt=-10V+55℃×0.111V/℃=-3.895V。

After Ui is converted into digital quantity, the voltage value corresponding to each digital quantity is 19.531mV, which is represented by Ks. The corresponding relationship between the change of digital quantity and the change of temperature can be obtained: Kt/Ks=(0.111V/℃)/(19.531mV/digital quantity)=5.683 digital quantity/℃.

The digital quantities corresponding to other temperatures can also be calculated using the above method.

SPI interface Communication

PIC16F87x exchanges data with MCP2510 via the SPI interface.

The MCP2510 is designed to connect directly to the Serial Peripheral Interface (SPI) of many microcontrollers. External data and commands are transmitted to the device through the SI pin, and data is transmitted on the rising edge of the SCK clock signal.

The MCP2510 sends the instruction byte for all operations listed in Table 1 through the SO pin on the falling edge of SCK.


Taking PIC16F87x sending a read instruction to MCP2510 as an example, the SPI interface communication process is explained.

At the beginning of the read operation, the CS pin will be set to a low level. Then the read instruction and the 8-bit address code (A7~A0) will be sent to the MCP2510 in sequence. After receiving the read instruction and address code, the data in the address register specified by the MCP2510 will be shifted out and sent through the SO pin. After each data byte is shifted out, the address pointer inside the device will automatically increase by one to point to the next address. Therefore, the next continuous address register can be read. This method can be used to read the data in any continuous address register sequentially. The read operation can be ended by pulling the CS pin level high, as shown in Figure 6.


Figure 6 SPI interface communication timing

The temperature control node developed based on LM35 has strong working stability, high reliability, small size, high sensitivity, short response time, strong anti-interference ability, etc. The node is low-cost, and the devices are all conventional components, with high engineering value. This node has a CAN interface and can be used as an independent detection system or as a key part of a distributed test system. The upper layer protocols of CAN can be implemented in software, making the interface of this node flexible and not restricted by the upper layer protocols.

Reference address:Design of temperature detection node based on CAN bus

Previous article:NXP Car Radio CD/MP3 Player Solution
Next article:Full contact with car reversing radar: six generations of technology developed in five years

Latest Automotive 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号