+ All Categories

An 0255

Date post: 06-Apr-2018
Category:
Upload: prasoft
View: 218 times
Download: 0 times
Share this document with a friend

of 16

Transcript
  • 8/3/2019 An 0255

    1/16

    Copyright 2010 by Zilog

    , Inc. All rights reserved.www.zilog.com

    Application Note

    Cordless Drill Motor Control with

    Battery Charging Using Z8 Encore!F0830 Reference Design

    AN025504-0910

    Abstract

    Currently, most hand-held electric drilling machines operating on batteries need a separate external battery

    charger to charge the batteries. This reference design describes the implementation of motor control for a 350-

    W hand-held electric drilling machine along with Nickel Cadmium (NiCd) battery charging in a single unit.

    This design is based on Zilogs Z8 Encore!

    F0830 microcontroller, which primarily controls the speed of the

    motor, motor current monitoring, fault detection, and controlled dv/dt charging of NiCd battery. All

    functionalities of the design are implemented with minimum hardware. The on-chip peripherals of Z8 Encore!

    F0830 are used to drive the drill motor at LowMediumHigh speeds using the pulse width modulation

    (PWM). The battery voltage and the charger input voltage are monitored by an analog-to-digital converter

    (ADC), and the batteries are charged depending on the voltage read from the batteries and the charger. The

    light emitting diodes (LEDs) are provided to indicate the motor running, motor fault, low battery, and battery

    charging condition.

    Note: The source code (AN0255-SC01) associated with this reference design has been tested with ZDS II

    version 4.11.0.

    Features

    The key features of this reference design include:

    Motor control and battery charging in a single unit

    Smooth startup of motor, reducing the starting current of motor

    Three-step speed control of the motor using PWM Microcontroller based over current protection

    Monitoring of battery charger input voltage and battery voltage

    Controlled dv/dt charging of NiCd battery

    LED indication of motor running, overload, and fault condition

    LED indication of battery charging and low battery status

    Three-way switch for LowMediumHigh motor speed selection

  • 8/3/2019 An 0255

    2/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 2 of 16

    Two-way switch for Forward and Reverse operation of the motor

    DiscussionThe drill motors used in most of the cordless handheld electric drilling machines are controlled by an

    electronic circuit. This electronic circuit mainly comprises of a simple square wave generator to control the

    speed. Usually batteries used in these machines are charged using a separate charging unit. By designing a

    control circuit based on Z8 Encore!

    F0830 microcontroller, it is easy to accomplish motor control at different

    speeds and battery charging as a single unit. This is an added advantage because the battery used to drive the

    motor is charged in the drilling machine without a separate battery charger.

    The functions of the drilling machine like motoring, stop (break), and the steps of speed (High, Medium and

    Low) can be effectively controlled by changing the duty cycle of the PWM generated by the microcontroller.

    LEDs are provided for monitoring fault condition like overload, short circuit of motor, and the charging status

    of the battery. Motor control operation resumes after the overload and short circuit faults are rectified.

    The controller circuit based on the Z8 Encore! F0830 can also be used to charge Nickel Metal Hydride

    (NiMH), NiCd, or Lithium ion batteries. The battery status such as low battery, charging, and charge

    completed are displayed using LEDs.

    This reference design is implemented with very minimum hardware changes to accommodate interfacing

    motors and batteries rated for different voltage and current ratings.

    This reference design can be easily ported to a Z8 Encore! F083A microcontroller with a 20-MHz internal

    precision oscillator (IPO) for better operation in terms of processor speed and ADC conversion. The required

    changes are modifying the setting of the clock source frequency that is defined as a macro in the header files

    and configuring the ADC Register used in the project.

    Theory of Operation

    The basic functions of the hand-held drill are classified as forward motoring, reverse motoring, speed control,

    and torque adjustment. Motors used in the cordless hand-held drives are available at different voltage ratings.

    The commonly used voltage ratings for the motor are 7.5 V, 12 V, 14.4 V, 18 V, 24 V, and 36 V DC. These

    motors have the maximum constant current rating and so can be operated at the maximum specified current

    rating, which in turn specifies torque. Motors used in this application are rated from 300 W to 500 W.

    Generally, the no load current consumption of a 1/4-inch drill is in the range of 2 A to 2.5 A, and the stall

    current of the motor is in the range of 80 A to 100 A. The speed of these drilling machines is adjustable from

    150 rpm to 1200 rpm. Speed variation is necessary for different type of work from screw driving to drilling

    metal sheet.

    Rechargeable batteries are used to provide power to the drill motor. Most common rechargeable batteries are

    NiCd, NiMH, or Lithium ion. The design uses NiCd cells of 1.2 V each connected in series to form 14.4-V

    battery pack. NiCd battery can be charged by a constant current from an adapter plugged to the drive unit. The

    theory of charging the NiCd batteries is described in Appendix CBattery Technology on page 15. The

    charge termination to the battery is done by observing the zero or negative dv/dt on the battery terminals or by

    charging for a fixed time interval. In this design, the charge termination is done by zero/negative dv/dt or fixed

    interval timeout, whichever occurs first.

  • 8/3/2019 An 0255

    3/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 3 of 16

    Motors

    Brushed Universal Motors are commonly employed in the cordless electric hand-held drives.

    These motors can be operated using a DC power supply. Brushed DC motors are classified as permanentmagnet and temporary magnet motors. Permanent magnet DC motors are employed where very low

    power/torque is needed (for example, toys, tape players, and instrument cooling fans). Similarly, the temporary

    magnet DC motors are further classified based on the type of magnetic field winding used for their

    construction. Temporary magnet DC motors are classified as the following:

    Shunt motorShunt motors are employed where the constant speed is required.

    Series motorSeries motors are employed where high torque is required, but series motors rotate at very high speed

    when they are not loaded.

    Compound motor

    Compound motors combine the features of series and shunt motors.

    Hand-held drilling machines require a high torque to drill objects, and the maintenance of speed is not a

    criterion in drilling applications, so series motors are the most suitable for most of the drilling machines.

    Rechargeable Batteries

    Batteries are used to power cordless electric handheld drill motor. Drill motors consume high power during

    their operation. The no load current consumed by a 350 W motor can be in the range of 2 A to 2.5 A, and

    motor stall current can be in the range of 80 A to 100 A. The batteries required for this application should have

    a high charge density to meet the power requirements of the motor. Rechargeable NiCd or NiMH batteries

    have a moderate charge density, which can be considered suitable to the application. NiMH batteries exhibit

    higher power density compared to their NiCd counterparts. The voltage per cell of the NiCd battery type is 1.2

    V. NiCd batteries are charged using the constant current charging method.

    Hardware Architecture

    Block Diagram

    Figure 1 on page 4 displays the functional block diagram of the Z8 Encore!

    F0830 hand-held drill motor

    control.

  • 8/3/2019 An 0255

    4/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 4 of 16

    Figure 1. Block Diagram of Z8 Encore! F0830 Hand-Held Drill Motor Control

    The block diagram is divided into following functional blocks:

    Battery Charging Section (page 5) Controller Section (page 5) Power Electronic Drive (page 6)

    All functional blocks are controlled by Z8 Encore! F0830 microcontroller operation using IPO at 5.5296 MHz.

    The Z8 Encore! F0830 20-pin microcontroller pins are used for the functions listed in Table 1.

    Table 1. Pin Function Descriptions

    PinNo.

    Pin Function Function Used Input/Output/PWR Function on Board

    1 PB1/ANA1 ANA1 Input Battery charger voltage sensing

    2 PB2/ANA2 Not Used

    3 PB3/CLKIN/ANA3 Not Used

    4 VDD PWR 3.3 V supply

    5

    PA0/T0IN/ T0OUT

    /XIN Not Used

  • 8/3/2019 An 0255

    5/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 5 of 16

    PinNo.

    Pin Function Function Used Input/Output/PWR Function on Board

    6 PA1/T0OUT/XOUT Not Used

    7 GND PWR GND

    8, 9 PA2, PA3 PA2, PA3 Input Three-level speed setting

    10 PA4 PA4 Input Run/Break switch

    11 PA5 PA5 Output Charger ON/OFF control

    12 PA6/T1IN/ T1OUT Not Used

    13 PA7/T1OUT T1OUT OutputOutput PWM to drive MOSFETconnected to motor

    14 RESET /PD0 RESET Input RESET

    15 DBG DBG Input/Output DEBUG

    16 PC0/ANA4/CINP/LED CINP InputCurrent sense input forcomparator

    17 PC1/ANA5/CINN/LED Not Used

    18 PC2/ANA6/LED/VREF PC2 Output LED

    19 PC3/COUT/LED Output LED

    20 PB0/ANA0 ANA0 Input Battery voltage sensing

    The detailed descriptions below are reflected in the schematics in Appendix ASchematics on page 10.

    Battery Charging Section

    The output of a 110/230 V AC to 20 V DC, 1-A power adapter is connected to the input of the battery chargersection. The battery charging section comprises the charging current limiting resistor, transistor to turn on/off

    the charging current, trickle charging resistor, and 14.4-V NiCd battery pack. The resistor across the transistor

    provides trickle charging current of C/40 to the battery, where C is the rated battery capacity in Ampere Hours

    (AH). The transistor switching is controlled by the Z8 Encore!

    F0830 microcontroller. The charging inputvoltage and the battery terminal voltage are attenuated to a voltage level acceptable by the ADC peripheral

    within the Z8 Encore! F0830 microcontroller. The attenuated voltage is connected to the respective pins of the

    microcontroller. The microcontroller monitors the attenuated charging voltage and battery voltage for charging

    the battery. The microcontroller measures the voltage slope of the battery every 32 s. When the batteries show

    a negative voltage slope (-dv/dt), the microcontroller turns off the charging transistor by making the GPIO pin

    low.

    This design accomplishes either battery charging or the drill motor control function at a time. It is notpossible to run the motor when the batteries are charged and vice versa.

    Controller Section

    The controller section comprises of Z8 Encore!

    F0830 microcontroller operating at 5.5296 MHz using IPO.

    The power supply for the controller is derived from the battery or the charger input voltage. Battery voltage of

    14.4 V and charger input voltage of 20 V are logically ORed using the diode and stepped down to 3.3 V. The

  • 8/3/2019 An 0255

    6/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 6 of 16

    stepped down voltage is achieved using a transistor and zener diode combination. The microcontroller isconnected to a three-position switch for speed control of the DC motor. Based on the switch position, the

    PWM duty cycle is varied to achieve LowMediumHigh speed operation of the motor. A trigger switch

    (ON/OFF) to turn on/turn off the drill motor is connected to PA4. The LEDs to indicate battery and motorstatus are connected to PC2 and PC3 pins of the microcontroller respectively. The voltage developed across the

    current sensing resistor, when the current flows through it, is fed to the positive input of the on-chip

    comparator. When the voltage on the positive input of the comparator exceeds the on-chip reference voltage

    connected to the non-inverting input of the comparator, PWM stops. Every 10 ms, the PWM is initialized to

    check fault. If PWM is not started the motor status LED blinks to indicate motor fault/overload.

    Power Electronic Drive

    The power electronic drive unit consists of transistors to drive an IXYS highly efficient Trench Gate metal

    oxide semiconductor field effect transistor (MOSFET), with ultralow Rds, connected to the low side of the

    supply voltage. The transistor drive stage forms a voltage level converter stage to drive the gate of the

    MOSFET with appropriate voltage. A switching frequency of 100 Hz gives a smooth variation of the motorspeed. The MOSFET is switched at a frequency of 100 Hz. The source pin of the MOSFET is connected to the

    ground through a current sense resistor. The voltage drop across the current sense resistor is the input to the

    CINP pin of the microcontroller. The CINP pin is the input connected to the positive input of the comparator

    within the Z8 Encore! F0830 microcontroller. The negative input of the comparator is connected to the

    programmable internal reference voltage generated within Z8 Encore! F0830 microcontroller.

    The user interface consists of switch inputs for forwarding, stopping or breaking, and reversing the motor,

    setting the speed of the motor to LowMediumHigh. Two LEDs are provided for status indication of motor

    and battery.

    Software Implementation

    The motor control and battery charging software implementation procedures include the following sequences

    of events:

    1. Initialize the comparator, timer 0, timer 1 PWM, ADC, WDT, and GPIO upon power up or externalpin reset.

    2. Read battery voltage and update the status flags reflecting the battery condition.3. If the battery voltage is above or below the threshold limit, turn on the battery damage Flag and charge

    the battery for 60 seconds.

    4. If the trigger switch is not pressed, continue to step 8.5. If the trigger switch is pressed and the battery has sufficient charge, set the speed of the motor to the

    value set by the settings switch.

    6. Continuously monitor for changes in the speed setting switch and trigger the switch release.

    7. If the trigger switch is released or the battery is completely discharged, turn off the PWM.8. If the battery is not completely charged and the charger voltage is present, turn on the charger.9. Continuously monitor the battery status and trigger the switch press.10. If the trigger switch is pressed, repeat step 5 through step 7.11. If the charger voltage is not present or the battery is completely charged, turn OFF charger and enter

    the stop mode.

    12.The stop mode is recovered when the WDT times out or the trigger switch is pressed.

  • 8/3/2019 An 0255

    7/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 7 of 16

    Testing

    Test SetupSee the schematics in Appendix ASchematics on page 10 and the Test Procedure to connect the test circuit.

    Equipment Used

    The equipments used for testing consist of the following:

    14.4 V DC operated Cordless hand-held drill/screwdriver 20 V, 1 A DC power supply Digital multi-meter Oscilloscope

    Serial/USB Smart Cable ZDS II installed PC with a USB/serial port to compile code and download the code to the target

    Test Procedure

    Follow these steps to test the Z8 Encore! F0830 microcontroller-based design:

    1. Connect the circuit as displayed in the schematics in Appendix ASchematics on page 10.2. Connect the 14.4-V battery to the circuit.3. Connect a Serial/USB Smart Cable to the debug connector in the circuit and to the PC.4. Open the Project file Motor_Control.zdsproj in the source folder of this application

    installation using the ZDS II Compiler, build the project, and download the code to the target device.

    5. Disconnect the Smart Cable from the target device and recycle the power to the application.

    6. Connect a multi-meter in series with the battery and the circuit to measure the motor current/batterycharging current.

    7. Connect an oscilloscope across the terminals of the motor.8. Press and hold the RUN/STOP switch.9. Observe the motor speed as it gradually increases up to the maximum speed set by the speed position

    switch.

    10.Observe the waveforms on the oscilloscope.11.Change the speed settings of the motor by changing the position of the speed setting slide switch.12.Measure the speed and observe the waveforms for all of the speed settings.

    Test Results

    The results in the following table are obtained for various speed settings of the motor.

    Trigger Switch Position Speed Switch Position No Load Speed (RPM) Current (A)

    Released 0 0

    Pressed Low 400 2.00

    Pressed Medium 800 2.90

    Pressed High 1150 3.20

  • 8/3/2019 An 0255

    8/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 8 of 16

    Figure 2. Starting and Operating Current of Motor with Speed Set to Minimum

    A load current of 5.6 A is utilized when drilling an aluminum sheet of 5-mm thickness.

    LED D6 lights up to indicate low battery when the battery voltage is at 13.8 V or lower. The system shuts

    down when the battery voltage reaches 12 V.

    Battery Charging Test Results

    The test results for battery charging are listed in Table 2.

    Table 2. Battery Charging Test Results

    Parameters Value

    Battery type Nickel Cadmium

    Battery voltage 14.4 V

    Ampere Hour rating 1500 mAH

  • 8/3/2019 An 0255

    9/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 9 of 16

    Parameters Value

    Charging type Constant voltage

    Charging current 800 mA (initial, decreases with charging time)

    Charging time 2 hours (approximately for completely dischargedbattery pack)

    Charge termination Negative voltage on battery terminals/constant timeinterval

    Maximum battery voltage when charging completelydischarged battery

    18.2 V

    Trickle charging current 40 mA

    Voltage of the battery when completely dischargedusing motor load

    12 V

    SummaryThis reference design describes smooth speed control of a battery-operated drilling machine motor along with

    an in-built battery charger using low-cost Z8 Encore!

    F0830/F083A. This design has two LEDs that indicate

    various conditions like motor operation, motor overcurrent, battery charging, and low battery.

    This design also includes features like motor protection for overcurrent and short circuit, controlled NiCdbattery charging. The advantages of this design over the existing cordless hand-held drives are that there is no

    need to plug the battery pack into a separate charger unit, and the smooth startup of the motor reduces high

    starting current of the motor.

    References

    The following documents associated with Z8 Encore! F0830 MCU or battery charger are available on

    www.zilog.com:

    Z8 Encore! F0830 Series Product Specification (PS0251) Z8 Encore! Based AA Type NiMH and NiCd Battery Charger Reference Design (AN0229) Z8 Encore! XP Based NiCd Battery Charger Application Note (AN0221)

  • 8/3/2019 An 0255

    10/16

    Cordless Drill MotorUsing Z8 Enc

    AN025504-0910

    Appendix ASchematics

    Figure 3 displays the implementation of the cordless drill motor control with battery charging using the Z8 Encore

    Figure 3. Cordless Drill Motor Control with Battery Charging Schemat

  • 8/3/2019 An 0255

    11/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 11 of 16

    Appendix BFlowcharts

    This appendix contains the flowcharts of the main function and interrupts in the application of cordless drill

    motor control with battery charging using Z8 Encore! F0830. See Figure 4 through Figure 8 (page 14) for

    details.

    Figure 4. Flowchart of Main Function

  • 8/3/2019 An 0255

    12/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 12 of 16

    Figure 5. Motor Control Algorithm

  • 8/3/2019 An 0255

    13/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 13 of 16

    Figure 6. Battery Charging Algorithm

  • 8/3/2019 An 0255

    14/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 14 of 16

    Figure 7. Comparators Interrupt

    Figure 8. Timer0 Interrupt

  • 8/3/2019 An 0255

    15/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 15 of 16

    Appendix CBattery Technology

    The four popular battery types (NiCd, NiMH, SLA, and Li-Ion) displays different charging and dischargingcharacteristics. The battery life and performance mainly depends upon the battery charging mechanism.

    Therefore, batteries must be charged in a proper mechanism. Charging must be terminated when the battery is

    completely charged as overcharging of the battery invariably results in poor performance and can also damage

    the battery. Different batteries require different charge termination techniques as they behave differently when

    approaching the full charge state. While charging, batteries exhibit marked rise in voltage above the rated

    battery voltage. The NiCd and NiMH rechargeable battery types used in this reference design are briefly

    discussed below.

    Nickel Cadmium (NiCd)NiCd batteries are used in portable consumer equipments. The single-cell voltage for NiCd batteries is 1.2

    V. These batteries are charged using the constant current charging method. While charging, as the voltage

    crosses the full charge point, the voltage gradually drops. This voltage drop is approximately 15 mV percell in the battery. This voltage drop is recognized as full charge condition resulting in the termination ofthe charge. This termination mechanism is known as -dv/dt termination. The battery voltage rises to 1.65 V

    per cell during charging. The main disadvantage of the NiCd battery is that it must be discharged

    periodically to protect the performance. This phenomenon is known as memory effect.

    Nickel Metal Hydride (NiMH)NiMH batteries exhibit high power density compared to the NiCd batteries. The per cell voltage of the

    NiMH battery type is 1.2 V which is similar to NiCd batteries. NiMH batteries are charged with constant

    current charging method. While charging, the voltage drop is not as low compared to NiCd batteries.

    Therefore, -dv/dt charge termination is not recommended. Instead of the drop in cell voltage, the battery tends

    to stabilize after a small drop. This flat region is the indication for full battery charging. This terminationmechanism is known as zero dv/dt termination. NiMH batteries do not suffer with memory effect as compared

    to NiCd batteries. As a result, they replace NiCd batteries in devices such as cell phones. The increase in price

    is justified by the reduction in weight and absence of memory effect.

  • 8/3/2019 An 0255

    16/16

    Cordless Drill Motor Control with Battery ChargingUsing Z8 EncoreF0830 Reference Design

    AN025504-0910 Page 16 of 16

    Warning: DO NOT USE IN LIFE SUPPORT

    LIFE SUPPORT POLICY

    ZILOG'S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE

    SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF THE

    PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION.

    As used herein

    Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)

    support or sustain life and whose failure to perform when properly used in accordance with instructions for use

    provided in the labeling can be reasonably expected to result in a significant injury to the user. A critical

    component is any component in a life support device or system whose failure to perform can be reasonably

    expected to cause the failure of the life support device or system or to affect its safety or effectiveness.

    Document Disclaimer

    2010 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices, applications,

    or technology described is intended to suggest possible uses and may be superseded. ZILOG, INC. DOES

    NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE

    INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZILOG ALSODOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED INANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED HEREIN OR

    OTHERWISE. The information contained within this document has been verified according to the general

    principles of electrical and mechanical engineering.

    Z8, Z8 Encore!, and Z8 Encore! XP are registered trademarks of Zilog, Inc. All other product or service names

    are the property of their respective owners.


Recommended