Remote control system for battery charging and discharging device based on RS 485 bus

Publisher:calmrsLatest update time:2011-09-26 Source: 互联网Keywords:Battery Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

As a main DC power source, batteries play an important role in various fields such as industry, aerospace, and civil use. In the regular battery charging and discharging operation and maintenance, the existing charging and discharging devices work too long and have low working efficiency; the status of the charged and discharged batteries cannot be monitored in time, and the working environment at the charging and discharging site is harsh, which is detrimental to the health of the operators. In response to these problems, a remote-controlled intelligent charging and discharging device is designed. The device mainly sends the collected battery voltage and current signals to the upper computer, the PC, after processing through the lower computer, the single-chip microcomputer, and then realizes the control and real-time status display of charging and discharging through the visual human-machine interface. Considering that the system should have strong anti-interference ability, long transmission distance, simple engineering wiring, suitable for expansion, and easy control, the RS 485 bus is used to realize long-distance data transmission.

1 Overall design of remote communication scheme

The RS 485 used in this system is a half-duplex interface, a two-way single-channel connection mode. In the entire system, he uses a twisted pair to connect the charging and discharging devices distributed in different geographical locations together. In each device, the single-chip microcomputer acquisition module and the command control module serve as the lower computer. The network structure diagram is shown in Figure 1. The serial port of the PC is connected to the network through a 232-485 converter. In addition, a half-duplex low-power transceiver device MAX485 is added to provide the microcontroller with a conversion between the TTL level and the RS 485 interface level. The differential balanced transceiver MAX485 is an interface chip of RS 485, which integrates 1 driver and 1 receiver. The driver in the disabled state and multiple receivers hanging on the transmission line will not affect the normal transmission of the signal, so multiple drivers and receivers can share a set of common transmission lines. 32 stations can be hung on the network, and each station has a fixed address. Only one station can send data at the same time, and the other stations can only be in the receiving state to avoid data collision errors.



Figure 2 is a simplified output schematic diagram.



The microcontroller, MAX485 and the charge and discharge drive circuit are connected to the RS 485 bus as a station. A and B are the interfaces of the bus, DI is the sending end, RO is the receiving end, connected to the serial port of the microcontroller, and the microcontroller controls the sending and receiving through the pins.

2 Communication Hardware Design

The circuit connection between MAX485 and the microcontroller is shown in Figure 3.


Pin 1 (RO) is the receiving output terminal. When the receiving output enable (pin 2 (/RE)) is low, if VA-VB>200 mV or A, B are open, the output of pin 1 is high; if VA-VB<200mV, the output of pin 1 is low; the low level of the receiving output enable terminal of pin 2 is effective, pin 3 (DE) drives the output enable terminal, pin 4 (DI) drives the input terminal, pin 5 is ground, pins 6 and 7 are bus interface terminals, and pin 8 is the power supply terminal. The microcontroller converts the collected battery status information into a current loop signal suitable for transmission through MAX 485. The signal has the characteristics of long transmission distance and strong anti-interference ability to ensure that the signal is transmitted to the 232/485 converter terminal without attenuation. The 232/485 converter mainly completes the conversion of the current loop to the RS232 interface of the microcomputer, so that the communication between the PC and the single-chip microcomputer can be realized. Its principle diagram is shown in Figure 4. The user controls the work of each station on the network through the interface of the PC, and the equipment of each station can also send feedback information to the PC for real-time monitoring of the battery charging and discharging device.

3 Communication software design

3.1 Network protocol

RS 485 is a hardware connection specification standard and does not specify the communication protocol used. In order to ensure that commands and data can be correctly transmitted on the network, a network protocol must be provided on the data link layer to check and correct errors when the bit stream of the physical layer is wrong. See (see Figure 1) for a simplified diagram of the remote control network structure. The microcontroller acquisition subsystem uploads the acquired battery status to the PC. The command control subsystem mainly accepts various commands from the PC and controls the charging system. The master-slave protocol and serial port communication are used between the two subsystems and the PC. The communication parameters are set as follows: transmission speed: 9600 b/s; check bit: none; data bit: 8; stop bit: 1.

3.1.1 The host computer sends a control command to the slave computer

(1) The host computer sends

Each charging module extended on the twisted pair must have a unique address number to ensure that the PC can accurately find the required charging module when sending a control command. The command format of the distributed module is divided into two parts: sending and receiving. The format is as follows:



The information represented by each frame is as follows:

Start bit: the start mark of the communication between the single-chip microcomputer and the PC; Address bit: the address number of the lower computer is designed to be 01H~1FH (i.e. 1~31), and the address of the upper computer is 00H.

Command type: 0 is a stop command, 1 is a charging command; Set value: when the control command is charging, the value is the charging current; (2) The control board returns: Y (if the reception is successful, it returns Y).

3.1.2 The lower computer sends the collected data to the upper computer

(1) The lower computer intermittently sends the voltage and current collection values ​​to the upper computer every 10 s;



(2) The collection board returns 7 consecutive characters (no spaces are inserted in the middle), the format is as follows: the



first 3 characters are the battery terminal voltage, and the next 3 are the charging current values. The battery terminal voltage is represented by 3 characters, such as: 51.2 V~512 V. The charge and discharge current is represented by 3 characters: 15.7 A ~ 157 A (if the current value is <10 A, add 0 on the left, such as: 8.9 ~ 089). Note: All characters are ASCII codes corresponding to decimal values. Considering that the microcontroller needs to send the collected data in time, a non-handshake communication mechanism is used, and it keeps sending without waiting for the confirmation frame. In addition, if the receiver does not receive the data within the agreed time, a reset frame is sent, and both parties return to the beginning of the communication program and clear the buffer, and then resynchronize.

3.2 MCU Programming

In the main program, the MCU and its memory are initialized first, and then an infinite loop is entered to wait for the interrupt program. The interrupt program includes: A/D acquisition interrupt, which mainly processes and saves the collected voltage and current instantaneous signal values; the other is the serial communication interrupt program, whose main function is: when receiving an address, determine whether it is the local address, if so, determine the control command, otherwise end. Continue to execute the data command received by the PC, which represents shutdown, charging, discharging and other commands. By comparing the string, the command to be executed is determined. The specific process is shown in Figure 5.



3.3 PC Programming

The human-computer interaction interface of the PC is developed and implemented by C++Builder language. It mainly includes communication module, data display and processing module. After comprehensively considering the development efficiency and program function, Win32API function is selected to write the communication program. This function has been declared in C++Builder and can be directly referenced. In order to improve the response speed of the communication program, the program implements multi-threaded communication through the Thread class. In the main thread, open the serial port and send data. In addition, establish another thread to monitor the serial port. If data is received, call the data analysis and processing thread, display the status curve and enter the data into the database. Part of the program code is as follows:


Taking the real-time monitoring of charging and discharging of 3 sites as an example, the real-time information shown in Figure 6 can be displayed on the PC.



4 Conclusion

The remote charging and discharging device control system based on RS 485 can realize the control of up to 32 sites on a PC. Since RS 485 adopts the method of balanced drive and differential reception, it can fundamentally eliminate the signal ground wire and has a strong ability to resist common-mode interference signals. It also has a pair of line drivers and receivers, which can transmit signals over long distances, up to 1,200 m. And the transmission structure is simple, low cost and practical. It can be widely used in charging and discharging sites with harsh working environments and time-consuming and laborious work.

Keywords:Battery Reference address:Remote control system for battery charging and discharging device based on RS 485 bus

Previous article:UPS power sharing battery pack solution
Next article:A brief discussion on the electromagnetic compatibility of induction lamps

Latest Power Management 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号