introduction
In industrial control, in order to ensure the reliable operation of the system, it is necessary to detect the surrounding environmental variables (such as temperature, air pressure, humidity, etc.). The usual practice is to connect the signals collected by sensors distributed in various places to the monitoring center through their own lines. This method effectively completes the detection task but also causes a great waste of line resources. Therefore, the requirement of simplifying the line layout is proposed. CAN (Controller Area Network) is a serial communication protocol that can effectively support distributed real-time control with a high security level. At the same time, in theory, there is almost no limit on the nodes in the CAN bus network. Based on this, this design uses a CAN bus data acquisition system based on a digital signal controller as a CAN node, and places a CAN node in each area that needs to be monitored. Each node communicates with the monitoring center through the CAN bus. The overall block diagram of the system is shown in Figure 1.
1 Hardware composition
The data acquisition system consists of two parts: the control part, including the anti-aliasing filter of the front-end signal and the 12-bit analog-to-digital converter for signal acquisition; the CAN bus interface circuit part, consisting of the MCP2515CAN protocol controller and the MCP2551 high-speed CAN transceiver. The system receives three signals, TEM, PRE, and RH are temperature, air pressure, and relative humidity respectively.
1.1 Control part
dsPIC30F3013 is a sensor series digital signal controller produced by Microchip. The controller adopts a 16-bit (data) modified Harvard structure with an enhanced instruction set, including strong support for DSP. The working speed can reach up to 30MIPS, and it has an internal 10-channel 12-bit analog-to-digital converter with a maximum conversion speed of 200 ksps.
In industrial control systems, due to the presence of various types of noise, an anti-aliasing filter circuit needs to be added to the signal acquisition end, as shown in Figure 2.
The anti-aliasing uses a Sallen Key second-order low-pass filter. Since the environmental variables are all slow variables, the filter bandwidth is set to 30Hz. The values of R1, R2, C1, and C2 in the circuit determine the characteristic frequency f0 of the anti-aliasing filter, and also ensure 12-bit resolution at a 10ksps analog-to-digital conversion rate. In order to ensure that the signal can pass well throughout the entire passband range, the quality factor Q of the SallenKey filter needs to be adjusted. The Q value is determined by formula (1):
The amplitude-frequency characteristics of the Sallen Key filter show that the frequency characteristics are optimal when the quality factor is between 0.7 and 0.9. The Q value is selected as 0.8.
The 12-bit ADC module of dsPIC30F3013 is used for data acquisition. The three environmental signals are scanned cyclically, and an interrupt is generated after each 12 sampling/conversion processes are completed. During the interrupt process, four average value digital filtering and corresponding parameter format adjustment are completed, and then transmitted to the CAN protocol controller through the SPI interface.
1.2 CAN bus interface circuit part
The CAN bus interface circuit is shown in Figure 3.
The CAN protocol controller uses the MCP2515 produced by Microchip. MCP2515 is an independent CAN controller with an SPI interface. It fully supports the CANV2.0B technical specification, has a communication rate of 1Mb/s, and includes 2 receive buffers, 6 29-bit acceptance filter registers, 2 29-bit acceptance mask registers, 3 transmit buffers with priority setting and transmission abort, and a high-speed SPI interface (10MHz).
The interface between MCP2515 and MCU can be flexibly configured. You can directly connect the digital I/O pins of MCU through pins (such as TXORTS) and use the read and write functions of digital I/O to control the state of MCP2515; you can also directly use the SPI instruction set of MCP2515 to implement all functions. The SPI instruction set used to control MCP2515 is listed in Table 1.
The dsPIC30F3013 communicates with the MCP2515 through the SPI interface. The SPI module of the dsPIC30F3013 works in the master mode, and the MCP2515 works in the slave mode. The dsPIC30F3013 accesses the internal registers of the MCP2515 by calling SPI instructions.
The MCP2551 is a fault-tolerant, high-speed CAN transceiver that fully complies with the ISO-11898 standard, including the 24 V voltage requirement. It can operate at rates up to 1 Mb/s.
2 Software Design
As the control core, dsPIC30F3013 is responsible for data acquisition and CAN communication. The workflow of the data acquisition part is shown in Figure 4.
The 12-bit ADC module of dsPIC30F3013 contains a 16-word dual-port read-only buffer from ADCBUFO to ADCBUFF to buffer the ADC conversion results. This application samples 3 signals and uses scan input. After 12 ADC conversions, the data of each conversion is written to ADCBUF0 to ADCBUFB in sequence. That is, the AD-CBUFs coded 0, 3, 6, and 9 store the sampling values of the same signal at different times. By adding the results of these 4 buffers and then shifting them right by 2 bits, the 4-time average digital filtering of the signal can be achieved. The other two signals are stored in the related ADCBUFs and the processing method is the same.
The SPI interface of MCP2515 supports 0,0 and 1,1 operation modes. External data and commands are transmitted to the device through the SI pin, and the data is transmitted in at the rising edge of the SCK clock signal and transmitted out through the SO pin at the falling edge of SCK. After the CS chip select pin is set to a low level, the first byte that MCP2515 hopes to receive is the instruction/command byte, which requires that when calling a command, the CS pin must be pulled high and then lowered to a low level. Using the load TX buffer instruction, the 8-bit address required for the general write command is cancelled. Only one of the 6 addresses set by the address pointer can be selected to quickly write data to the transmit buffer.
The following uses the MCP2515 loading TX buffer as an example to illustrate the data transmission process. The timing of loading the TX buffer is shown in Figure 5. This application has 3 signals, each of which requires accuracy to 2 decimal places, so the processed data format uses floating point type. A floating point number requires 4 bytes. In order to make the monitoring center easy to manage, a standard data frame containing a 4-byte data length is used to send data. Now take loading TX buffer 0 as an example to illustrate a data transmission operation, as shown in Figure 6.
The SPI module of dsPIC30F3013 has two optional working modes: 8-bit and 16-bit when sending and receiving data. The SPI instructions, internal register addresses and data of MCP2515 are all 8-bit, so when initializing the SPI module, clear MODE16 (SPI1CON "10") to configure the communication data to 8-bit width.
Conclusion
This article introduces a data acquisition system with Microchip's dsPIC30F3013 as the control core, MCP2515 as the CAN controller and MCP2551 as the CAN transceiver. The system and the sensor form a CAN node, which effectively improves the current situation of wide-range, messy wiring and poor anti-interference ability of the monitoring part of the industrial control system. At the same time, it makes the entire monitoring system easier to expand. Practice has proved that this design is reliable and high-performance. However, when the system works in a thunderstorm area, lightning strikes may occur. In the subsequent design, a high-speed optocoupler will be used to isolate the CAN controller and the CAN transceiver.
Previous article:Research on CPLD Software Update Scheme Based on DSP
Next article:Implementation of speech recognition system based on TMS320VC5507
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- (C-Wireless Charging Electric Car) Liaoning Province First Prize_C
- Benefits of Spread Spectrum
- Don’t sell your old phone to buy a new one, learn how to make your own server!
- Can anyone recommend an inexpensive isolation amplifier product, either a chip or a module, with an accuracy of 1% and DC signal sampling?
- Problems with STM32F767 driving Bluetooth module
- Infineon Position2Go Development Kit Review @4. Development
- HFSS Wave Ports and Lumped Ports
- Using the MS-formula library of st 3.1, the scan results do not contain the device name
- What does it mean when the port latch is set to 1? How should I understand this sentence? It would be better if there is a picture to illustrate it.
- Simplifying Equalization Design for USB 3.0 Systems