Design of Electric Bicycle Controller: Computer and Information Science
Design of Electric Bicycle Controller: Computer and Information Science
Design of Electric Bicycle Controller: Computer and Information Science
May, 2009
(6) small motor volume and light weight, (7) without mechanical commutator, and high reliability, (8) the motor control system is simpler than asynchronous motors. The brushless DC motor is usually composed by the principal part of the motor, the rotor position sensor and the power switch circuit. Figure 1 is the principle frame chart of the brushless DC motor. The Hull sensor in the figure is the rotor position sensor, and its function is to detect the position of the motor rotor, offer the position information of rotor for the electric commutator, and realize the electric commutation without touching. The inverter of the switch circuit in the figure adopts three-phase and six-beat break-over mode, and in each moment, there are two phases to be broken over, and the other phase doesnt break over, and the winding of each phase will continually be broken over by 1200 electric angle, and the stator winding current will change phase once in each 600 electric angle. The motor character circumrotates in 3600 electric angle clockwise, and the state characters of three-route position sensor signal change from 101-100-110-010-011-001. The time that the state characters change is the time that the stator winding current will change phase. The I/O ports of MCU could be taken as the inverter upper and lower bridge arm control ports to realize the control of phase change. The inverter adopts three-phase star structure, and it is composed by six MOSFET pipes with N channels, adopts the NAND gate to realize the hardware locked logic of upper and lower arms and ensure that the upper bridge arm and the lower bridge arm will not break over in same phase. The upper bridge arm drive is composed by voltage-ascending circuit and dynatron drive circuit. When failures occur in the system, MCU locks the three-phase upper and lower bridge arms of the inverter through the control character, and the motor will stop to run. 3. Hardware design of controller The design idea includes that the system adopts three switch-type Hull sensors to be the position sensors which send the position signals of motor rotor to the I/O port of MCU. The main control chip comprehensively controls the motor according to the designed software or signals inputting from the rotor handle and the voltage and current values tested, and the MCU transmits PWM signals and control the work current of motor through the dutyfactor of PWM signals, and accordingly realize the control of speed. The system uses the inverter to realize the phase change of motor. For the control of main control chip, three Hull components in the brushless DC motor detects the position of the rotor, and transmits this signal to the MCU to produce interrupt, and the MCU inquires the table and finds out two phases which should break over at the next moment according the Hull signals, and transmits the signal to the driver bridge of MOSFET through PWM output port, so the breaking over or shutting off of MOSFET are controlled. At the same time, MCU computes the time difference between each two continual Hull signals through the counter in the chip to obtain the rotate speed of the motor, and finds out the difference between the reference speeds obtained from the rotor handle with the rotate speed, i.e. the speed error. Implement PI modulation to the speed error and output the reference current. Obtain the actual current from sampling resistance, and implement PI modulation to the current, output PWM wave to corresponding MOSFET breaking over, and modulate the motor rotate speed through changing the dutyfactor of PWM, so the double closed loops speed modulations of speed loop and current loop are realized. The whole controller takes the LPC2114 MCU as the control core, and it acquires various signals (such as the speed modulation signal, the phase change signal of Hull sensor, the voltage signal of the storage battery and the current signal of motor) to dispose according to enacted control mode, and outputs control signals. The signals acquired by the MCU mainly include following sorts. (1) The signal of Hull sensor. Three-route signal can be directly connected through resistance pulling-up and capacitance filtering, and when the corresponding Hull signals changes, the motor control unit will spring the zero-pass interrupt and phase-change accident, and close and open corresponding power MOSFET through catching the register value of signal edge, and in such cycle, the system could control the connection and breaking of three-phase winding to realize the running of the motor. (2) The Hull rotor handle signal. The rotor handle signal is a simulation voltage signal, and the rotate angle is in direct ratio to voltage. The AD sampling value of the signal corresponds with reference rotate speed, and the voltage modulation and speed modulation could be realized by modulating the chopping ratio. (3) The current signal. The main loop current signal of motor is acquired by the sampling resistance. The current signals are amplified by the operation amplifier in the chip, and the output pin connects with AD interiorly, and it can sample the current, and it also connects with one port of the comparer in the chip, and the other port of the comparer connects with the over current reference voltage, and when the current is too higher, it will spring the over-current interrupt. The peripheral circuit in this part is simple, and it only needs resistance and capacitance to realize the current amplifying sampling and over-current protection. (4) The input of accident. Under the loading condition, the instant pinnacle current will bring impact to the motor when the motor starts up or meets accidents, and the users of electric bicycle will feel uncomfortable. So input the voltage
127
Vol. 2, No. 2
signal of current into the comparer, and when the pinnacle current occurs, the comparer outputs the negative pulse, and the hardware will automatically stop the PWM output, and spring the interrupt to dispose. (5) Other signals. The brake signal is the switch signal. When braking, the high level is effective, and when MCU reads in high level, it stops PWM outputs and implements corresponding disposal. For the under-voltage signal of the storage battery, the batter voltage meets with AD in the MCU through voltage division, and the voltage is supervised by MCU. When the battery voltage is under 43V, the system gives under-voltage signals and outputs cut-off to prevent the damage of the battery because of over-discharge. 4. System software design The software design is the important part of the system design, and it controls various functions with MCU together, and the software design in the system is composed by the main program and the interrupt service subprogram. The software design adopts modularization programming idea and the structured programming idea. The main program mainly includes the part of initialization and the part of cycle main body (seen in Figure 2). Where, the part of initialization includes the initialization of system resource and the initialization of various variables. The part of cycle main body mainly includes A/D sampling rotor handle signal and the voltage of power supply, reading brake signal to disposal and double closed loop speed modulation, and the main program will first inspect the voltage of storage batter and the brake signal in every cycle, and inspect whether there is stopping signal after every speed modulation ends. The over-current control is divided into two sorts in the program. For the type 1 of over-current, the present current exceeds the rating work current, but it is smaller than the enacted type 2 of current (failure current), and here if only properly reducing the output of PWM, the loop current will be reduced, and the disposal program is in the closed loop speed modulation. For the type 2 of over-current, the present current exceeds the enacted failure current, and the hardware forbids the output of PWM, and inspects the current continually, and when the current is smaller than the rating current, the hardware will make PWM output, and this program is in the interrupt disposal of accident, and this sort of current control method could better protect the current, avoid the situation that the current increases suddenly and stop immediately, and make the whole system more comfortable and conveniently to use. The interrupt service subprogram mainly includes voltage zero-pass interrupt, phase-change interrupt and serial interrupt. The zero-pass interrupt mainly feels the change of Hull sensor signal, and offers time interval of rotor in each 600 electric angle to measure the speed. The hardware of phase-change interrupt springs the connection and closing of the corresponding power pipe and pre-writes the register value at next phase-change. The serial interrupt program is used to communicate with the host computer. 5. Notices In the design of the electric bicycle controller, we find following problems and implement corresponding treatments to them. (1) The confirmation of sampling time for the brushless motor controller of electric bicycle The brushless motor should exactly test the position of rotor permanent magnet, and use the electric switch to switch different winding to obtain sustainable drive. The system uses three switch Hull sensors to test the position of permanent magnet relative to the stator loop, and the controller outputs corresponding control signals to drive the electric switch to supply power to the motor according to six sorts of different signals output by three Hull sensors, which is the so-called six-step phase-change method. From the principle of motor, the phase-change must be timely, or else, it will induce out-of-step of motor, and the motor noise will increase, and the efficiency will reduce and the motor and the controller will be burned. At the maximum rotate speed, electric phase changes the phase in about every 1.2ms, and according to the actual using effect, the software should detect the change of phase-change signal in about 0.12ms of the response time, and output the phase-change drive signals. Considering the phase-change signal input to the MCU is easy to be interfered, and the influence of filtering capacitance on the line, the MCU program should continually read three times at least when reading the phase-change signal, and when three times signals are completely consistent, the value can be adopted as the true value of phase-change signal, which is the phase demodulation. After the phase change signal is acquired, we compare the vale with the last value, and if they are same, there is no phase-change, and if they are different, a corresponding drive signal should be acquired according to the value to drive the electric switch. We can use the item comparison method and the table query method to realize this process. Because the table query method is quick, so we adopt the table query method in this design. (2) The smoothness problem of speed modulation for electric bicycle Because of the use of DC power supply, the speed of the motor should depend on modulating the voltage of the two ports of the motor to modulate, and the simple method is to use the PWM pulse width modulation to modulate the voltage of the two ports of motor. The work period of PWM should be selected according to the using environment of the motor, and too low frequency will produce high frequency noise that human ears can listen obviously and the
128
May, 2009
current is difficult to be control, and too high frequency will increase the switch dynamic consumption of the electric switch. The maximum width of PWM pulse will directly influence the maximum speed of motor which is decided by the voltage output by the handle. The test of handle voltage is simple, and the driver of electric bicycle will feel slowly to the speed because of the inertia, so the test of handle should not be frequent, and the AD test, power supply voltage test and brake test all need not quick speed, and it is enough to test in each 10-50ms, and for the AD test, it only needs to store the sampling values to the buffer unit in the timing interrupt, and dispose these values when the interrupt ends and returns to the main program, which will reduce the time of occupying interrupt. In the design, the electric bicycle adopts linear Hull as the handle modulation speed scheme, and the advantages of the scheme include low failure rate and without electric shock. And the disadvantage is that the voltage only changes in the range of 1.1V-4.3V under the power supply of 5V, so the software design should eliminate the zero point and multiply certain coefficient to extend dynamic range, and convert AD values in this period into the value of PWM dutyfactor. Though it adopts the stepless speed modulation, but the driver will fell smooth when it is divided into 32 classes. (3) Reducing the noise of phase-change When the electric bicycle just start up, the motor will produce large noise of phase-change, because the current is large when the motor starts up, and the motor is a sensitive load, and because the motor loop current after phase-change will not increase to the level before phase-change, so the current contrast will be very large, which will induce the drastic change of pull, and this change will induce the intense librations of motor, and we can make the PWM pulse dutyfactor achieve 100% to increase the current quickly in a period after phase-change, and reduce the librations noise. In the program design process, we need supervising the current change at any moment, and once the current achieves the level before phase-change, the PWM dutyfactor can be recovered. If the current can not achieve the level before phase-change all the while, it only needs delay more than ten PWM periods at best, i.e. if only other important works, such as phase demodulation, are not influenced. (4) The program design of locked-rotor protection To prevent the locked-rotor occurs in motor and pass same team VMOS all the while to induce damage, it is necessary to cut off the power supply of the motor in few seconds when the locked-rotor happens. The time generally is 2 seconds. And if the locked-rotor happens in the critical point of phase-change, frequent phase-change actions will occurs, which is harmful for the VMOS, so this situation should be treated as the locked-rotor. 6. Results of experiment The experimental sample motor is the 48V/350W brushless DC motor used in the electric bicycle, and the power supply is the storage battery which rating voltage is 48V used in the electric bicycle. When the load is little, the reference speed is 360r/min, and the motor speed curve from the serial port indicates that the system basically has no super modulation, and the steady state error is smaller than 2.0%, and the speed response time is about 4.5s, and the speed modulation effect is good. And the experiment result indicated that the scheme could fulfill the application requirement of electric bicycle. 7. Conclusions In this article, we introduce a sort of intelligent brushless DC motor driver based on embedded MCU LPC2114 and its concrete application in electric bicycle, and its special motor control unit simplifies the software and hardware design of the system, reduces the quantity of peripheral parts and the space of printed circuit board and the costs to the maximum extents, and the system could be applied in the present production of electric bicycle. References Cui, Wanan. (2002). Electric Bicycle. Beijing: Machine Industry Press. Tan, Jiancheng. (1999). Special Integration Circuit of Motor Control. Beijing: Machine Industry Press. Zhang, Chen. (1996). Principle and Application of DC Brushless Motor. Beijing: Machine Industry Press. Zhou, Ligong et al. (2005). Base and Practice of ARM Microcontroller. Beijing: Beijing University of Aeronautics and Astronautics Press.
129
Vol. 2, No. 2
DC power supply
Switch circuit
Motor
130