Design of Controller in Electric Bicycle

Base on PIC16F72, a design of brushless DC motor controller strategy applied to the electric bicycle control system was presented in the paper. Through analyzed some possible problems when electric bicycle running daily. Function of over-current protection, under-voltage protection and helping were accomplished. Schematic diagrams of each function and drive circuit were given in the paper, the controller was debugged in rated voltage 36V and power rating 250W brushless DC motor, experiment turned out controller has better dynamic characteristics and ran steadily.


Introduction
The problem of environment has become heat topic in this world.Global warming, resource scarcity has become more and more obvious.It is very important to develop green traffic, electric bicycle is convenient, dexterous and cheap as compare with motor vehicle.On the basis of environmental protection, realize growth of economic.Electric vehicles attract more and more attention.Some components such as motor, controller, battery, governor were installed in common bicycle, it is called electric bicycle.The speed of electric bicycle is controlled by controller, which ensure the electric bicycle safety and it is also the core component.Accomplished function of capacity detection, under-voltage protection and so on, because of PIC16F72 was taken as the main control chip, make modern electric bicycle increasingly more tend to be intelligent.The driving force of traditional electric bicycle completely come from motor, it not only reduce battery life greatly but also waste more electricity energy.Base on this, function of helping was introduced in this paper.More energy will be saved and people can get more exercise.

Overall design scheme of controller
As illustrated in Figure 1, some signals such as speed controlled signal, current detection signal, brake signal, helping signal and capacity detection signal were transmitted to pins of MCU respectively, after A/D conversion, the brushless DC motor was driven through this signals.Hall sensor was important component, it was used to detect position of the rotor.

Main control chip
Electric bicycle features high-performance PIC16F72 microcontroller core.PIC16F72 has 28 pins, include 22 8-bit I/O ports.The PIC16F72 supports PWM for motor control.CCP1 pin can output the maximum resolution of 10BIT adjustable PWM signal.AR0~AR4 pins support A/D conversion, they are used to detect changing of voltage and current when electric bicycle is running.
As illustrated in Figure 2, speed controlled signal, helping signal, current detection signal were transmitted to RA1, RA4, RA5 respectively.Hall signals from hall sensor were transmitted to RC5, RC6.Signals of motor driving were transmitted to RB2 to RB7.

Power supply
The power of this controller was divided into two parts 5V supply voltage to MCU and 12V supply voltage to drive MOSFET.External power source adopts 36V DC voltage.
LM2576 series of regulators are monolithic integrated circuits, all circuits of this series are capable of driving a 3.0A load with excellent line and load regulation.These devices are available in fixed output voltages of 3.3V, 5V, 12V, 15V and adjustable output version.The maximum input voltage is 40V.LM2576 is best choice to this controller.
As illustrated in Figure 3, to get 5V DC voltage, LM2576-5 was used.In the same way, to get 12V DC voltage, LM2576-12 was used.

Input of hall signal:
Most motor used in electric bicycle today is brushless DC motor, there is no friction between electric brush and commutator inside the motor, there are no need to replace electric brush and some other vulnerable components.So it prolongs life of the motor.There are three hall sensors inside the brushless DC motor.They transmit signal of rotor position to PIC16F72.

Governor
When turning the electric bicycle handle bar, the voltage cross sampling resistance will be changed, passing the A/D conversion, then come into PWM comparative register.PWM will be changed at last.

Circuit of driving motor
The part number of power MOSFET is STP75NF75 in this controller design.It is N-channel.The basic parameter: maximum drain voltageV DSS = 75 V, on-resistance R DS <0.011 , maximum drain current (continuous) ID=80A, In order to improve the efficiency of system, reduce the power MOSFET consumption, the smaller resistance the better, once power MOSFET worked.The smallest voltage used to make power MOSFET working V=10V, 12V voltage is used in this design.
As illustrated in Figure 4, three-phase circuit to drive motor.A-phase driving circuit is shown, so do B-phase and C-phase.AH, AL is upper leg and lower leg input respectively in A-phase.

Current detection:
There are some heavy-current situations when electric bicycle is running.Such as motor is starting and loading too much.Coil Winding and electric components will be damaged by heavy-current in controller.Through measure Voltage crossed Current-measure resistance, when voltage was measured exceed voltage which defined previous.It indicates current exceed safe range, power MOSFET will be closed in short time.As illustrated in Figure 5, reference potential was transmitted to non-inverting input pin, the voltage cross R9 was transmitted to inverting input pin in LM358.When voltage was measured exceed reference potential, the output level will be changed and the data transmitted to MCU, MCU stop the motor.

Brake circuit
The electric bicycle should be brake, when some unexpected things happened.When driver brake, the power supply should be stopped.High-level is a brake signal in this controller.Hall sensor output low level in normal condition, low-level will be changed to high-level when braking.
As illustrated in Figure 6, the level to base of transistor is conversed when braking, and output level will be conversed.This conversed level is transmitted to MCU finally.MCU closes the power supplied.
Published by Canadian Center of Science and Education 127

Helping function:
Electric bicycle is also named moped, when people tread of foot pedal, the motor will run in small power, dynamic torque signal can be detected by torque sensor inside electric bicycle, when people tread of foot pedal.
When dynamic torque signal transmitted to MCU, the motor will be driven in a short time.The function of helping does not only save electricity energy, prolong the life of battery, but also improve physical condition.The voyage of electric bicycle doubled than traditional electric bicycle.Because of smaller current, components damaged by strong current will be avoided.

Checking of voltage supply
In order to avoid the low voltage supply, which affect the electric bicycle running normally.Controller should be provided with Capacity checking.The voltage crossed sampling resistance transmitted to MCU, signals the voltage supply to controller, when voltage is smaller than defined previous.it will reminder people to charge up the electric bicycle battery.

Design of controller software
Software is fairly integral part of controller.Software system design includes the following several modules:

Test Result
This controller was debugged in rated voltage 36V and power rating 250W brushless DC motor.As shown in figure 8, when program was written in PIC16F72, the efficiency value of this controller is more than 70% in normal condition.As load became more and more large, the value of current was kept in certain scope.

Conclusions
This essay has illustrated the controller which takes PIC16F72 as a core, introduced some important components and Circuit principle diagram.This controller has function of over-current protection, under-voltage protection, helping and so on.Experiment turned out controller has better dynamic characteristics and ran steadily.
-current protection, under-voltage protection and helping module 4. System initialed automatically when MCU powered on.Many components were initialed include: PWM, A/D conversion, I/O ports and timer setting.The flowchart of program is shown in Figure 7.

Figure 1 .
Figure 1.Framework of Controller

Figure 4 .
Figure 4. Circuit of Driving Motor