Coal gangue sorting system based on ARM core and CAN bus
2026-04-06 06:39:17··#1
Abstract: This paper briefly introduces an online identification and automatic sorting system for coal gangue composed of an ARM (Advanced RISC chips) microcontroller and CAN (Controller Area Network) bus technology. The hardware circuit connecting the ARM microcontroller AT91M40800 and the CAN bus controller SJA1000 is presented. The data communication implementation technology between the hardware interfaces is discussed, and the software design flow for data communication is given. A CPLD (EPM7128) is used to adjust the timing and implement online modifications. Experiments demonstrate the feasibility of the design and explore a new coal preparation technology. Keywords: ARM microcontroller; CAN bus; coal gangue; sorting system; CPLD Introduction With the continuous development of embedded technology, high-performance, low-power, and low-cost 32-bit RISC chips with ARM microcontrollers are showing a strong development trend. The combination of embedded systems and fieldbus technology, combining the advantages of both, provides a new transformation scheme for traditional coal preparation technology. This paper integrates embedded technology and fieldbus technology to design a new online identification and automatic sorting system for coal blocks and gangue. The principle block diagram of the online identification and automatic sorting system for coal and gangue is shown in Figure 1. According to the coal preparation process requirements, this system mainly consists of the following three parts: Figure 1 Block diagram of the online automatic sorting system for coal and gangue (1) Detection part: It consists of a feed hopper, conveyor belt, CCD camera, image data acquisition circuit, etc. The raw coal mined often contains gangue, which must be picked out from the conveyor belt. The CCD camera sends the coal and gangue images to the image data acquisition circuit for conversion. The converted information is sent to the ARM microcontroller and transmitted to the PC for processing through the CAN bus network. (2) Identification and control part: It consists of a computer, ARM microcontroller and measurement and control equipment. It is the core of the whole system. The ash content of coal and gangue is calculated according to the pattern recognition algorithm. After the ARM microcontroller identifies and judges the coal and gangue, it completes the control action. If it is judged to be coal, the control part does not act, and the raw coal naturally falls into the coal hopper and is transported away from the coal block channel. If it is determined to be gangue, a control signal is sent to open the valve so that the gangue falls into the gangue channel. (3) Sorting mechanism: It consists of valves, material hoppers and system power supply equipment, etc. It completes the automatic sorting and transportation of coal and gangue in multiple channels through the CAN bus network. Chip introduction AT91M40800 AT91M40800 is a chip with high cost performance in the 16-bit/32-bit microcontroller series based on ARM7TDMI core of ATMEL. Its core is a high-performance 32-bit RISC (Reduced Introduction Set Computer) architecture and has a 16-bit (thumb) instruction set. It is directly connected to various off-chip memories including FLASH through the programmable external bus interface (EBI). The 8-priority interrupt vector controller and the on-chip peripheral data controller significantly improve the real-time performance of the device. The AT91M40800 integrates an ARM7DMI ARMThumb processor core, providing 8kB of on-chip SRAM, 8 chip select lines, 32 programmable I/O ports, a software-programmable 8-bit or 16-bit data bus, a maximum addressable space of 64MB, two USARTs (each with two dedicated peripheral data controller channels), a built-in programmable watchdog timer, 8 priority, individually maskable vector interrupt controllers, 4 external interrupt control registers, 4 external interrupts, including one high-priority, low-latency interrupt request, 3 external clock inputs, and a 3-channel 16-bit timer/counter. The SJA1000 addresses the need for centralized management and information processing due to the distance between the coal bunker, gangue pile, and sorting workshop. Fieldbus technology can transform individual, distributed measurement and control devices into network nodes, connecting them via a bus to form a network and control system capable of communicating information and collaboratively completing automatic control tasks. CAN communication speeds can reach up to 1Mbps, with a direct transmission distance of up to 10km (at speeds below 5kbps). It can connect to up to 110 devices, enabling simultaneous multi-channel sorting and transportation tasks. The SJA1000 is a stand-alone CAN bus controller manufactured by Philips, used in controller area networks (CAN) in automotive and general industrial environments. It is a replacement for the Philips PCA82C200 CAN controller (BasicCAN), adding a new operating mode (PeliCAN mode) that allows for easy connection to processors of different modes to form a CAN control network. Figure 2 shows the schematic diagram of the interface circuit between the SJA1000 transceiver and the AT91M40800 chip. Figure 2 shows the schematic diagram of the interface circuit between SJA1000 and AT91M40800. The EPM7128 is used to perform signal conversion and configuration between the interfaces. The inputs of the EPM7128 come from the AT91M40800's chip select signal NCS2, data lines D0-D7, address lines A0-A1, read signal NRD, write signal NWE, and system reset signal RST. After internal logic synthesis, it generates the functional signals required by SJA1000. Based on the requirements of each chip's signal lines and the allocation of port addresses, the input/output logic relationship expression of the CAN bus transceiver can be written as follows: CAN = NCS2 * A0 CAN RAN = NCS2 * A0 * (NRD + NWE) CAN RD = NRD CAN WR = NWE CANRST = NCS2 + RST The address port of SJA1000 is selected as 400000H, the data port address as 400001H, and the reset port address as 400002H. Since the address and data of the CAN controller SJA1000 are multiplexed, the address signal on the bus can be latched by the falling edge of the ALE signal. However, the address and data buses of the AT91M40800 are provided separately and cannot be directly connected to the address and data buses of the SJA1000. Therefore, the key to solving the interface problem between the SJA1000 and the AT91M40800 lies in how to send the signals required to access the SJA1000. The method used here is to complete the I/O operation in two steps. The first time, the address value is sent to address port 400000H as the unit address of the SJA1000. At this time, the chip select is not activated, and the data is latched on the AD0~AD7 bus. When accessing the data port 400001H for the second time, the SJA1000 is selected, and under the action of the ALE signal, the address value from the first step is written to the SJA1000, and the CPU performs read/write operations on the SJA1000. Reset can be divided into system reset and program reset. The system reset signal RST and the program reset signal are logically ORed in the EPM7128; either one being valid ensures a reliable reset of the SJA1000. To guarantee reliable data communication, a 120Ω terminating resistor is connected to each end of the CAN bus for impedance matching. The SJA1000's TX1 pin is grounded through a 10kΩ resistor, and the RX1 pin level must be maintained above 0.5Vcc. Otherwise, the required logic level for the CAN bus cannot be achieved. If the communication distance is short and environmental interference is minimal, the 6N137 opto-isolation circuit can be omitted. In this case, the VREF pin of the 82C251 can be directly connected to the RX1 pin, simplifying the circuit. The AT91M40800 microcontroller communicates with the CAN bus via the External Bus Interface (EBI), which generates signals to access external memory and external devices. The EBI supports different access protocols and can achieve single-cycle access to external devices. In the design, the EBI is set as follows: (1) Select an 8-bit data bus; (2) Select a standard read protocol; (3) Select an 8-cycle wait time; (4) The base address of the chip select line NCS2 is 400000H. All programs are written in C language using the AT91 library, which has the advantages of strong readability, easy portability, simple development, and convenient debugging. Correct initialization is the foundation for the normal operation of the program. The system initialization mainly involves the initialization of the AT91M40800 microprocessor and the SJA1000 (the SJA1000 operates on a 16MHz crystal oscillator). The initialization process is shown in Figure 3. Figure 3. Communication Software Initialization Flowchart. Conclusion The online identification and automatic sorting system for coal gangue, constructed using the AT91M40800 ARM microcontroller chip and the SJA1000 CAN bus controller, represents a novel CAN bus network system compared to traditional MCU-based CAN bus networks. The ARM microcontroller-based embedded system and CAN bus processing system offer excellent real-time performance, reliability, and flexibility, providing a new approach to outdated coal preparation technologies.