Rumah> Blog> Multi-motor anti-backlash antenna control system based on CAN bus

Multi-motor anti-backlash antenna control system based on CAN bus

March 30, 2023

introduction

This article refers to the address: http://

Due to the system integration characteristics of the CAN bus, the application range of the CAN bus technology based on the vehicle body control system has far exceeded the field of automobile control, and has expanded to various other measurement and control fields such as the machinery industry, household appliances and sensors, and is recognized as an important international. Industrial fieldbus. As a motion control object, stepper motor is a mechanical actuator that converts discrete electric pulse signals into angular displacement. It has the advantages of simple structure, low cost, high positioning accuracy and error-free accumulation. It has been widely used in various applications. Automatic control system. With the development of microcomputers and microelectronics, this performance of stepper motors is bound to be more widely used. Therefore, the research on stepping motor control of CAN bus has obvious practical significance.

2 system overall design

The system can be used as a command sending host by a PC, and connected to the can bus through a bus-can interface conversion module. Each node is a module with a single-chip controlled CAN bus data transceiving function to control the stepping motor driver and the motor terminal. In the application layer of the PC, according to the pre-specified format, the data is sent from the usb interface to the single-chip microcomputer on the usb-can interface conversion module of the general device interface chip ch372 based on the usb bus. After the single-chip processing, the data is transmitted to the connected On the CAN bus of the node of the stepping motor driver, the control module of each node performs processing according to the received data information to realize the speed, forward and reverse rotation and stroke control of the stepping motor. Figure 1 is a system diagram of the design.

Multi-motor anti-backlash antenna control system based on CAN bus

Figure 1 system overall plan

3 hardware design

The hardware of the system includes the design of the usb-can interface module and the can node receiving module circuit.

3.1 usb-can interface module circuit design

The bus-can interface module is mainly composed of 51 single-chip microcomputer, ch372, sja1000 and 82c250. The host sends the data to the single-chip microcomputer through ch372, and the single-chip microcomputer sends the data to the can bus through sja1000. The main components from the USB port of the PC to the CAN bus and their connections are shown in Figure 2. In Figure 2 and Figure 3, both vdd and vcc are +5v DC power supplies. The ch372 supports two power supplies, +5v and +3.3v. This design uses +5v, which can be obtained directly from the usb port, simplifying the circuit. design. The ch372 and sja1000 connected to the single-chip microcomputer realize the read/write process of non-interference by the chip select signal, and complete their respective tasks.

Multi-motor anti-backlash antenna control system based on CAN bus

Figure 2 Schematic diagram of the usb-can interface conversion module

To control its function, it must have a peripheral expansion interface to form a complete can communication system. This design uses pca82c250 device as the interface between the sja1000 and physical bus of the can controller, providing the differential transmission and reception capabilities of the bus. The signals of the canh and canh lines, and the processed signals are transmitted to the can receiving area of ​​the control unit. In order to protect the chip and improve the anti-interference ability, a high-speed opto-isolator 6n137 is added between the controllers sja1000 and 82c250. The bus network must be connected with 120 ohm matching resistors at both ends to greatly improve the anti-interference and reliability of the communication.

3.2 Can node module circuit design

The can interface portion of the can node module has the same circuit design as the can interface portion of the usb-can interface conversion module, as shown in FIG. After the MCU processes the received data, it displays from p1.0 and p1.1, and outputs the motor rotation direction signal and the frequency and the number of pwm pulse signals of a certain number to the motor driver to realize the motor control. In order to improve the anti-interference ability, add opto-isolator tlp5621, because the output digital signal frequency is not very high, the conversion time of tlp5621 has met the requirements. For the safety of motor operation, two mechanical emergency stop buttons can be set at appropriate positions around the motor load. When the load fails, press the button to notify the MCU to stop the pwm output and realize the motor fault emergency stop.

Multi-motor anti-backlash antenna control system based on CAN bus

Figure 3 can node module circuit schematic

4 software design

4.1 Communication Protocol

After the PC client application software sends the corresponding control command, using the ch372 interface protocol provided by the computer application layer, the usb port will send one or more double-byte data information in turn, and the MCUs in the two modules process the respective receiving. The data is obtained to achieve motor control. Each double-byte data bit is defined as follows:

Multi-motor anti-backlash antenna control system based on CAN bus

(1) Motor selection: Each different high byte data has a one-to-one correspondence with the value of the acceptance code register in the sja1000 of each can node, so that the low byte control command can accurately reach the corresponding motor driver.

(2) Motor start and stop selection: 1 is start and 0 is stop.

(3) Motor forward and reverse selection: 1 is forward rotation and 0 is reverse rotation.

(4) Motor speed selection: There are four gear speeds from 00 to 11 respectively. Change the speed by changing the pulse period.

(5) Motor stroke selection: from 0000 to 1111 represent the number of pulses of sixteen different strokes.

4.2 Software Process

Each double-byte data sent by the pc machine is the first high byte, and the low byte is sent later. The usb bus interface chip ch372 selects the one-way data stream communication mode. After receiving the data block, the external interrupt request method is used to notify the single chip. After receiving the data, the MCU enters the interrupt service routine after responding, and writes the high byte of the first double-byte data to the identification code byte 1 of the data transmission buffer of the can controller sja-1000 in the reset mode. The address, the low byte is written to the address of the tx data 1 of the data transmission buffer of the controller sja1000, the controller sja1000 enters the working mode by the reset mode, and sends the data to the can bus. After the data is sent and the other party receives it, The controller returns to the reset state, and writes the received high byte of the next double-byte data to the address of the identification code byte 1 of the data transmission buffer of the can controller sja1000 in the reset mode, low word Section writes the address of the tx data 1 of the data send buffer of the can controller sja1000, the can controller sja1000 re-enters the working mode by the reset mode, and sends the data to the can bus... until read After all the data in the ch372 buffer is sent, the MCU exits the interrupt and waits for the next interrupt. Figure 4 shows the conversion module program flow.

At the data receiving end of the can node module, after receiving the data of the saj1000 buffer, the MCU notifies the other party to receive the data and clears the sja1000 receiving buffer, and then performs data processing, and controls the motor action through the i/o port of the single chip. After the data is processed, Prepare for the next data reception. Figure 5 shows the can node module flow.

Multi-motor anti-backlash antenna control system based on CAN bus

Figure 4 usb-can module flow

Multi-motor anti-backlash antenna control system based on CAN bus

Figure 5 can node module process

5 Conclusion

The can field bus has the characteristics of long communication distance and fast transmission speed. The system can realize fully integrated digital control of the motor. Based on the controllability of the stepper motor stroke, the system can achieve precise position control of moving objects. In addition, a mechanical stop button such as a limit position can be added to the can node module to make the motor run safely and reliably.

Hubungi kami

Author:

Ms. Zoe Zhong

Phone/WhatsApp:

+8618617178558

Produk populer
You may also like
Related Categories

Email ke pemasok ini

Subjek:
Ponsel:
Email:
Pesan:

Your message must be betwwen 20-8000 characters

Yetnorson Antenna Co., Ltd, didirikan pada 2010, adalah perusahaan profesional yang terlibat dalam penelitian, pengembangan, penjualan dan layanan antena komunikasi, Yetnorson memiliki spesialisasi dalam 2 g/3 g/4 g/wifi/antena TV, dan berbagai konektor RF dan rakitan kabel antena. Kami memiliki...
Newsletter
Alamat
Room #101,201,301,5BLDG , No.4 of XinWuCun New Area ,Shabo community Maluan Street Pingshan District, Shenzhen ,Guangdong , China, Shenzhen, Guangdong China

Hak cipta © 2024 Yetnorson Antenna Co., Ltd. semua hak dilindungi.

Hak cipta © 2024 Yetnorson Antenna Co., Ltd. semua hak dilindungi.

We will contact you immediately

Fill in more information so that we can get in touch with you faster

Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.

Kirim