Professional Documents
Culture Documents
DT 1 Design Fall 2004
DT 1 Design Fall 2004
m m
m DC
V
t
V
tdt V V
2
cos sin
1
] [
0
0
= = =
Equation 1
For our power supply, V
m
is 24* 2 = 34V, thus yielding a V
DC
or an average voltage
equal to 22V. The ripple factor for a full-wave rectifier is given by Equation 2, which
yields a 0.5V ripple at the bridge output.
1
) (
2
=
DC
rms
V
V
Equation 2
Since there is no average current through a capacitor, the smoothing capacitor will have
no DC current going through it, thus all the DC current will go into the MOSFET, while
the AC components will be filtered out. Also, the capacitor will smooth out the
unregulated voltage coming from the full bridge rectifier. Figure 8 shows the rectified
varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly
near the peak of the varying DC, and then discharges as it supplies current to the output.
The smoothing capacitor value can be computed with Equation 3.
fRC
V
V V
m
m dc
4
= Equation 3
Figure 8. Smoothed DC voltage from the rectifier.
For an AC frequency of 60 Hz, an input peak voltage of 34V, a 22V DC voltage and a 2
maximum output resistance, the capacitor value required is 5.9mF. The larger the
17
capacitor, the better, since an increased level of smoothing of the input voltage will result
in a nearly constant DC input voltage.
The buck converter will decrease the input voltage to the desired value by turning a
switch on and off. In order to control the supply, the microcontroller will dynamically
send a PWM signal to the gate of an n-channel power MOSFET. When the MOSFET is
turned on the diode will not work since it is reversed bias, and the inductor will begin to
store energy. When the transistor switches off, the diode becomes conductive, and the
inductor releases energy to the load, and then the cycle repeats. The purpose of this diode
is to direct current flow in the circuit and to ensure that there is always a path for the
current to flow into the inductor. The Schottky diode was chosen because of the very fast
switching times that the diode is capable of, and also the low forward-voltage drop given
by its construction (a metal-semiconductor barrier, rather than a semiconductor-
semiconductor barrier found in most of the other diodes). To determine the voltage, the
PWM will have a duty ratio or duty cycle given by Equation 4.
D
V
V
IN
O
= Equation 4
The duty cycle D will change depending on the desired output voltage V
0
.
An inductor is also used in the buck converter to store energy when the switch is
on and to supply energy when the switch is turned off. Equation 5 was used to determine
the required minimum inductance value:
TR
D
L
crit
*
2
1
= Equation 5
In this equation D is the duty cycle, T is the period and R is the maximum resistance. For
a PWM switching at a frequency of 32 kHz, the period T is 31.25s and the maximum
resistance R is 2. For the minimum duty cycle, the largest critical inductor value is
calculated to be 31.25H. Since the value of the needed inductor is known, the following
formula can be used to determine how to properly build it:
l
A N
L
2
= Equation 6
Here, N is the number of turns, is the permeability of the core material, A is the area of
the coil, and l is the average length of the coil. Given a regular size core with an area of
around 2 square inches, a permeability of around 25
0
for a high flux core, and an
average length of the coil of 10 inches, the desired number of turns would be around 5
turns.
A capacitor is used at the output as a filter to reduce ripple in the voltage. Since
switched power regulators are commonly used with high current, high-performance
power supplies, the capacitor should be chosen for minimum loss. Equation 7 will
determine the capacitor value.
18
I Lf
D
C
=
) 8 (
1
2
Equation 7
L is the inductance and is the frequency at which the PWM operates. Given the
desired ripple
f
I as 0.1, the minimum filtering capacitor value is 40.96 . F
Microcontroller Power Supply
The microcontroller is the brain of the design. It requires a constant 5V input that has
to be as clean as possible, meaning that it is desired to have as small ripple voltage as
possible. Since the current requirements are rather small (less than 1A), it was proposed
that a commercial transformer will be used to power up the microcontroller. This will
ensure the proper voltage will be supplied at all times, making the overall project more
reliable. Figure 9 shows a general schematic of the power supplies:
Figure 9. Microcontroller Power Supply Overview
The schematic in Figure 10 shows the basic construction of the 5V supply. It is based on
the inexpensive 7805 voltage regulator.
Figure 10. 5V Voltage Regulator
19
Voltage and Current Sensing
In order to accurately and efficiently charge a battery and deliver feedback to the
user, voltage and current sensing networks must be built into the switch-mode power
supply circuitry. To monitor the voltage across the battery, the 0-20 V output will be
scaled using two precision resistors. The voltage output will be sent to Channel 0 on the
internal PIC ADC to control the PWM for the battery charging algorithm and the
standalone power supply modes of operation. This signal will also be sent to Channel 1
on the external ADC. This signal will be for the high-precision feedback to the
microcontroller and PC for user feedback purposes. The voltage sensing network in the
context of the power supply circuitry is shown in Figure 11. As can be seen from this
schematic, a simple voltage-divider branch will scale the outputs to achieve compatibility
with the PIC ADC and external ADC input voltage requirements.
Figure 11. Voltage Sensing Network Schematic.
These signals will be isolated from the power supply circuitry using a voltage follower
operational amplifier stage. The purpose of this is to prevent an over voltage condition on
the ADC pins and to isolate the ADC input impedance requirements from the rest of the
circuit. For this application, the Microchip MCP 607 op-amps were chosen because of
their precision low power operation and rail-to-rail output swing capability. These
devices, which are shown in Figure 12, are available in dual packages, which will reserve
an additional op-amps for the current sensing network.
Figure 12. Microchip MCP 607 Precision Operational Amplifier.
20
In order to sense the current flowing through the battery, a low-side current sensing
network will be used. Low-side current monitoring consists of measuring the voltage
across a small current sense resistor connected in series with the ground path and dividing
by the known value of the sense resistor. This technique is illustrated in Figure 13. Since
the voltage measured across this 0.01 resistor is small, it is amplified before being sent
to the two A/D converters.
Figure 13. Current Sensing Network Schematic.
System Control: Microcontroller-Based Approach
After evaluating the options for system control, the embedded microcontroller-based
approach was determined to be the most suitable alternative for this smart design. As
the core controller, the integrated microcontroller will serve many purposes:
implementing the proportional integral (PI) control loop to change the voltage or current
output, processing the serial digital voltage and current sensing signals from the external
ADC, processing the temperature sensor feedback signals, transmitting these sensing
signals to the PC application via the RS-232 serial interface, processing the infrared-
remote input, and driving the LCD for user feedback. This overview is illustrated in the
high-level block diagram of Figure 14.
21
Initialize System
Init PIC, ADC, LCD and PWM=0
Start
Wait for Command
From the computer or IR (polling)
Command
Received
No
Yes
Parse Command
Source
IR remote
Output Defaults
Parse command
1. Mode
2. Set point
PI
Set the PWM
User feedback
Computer
Figure 14. High Level Dataflow Diagram.
22
Proportional Integral Control Algorithm
A very important part of this design is developing a control algorithm that will
accurately modify the output voltage or current in response to an input voltage or current
setpoint. Most algorithms for charging batteries require different charging stages that
output a certain amount of current depending on the stage in the charging process.
Control is also vital to the DC power supply mode of operation, for if a user decides to
change the voltage from 5 to 10 V, or the current from 2 to 3 A, for example, the system
must respond to perform this change.
To accomplish this control, the design will use a simplified form of the well-known
Proportional, Integral and Derivative (PID) technique that is used to control many
continuous processes in a feedback system. This control algorithm consists of a simple
proportional gain (K
P
) that is multiplied by the present error, an integral term that looks at
the sum of past errors and has an integral gain (K
I
), and a derivative term that works on
the present and past error to forecast a future response of the system. The derivative term
is useful in situations where the time response to reach the setpoint is required to be
small. Since this application does not require fast changes in the system output, the
group was advised that Proportional, Integral, or PI, control would be sufficient.
A basic feedback control loop for this system is shown in Figure 15. In this figure,
Figure 15. Feedback Control Loop.
the userthe computer charging algorithm or DC power supply usersignals a desired
current or voltage setpoint. This is the value that the system will drive towards. The
difference in the desired setpoint and current system output is calculated and is called the
error. The PI Controller will take this error and attempt to correct it by modifying the
duty ration of the PWM signal to the power electronics board. The plant, or physical
circuitry, will output the modified current or voltage. The plant output will be measured
with the voltage and current sensing methods discussed above and sent back to be
compared with the desired setpoint.
The most significant aspect of the control system is the block labeled PI
Controller. This component is responsible for measuring the output of the plants
voltage and current sensors, process these signals, derive an error based on the signal and
the setpoint, and determine the PI values that have to be sent to the plant for correction.
setpoint + error
(t)
(PWM
duty ratio)
system
output
PI
Controller
Plant
Feedback
-
23
The proportional term is the proportional gain multiplied by the error. The amount of
correction necessary is directly proportional to this error, hence the term proportional.
Proportional control alone will drive the error to a small value, leaving a steady-state
error. The integral control is used to determine the sum of all past errors at fixed time
intervals. The actual constants themselves must be tuned along with the plants
implementation, and this will be done in the spring semester. For now, the main PI
control routine will be implemented based on the design shown in the flowchart in Figure
16.
error
error = 0?
YES
PI action not
n required, retur
NO
Calculate
al term Proportion
K
P
* error
Calculate
m
K
I
* Proportional
Integral ter Term
Proportional +
Integral
Figure 16. Main PI Routine.
To perform the system control functions mentioned above, the Microchip
p
In
.
PI Output: sent
to plant
PIC18F452 was chosen because of its rich feature set, familiarity to the design grou
(based on the Microprocessor Interfacing course and laboratory experience), and
accompanying Microchip MPLAB IDE tool suite and In-Circuit Debugger (ICD).
addition, since the PWM frequency is directly related to the microcontrollers clock
oscillator frequency, a suitable microcontroller had to support a high clock frequency
The microcontroller software will be coded in the C language using the robust CCS
compiler. The microcontroller design will begin with the hardware design interface
24
including all connected design accessoriesand proceed to the detailed software desig
Given that the microcontroller design is primarily implemented in software, the software
design portion will include the function, input/output description, data flow charts, and
pseudo code procedural definitions of each of the stated control functions.
n.
icrocontroller Hardware Design Interface
The 40-pin Dual In Line PIC18F452 and 8 MHz clock oscillator that will be used as
M
input to pins 13 and 14 is shown in Figure 17. The microcontroller will actually operate
at 32 MHz by setting a 4x phase lock loop multiplier.
Figure 17. 40-pin DIL PIC18F452 Package and
S
Pin 17 will be used as output for the PWM signal (through a logic board to power supply
xternal Analog-to-Digital Converter
learly revealed that the high-quality feedback
C was high-resolution;
the sampling frequency need not be very fast for data acquisition of battery systems. As a
chematic (including the 8 MHz clock oscillator).
board header), input / output (I/O) pins 18, 23, and 24 for the SPI communication to the
external ADC, I/O pins 25 and 26 for the Maxim RS-232 interface, and output pins 19-21
and 27-30 of PORTD for the liquid crystal display controller command and data bus. The
final design will also include an LED for testing and verification purposes (although not
shown to the user). Each of these subcomponents will be considered separately.
E
The Alternative Design Analysis c
required to control the battery charging algorithm is a vital part of this design. As a result,
a high-resolution external A/D converter (ADC) was selected over the built-in converter.
The function of this device is to convert the differential analog voltage and current
sensing signals into digital signals to be processed by the microcontroller. The
microcontroller will report these digital signals to the computer application that will
display the signals and adjust the charging algorithm if required.
The driving criteria behind selecting a suitable external AD
25
result, the Analog Devices AD7705 16-bit Sigma-Delta ADC was chosen. This device
yields a resolution of 20V/2
16
= 0.305 mV over a 0-20 V design constraint. The AD7705
features no missing codes, two fully-differential analog input channels, a differential
reference input, 4.75 V to 5.25 V operation, a three-wire Serial Peripheral Interface (SPI),
and many more features. Particularly attractive is the high degree of compatibility with
the microcontroller: the flexible serial interface and SPI protocols are fully compatible
with the PIC18F452 and the supply voltage range allows for the microcontroller and
ADC to be powered on the same system logic board
For this battery monitoring application, one input channel will be used to
differentially measure the voltage across the battery. The other input channel will be used
m to onitor the current to the battery. The AD7705 device and input / output schematic is
shown in Figure 18. The external ADC will be placed on the system logic board which is
powered by the 5 V supply (VDD). This particular device requires a 2.4576 MHz
oscillator as clock for MCLK, and communication is done on the (active low) data ready
or DRDY signal. There will be a logic header attaching the ADC to the other integrated
board components.
Figure 18. AD7705 Interface Schematic.
To communicate troller, the pseudo
code driver shown in Listing 1 will be imple ented. The embedded C pseudo code
display
) ; / / I ni t i al i zat i on r out i ne: conf i gur es cl ock, chi p
/ / sel ect , r eset pi ns, del ay; cal l s
/ / St ar t A/ D conve
( r equi r ed_t i me_ s synchr onous r eadi ng
_ c_
the External ADC.
with the external ADC from the microcon
m
ed for all listings uses the actual functions and variables provided in the CCS C
compiler.
adc_i ni t (
/ / set up_adc_devi ce( ) t o set up t he
/ / devi ce par amet er s
r si on
el apsed) / / Endl es i f
i f ( ADC_DRDY) {
gl obal Vol t age = r ead_adc_val ue( ch 1) ;
= r ead ad val ue( ch 2) ; gl obal Cur r ent
}
Listing 1. Pseudo code to Communicate with
26
RS-232 Serial Interface
The bi-directional feedback between the microcontroller and PC application will be
axim RS-232 serial interface. This device performs a level made possible via the M
conversion from the TTL level signals of the microcontroller to the RS-232 levels of the
computer. This hardware interface is shown in Figure 19.
Figure 19. Maxim RS-232 Serial Interface.
The communicatio iscussed in Tables A3
the Appendix.
The Pulse Width Modulation (PWM) signal will be generated by the microcontroller
rent output of the DC power supply. A change in pulse width
in
set up capt ur e compar e modul e f or PWM;
f r equency;
I
_i ni t ( ) ; / / I ni t i al i ze PWM t o zer o wi dt h
ack on bot h channel s
l e
n protocol and impromptu error codes are d
and A4 in
Pulse Width Modulation
to adjust the voltage or cur
is itiated by either a change in the desired voltage or current from the infrared remote or
from the PC charging application. This signal will be sent to the base of the power
MOSFET in order to perform this function. In order to isolate the system control board
from the power electronics board, the signal will be passed through an isolation buffer
(TC1141N). The PWM signal will be sent on pin CCP1 (pin 17) and generated with the
pseudo code shown in Listing 2:
voi d pwm_i ni t ( ) {
conf i gur e PWM
}
n t he endl ess l oop, use: / /
wm p
val ue = r ead_adc( ) ; / / Feedb
S set _pwm1_dut y( val ue) ; / / et s pul se hi gh t i me f or each cyc
Listing 2. PWM Signal Pseudo code
27
L
(L
iquid Crystal Display Interface
A central component to the user feedback of this system is the liquid crystal display
CD). The LCD will be used to display the load voltage, load current, and battery
mperature (ambient, etc.) to the user during both the battery charging and the
ply modes of operation. For this design, the 40x4
te
standalone programmable power sup
(40 columns x 4 rows) CrystalFontz alphanumeric LCD with the built-in Hitachi 44780
controller and LED backlighting will be implemented for this important purpose. The
manufacturers sample picture of this LCD is shown in Figure 20 below.
Figure 20. CrystalFontz 40x4 LCD with Backlighting in Operation.
The LCD display and controller hardware interface is shown in Figure 21. The
microcontroller will communicate with the LCD using a four-bit bus consisting of D00-
D03a n wn in the
gure are used for command / data, enable, and read / write signals, respectively.
ibble mode operation. In addition, the RS, E, and R/W lines sho
fi
Figure 21. LCD with Hitachi Controller Interface.
A sample screen during operation of the Smart Charger system is illustrated in Figure 22.
M o d e : P C T e m p .
V o l t a g e : 1 0 . 0 0 0 V B a t t e r y : 8 0 . 3 F
C u r r e n t : 1 . 5 2 0 A A m b i e n t : 7 0 . 5 F
Figure 22. L D Screen During Battery Charging Mode of Operation. C
28
The pseud
l cd_i ni t ( ) ; / / t he di spl ay.
cd_got oxy( l ef t - most col umn, t op r ow) ; / / posi t i on ( 1, 1)
D.
ct er on di spl ay
D Pseudo code.
Precisi
The LM des a
voltage output in linear propo ut of the device is 10mv per
degree Fahrenheit, referenced from 0 degrees Fahrenheit. The device has a guaranteed
ample, 0F outputs 0mV, 70 F outputs 700mV. The
device
o code to communicate with the LCD is included in Listing 3 below.
I ni t i al i ze
l
/ / Def aul t scr een speci f y desi r ed put c f unct i on
r i nt f ( l cd_put c, Mode: V Temp. , t emp) ; p
i f ( di spl ay t o be updat ed) {
l cd_got oxy( x l oc. , y l oc. ) ; / / Go t o l ocat i on on LC
pr i nt f ( l cd_put c, Message t o Di spl ay, t emp) ;
/ / Cal l s l cd_put c( ) t o pl ace each char a
}
Listing 3. LC
on Temperature Sensing
34 precision temperature sensor is a 3 terminal device that provi
rtion to temperature. The outp
accuracy of 1 F at 70 F . For ex
can be powered from a 5-30 volt source. The device comes in multiple packages,
including a TO-92 plastic package that will be used in this design. The LM34 package is
shown in Figure 23. The function to read the temperature is displayed in Listing 4 below.
Figure 23. LM
oubl e get Temper at ur e( i nt adcVal ue) {
/ / 10 bi t adc, max adc i nput at 5000mV
r et ur n adcV at i on
}
esired Temperature Reading.
34 Precision Temperature Sensor Package.
d
al ue/ ( ( 2^10) - 1) *( 5/ 10) ; / / Temper at ur e cal cul
D Listing 4. Pseudo code to return
29
Infrared Rem
The Infrared detection is implemente with the Sharp GP1UM28YK infrared
etecting unit. This unit combines a number of signal processing functions in a compact
terminal device. The operational block diagram of the device can be seen in Figure 24.
ote Input
d
d
3
Figure 24. Sharp GP1UM28YK Operational Block Diagram.
The device discriminates between a plethora of extraneous infrared noise sources
and locks in on the modulated 38 kHz source produced by an infrared remote control.
The device im ring inactive
eriods, and 0 volts when in the presence of the 38 kHz source. The device is connected
to the
/ / Don t pr ocess anot her command unt i l
/ / l ast command i s r ead
ast Ti me;
t o_
r ecei veBi t 0
&& I RFr ameVal i d)
E; }
Listing 5. Infrared Receiving Routines.
plements negative logic, and outputs approximately 5 volts du
p
microcontroller via an external interrupt pin that is configured to interrupt on
falling edge signals. The microcontroller interprets the command from the infrared
remote control by timing the interrupts, or falling edges of the signal, in the interrupt
service routine. The C code to implement this function is show in Listing 5.
I ni t i al i zat i on;
voi d I R_i sr ( ) {
i sr _i ni t i al i zat i on;
i f ( I Rhi t )
r et ur n;
del t aTi me = t i mer ( ) l
l ast Ti me = t i mer ( ) ;
i f ( del t aTi me_ o smal l | | del t aTi me_t oo_l ar ge) {
= ;
r et ur n;
}
set _dat abi t _based_on_del t aTi me;
shi f t _l ef t ( I RFr ameAddr ess, shi f t _amount , dat abi t ) ;
i f ( ent i r eFr ameRecei ved
I Rhi t = TRU
i nt I Rhi t ( ) { r et ur n I Rh; }
i nt get I RCommand( ) {
I Rh = FALSE;
Ret ur n I RFr ame. command;
}
30
PC Software Application
ge, such as Visual Basic
his is an object orien ft Windows developers.
The application will be enginee ing the notion of
class modules and objects. These class modules implement data encapsulation by
providing a public interface while hiding the internal data and implementation.
Because the application is object oriented, it makes sense to model much of the
application using UML (unified modeling language). This is an open standard modeling
language managed by the Object Management Group (OMG), and used extensively in
industry. One benefit of using a graphical modeling language is that the computing
system can be understood by the computer programmer as well as client users of that
software. The use of UML in documenting Object Oriented (OO) software design has
become the de-facto standard, and in fact the UMLs importance comes from its wide
use and standardization within the OO development community. The UML has become
not only the dominant graphical notation within the OO world but also a popular
technique in non-OO circles.
4
This document will primarily utilize UML diagrams to provide a general, overall
software system description with supplemental descriptions for those not familiar with
UML syntax. The use of pseudo code will also be utilized to provide more focus on the
underlying details.
Figure 25 represents the general system use case with respect to the user. The
user may interact with the Power supply hardware directly to power a general DC load.
The user may also interact with a personal computer (PC) that will extend the
functionality of the power supply to act as a battery charger, which connects to a battery.
This section primarily describes the PC interface with the user and the implementation of
the charger.
Figure 25. System Use Case Diagram.
The PC application will be written in a high-level langua
6. T ted language very popular with Microso
red using an object oriented style by us
4
UML Distilled, Martin Fowler, Adison-Wesley publishing 2004
Battery
User
PC
Charger
Power Supply
Smart Charger
DC Load
<<extends>>
31
The operation of object oriented programs is determined by the class objects used to
reate the application and the interaction of these class objects. Figure 26 shows the
overall
Figure 26. Overall Class Diagram.
ain Form
The main form implements the main user interface when the application starts. This
rm provides all the control and feedback necessary to operate the power supply
anually. This form interacts with the Powe anual operation of
e power supply. The main form is t in opening other application forms
ia a menu bar control or command button. From the main form configuration data that
stored in the Windows registry can be edited.
c
class diagram of the application. Each class object is further described in the
discussion.
M
fo
m r Supply class to allow m
he starting point th
v
is
Main
Form
Power
Supply
PS Device
Driver
MS Comm
Control
Charger Charging
Form
Timer
Sample Data Graph
Data
Analyzer
Configuration
Device
Timer
*
Association multiplicities are 1
unles
Lead Acid NiCad Li Ion NiMh
Create
s specified otherwise
Store Sample
*
Primary Attributes
ComSettings:String
PSSettings
ChargerSettings
Primary Methods
Load()
Save()
getComSettings()
getPSSettings()
getChargerSettings()
Primary Responsibilities
Loads configuration data
from registry
Dispatch settings via
blic inte
Save edits to registry
Configuration Class Summary
rface pu
32
The configuration class contains initialization information used by various
component classes of the application. This includes communication port and baud rate
setting, update rates, and sampling frequency settings. The Configuration class stores the
configuration data in the operating system registry.
The PowerSupply class is a high level representation of the power supply. Public
methods of this class include those that a power supply user would typically invoke,
includ ltage and setCurrent. These parameters are stored as data members of the
class. The PowerSupply class sends messages to PSDeviceDriver, which is a class in the
chain that implements communication between the PowerSupply class and the physical
hardware. PowerSupply periodically queries the hardware as a response to an event
trigger (typically once a second) from mer object. The device then sends a status
message indicating t age, d Temp . This in on is stor
in instance of a Sample object, with the time appended to the data, and then stored in the
Data container class.
er re essages from PowerSupp
packet that the hardware wi iceDriver also re
d es these PowerSupply
protocol for all messages to given in Table 12. Error codes sent
from the device to the PC a These table
Appendix as Tables A3 and A4.
Primary Attributes
Mode:MODETYPE
VoltSet:double
CurrentSet:double
Primary Methods
setVoltage(double)
rrent(double)
mple():Sam
Event()
ing setVo
the Ti
Current, an he Volt eratures formati ed as
The PSDeviceDriv ceives m ly and creates a message
ll interpret. PSDev
by
ceives messages from the
. The communications evice and translat messages for use
and from the device is
shown in Table 13. re s are also given in the
Primary Attributes
Primary Methods
setVoltage(double)
setCurrent(double)
getSample():Sample
recEvent():Event
Primary Responsibilities
Data conversion between
higher level PowerSupply
class and device
Package monitored
parameters (voltage,
current, temperature,
time) into Sample object
PSDeviceDriver Class Summary
setCu
getSa
timer
ple
Primary Responsibilities
Direct power supply
hardware in response to
us s
PowerSupply Class Summary
er interaction
33
Table 12. mmunication Packet Protocol.
sumed
Table 13. Device to PC Error codes.
The main function of h level commands (like set
th 3 v streams (0x56, 0x1D, 0x71) sent via RS-
232 serial communications ation is a co
PowerSupply represents voltages and currents in floating point
utilizes unsigned 16-bit inte um supply t. With
a maximum output voltage bit integer 0xF
represents 10 volts, and 0x0000 represents 0V. This type of conversion is represented in
Listing 6 pseudo code.
unct i on set Vol t age( doubl e ar g)
i n
by
tData
ambient temperature, and battery temperature in one
acket. In the PC this data is converted to a Sample class type, and ultimately stored in
PC-Device Co
Error Codes
Code Description Notes
0 Power on reset Normal message during a power up
1 Watchdog reset Watchdog timer timed out
2 reserved
3 reserved
4 ADC consistency check failed AD7075 and internal AD differ too much
5 PWM at maximum PWM is at maximum and the supply cannot achieve the set point
6 PWM at minimum PWM is a minimum and the supply cannot achieve the set point
7 Over Voltage fault Voltage exceeds max output for the desired current set point
8 Over Current fault Current exceeds max output for the desired voltage set point
9 reserved
10 communications timeout During PC control, device must receive a message every 10 seconds or a loss of communication is as
11 UART frame error
12 UART error
13 SPI error
14 communication failure to AD7075
15 reserved
16 reserved
17 reserved
18 reserved
19 reserved
20 reserved
PSDeviceDriver is to convert hig
e output voltage to 2. olts) into byte array
. The main interpret nversion in data types. The
numbers, while the device
voltage, or curren gers scaled to the maxim
of 20 volts, the 16 FFF represents 20V, 0x7FFF
f
t v= ar g / 20 * ( 2^16- 1)
t e[ ] message = V & hi Byt e( v) & l owByt e( v) \ \ set Vol t age Packet
send( message)
end f unct i on
Listing 6. Example of PSDeviceDriver setVoltage method.
PSDeviceDriver also performs the conversion from data sent to the PC. The ge
acket returns voltage, current, p
P
34
the Data container class. Listing 7 shows the pseudo code function for building a Sample
object from a communications packet received from the device.
f unct i on get Sampl e( byt e[ ] m) as Sampl e
S=new Sampl e
/ / i nt make16( byt e Hi Byt e, byt e LoByt e)
/ / r et var = f r act i on of max x f ul l scal e val ue
doubl e V = make16( message[ 1] , message[ 2] ) / ( 2^16- 1) *20
doubl e I = make16( message[ 3] , message[ 4] ) / ( 2^16- 1) *10
doubl e TA = make16( message[ 5] , message[ 6] ) / ( 2^10- 1) *500
doubl e TB = make16( message[ 7] , message[ 8] ) / ( 2^10- 1) *500
doubl e t i me = Syst emTi mer ( )
r et ur n Sampl
end f unct i on
Listing 7. Building a Sample object from packet data.
MS Comm Control
This is a control built into Visual Basic. The control has an input() method that
returns a byte array of buffered data received on a serial port. The control also has an
output() method that transmits data in a byte array to a device on the serial port. The
control is set up from configuration data, such as port number and baud rate, from the
Configuration class.
e( V, I , TA, TB, t i me)
The Sample class is a container class for monitored voltage, current, temperature,
and time. A sample represents a snapshot of these monitored parameters at a particular
instant of time.
Primary Attributes
Voltage:double
Current:double
AmbientTemp:double
BatteryTemp:double
Time
Primary Methods
getVoltage():double
getCurrent():double
ge
getBTemp():double
Primary Responsibilities
Container class for
monitored parameters
Sample Class Summary
tATemp():double
getTime():double
Sample(V,C,AT,BT,TS):Sam
ple
Stamp:double
35
c
Graph class to di also used by the
which processes queries from the Charger class during charging
r clas y the Charger class to query the
Data class. Recall that th ection of Sample objects, and
these Sample objects represent a data set of voltage, current, temperature and time. The
used by the DataAnalyzer class. The
ta collection. The default value is the sampling rate per minute, so if
mples are obtained every second, getVoltage() returns the average voltage over the last
minute. This averaging is advantageous because the charging process is slow and the
averaging will minimize the effect of an inconsistent sample. Other methods in this class
are only slightly more complicated. Listing 8 is an example pseudo code implementation
for voltage and Listing 9 implements the first derivative of temperature with respect to
time.
The data lass is a storage class that holds an array of samples. It is used by the
splay data and trends over time. The Data class is
DataAnalyzer class
operations.
The DataAnalyze s is a utility class that is used b
e Data class is an ordered coll
Data class provides the raw history data
DataAnalyzer exposes a number of public methods that is necessary information to
implement a charging algorithm. Some of the more direct methods, such as
getVoltage(s) are quite simple. It simply returns the average of the latest n voltage
amples in the da s
sa
Data Members
Data DataSet (byRef)
Methods
getVoltage(int n=60)
getCurrent(int n=60)
getTe
mp(int n=60)
getDVdt(int n=60)
getD2Vdt2(int n=60)
getDTdt(int n=60)
getDeltaT(int n=60)
Responsibilities
Data Analysis
DataAnalyzer Class Summary
Primary Attributes
DataSet:Sample[]
Primary Methods
getSample(int index)
addSample()
Primary Responsibilities
Provides History of
charging process
es raw data to
alyzer class
Data Class Summary
Container class for
Sample data
id Prov
DataAn
36
f unct i on get Vol t age( n) as do
/ / DS i s a r ef er ence t o t he
ys FI FO t ype
v=v+DC[ 0] . get Vol t ag
next i
r et ur n v/ n
end f unct i on
Listing 8. Pseudo code for data analysis voltag
f unct i on get DTdt ( n) as doubl e
/ / r et ur ns t he f i r st der i vat i ve of bat t er y t emper at ur e wi t h
ct t o t i me of n sampl es
t o n- 1
T1=T1+DC[ i ] . get BTemp( )
next i
T1=T1/ n / / aver age t emp
BTe
next j
T2=T2/ n / / aver age t emper at ur e of pr evi ous n sampl es
r et ur n ( T1- T2) / ( ( DC[ 0] . get Ti me( ) - DC[ 2*n- 1] . get Ti me( ) ) / 2)
end f unct i on
Listing 9. Pseudo code for temperature first derivative
Charging Form
The charging form is called by the main form when the user selects charging from
ubl e
Dat a col l ect i on
/ / i ndex 0 i s al wa t he l at est dat a ( dat a st r uct ur e)
v=0
f or i =0 t o n- 1
e( )
e calculation.
/ / r espe
/ / DS i s a r ef er ence t o t he Dat a col l ect i on
/ / i ndex 0 i s al ways t he l at est dat a ( FI FO t ype dat a st r uct ur e)
T1=T2=0
f or i =0
er at ur e of n sampl es
f or j =n t o 2*n- 1
T2=T2+DC[ i ] . get mp( )
data analysis battery
the tools menu. This form accepts user input regarding a particular battery a user wishes
to charge. This information is passed to the Charger class. The primary information
necessary to implement a charging algorithm include battery chemistry, Amp Hour
capacity of the battery, and number of cells. A sequence diagram for a typical charging
scenario can be seen as Figure 27.
37
38
Figure 27. Charging sequence diagram.
Main Form
Settings
Form
Charger
Form
<<create>>
begin charging
User updates
settings
close form
<<create>> Charger
Class
User enters battery
parameters
charging
complete
close form
Data Members
Chemistry:BATTYPE
AhCapacity
NumberOfCells:Int
TerminalVoltage
Methods
timer()
Responsibilities
Process data from charger
form
Determine appropriate
charging algorithm based
on user feedback
Dispatch charging
algorithm via periodic
Timer event
Charger Class Summary
ger class implements the functionality of a battery charger by directing
PowerSupply to apply voltage or current to the battery as directed by a charging
algorithm. The Charger class receives information about the battery to charge from the
Charging Form. From this information a battery chemistry class (Lead Acid, NiCad,
NiMh, L hich implements the charging algorithm for the particular
battery chem h rger class enables a Timer object that acts as a free running
periodic event trigger. The Timer object calls a public method of Charger that dispatches
the associated chemistry class.
The following battery che sses implement the charging algorithm for that
particular chemistry. The battery charging process is modeled as a state machine, where
the entire ch may contain many states.
As a minimum, at least two charging algorithms will be implemented for each
chemistry class. As a g neral rule, a fast charging algorithm require ore stringent,
more compl than a slow charg thm. For ex the charging
process is not terminated when a battery is fu rged, excess energy can cause gas to
be produced in the cell, as well as heat. At slow charge rates the gas can be safely
vented and the heat can safely be dissipated. During a fast charge, the cell may not be
capable of dissipating the e gy, and a cell could rupture. For the user with
enough information about a particular battery, the fast charge algorithm will be an option.
If the user does not know much about the battery ( mp hour capacity) a
slow charge algorithm will be available to charge the battery. Figure 28 represents the
state diagram for the charging process in a general sense.
Figure 28. Charging process general state diagram.
The Char
i-Ion) is refe
istry. T
renced, w
e Cha
mistry cla
arging process
e
ex algorithm
s a m
ample, if ing algori
lly cha
xcessive ener
particularly the A
Perio
Event
dic
absolute
conditions
Trig
condition
achieved
ger
charging
phase 1
H
charging
phase 2
t
ch
rickle
arge
Trigger
condition
achieved
condition
failed
conditions
OK
History state
memorizes the internal
state between calls
Trigger
condition not
achieved
Trigger
condition not
achieved
Trigger
condition not
achieved
Conditions include
voltage, current,
temperature and time
39
har ge( )
i f DA. get Del t aTemp( ) > 10F cal l t er mi nat eChar ge( )
i f DA. get Del t aTi me( ) > 60 cal l t er mi nat eChar ge( )
sel ect case ( st at e)
case ( 0)
PS. set Vol t age( Cel l s * 2. 45 vol t s)
st at e=1
cas
i f DA. get Cur r ent ( ) < . 2 * C_r at e
e( Cel l s ol t s
st at e=2
end i f
case ( 2)
/ / t r i ckl e char ge unt i l t i me expi r es
end sel ect
end f unct i on
Listing 10. Lead acid algorithm.
The lead acid battery is charged using voltage regulation with current triggers.
Listing 10 is an example of a fast charge algorithm for lead acid batteries.
f unct i on char ge( )
st at i c st at e=0 / / st or e st at e i nf or mat i on bet ween cal l s
/ / DA i s t he dat a anal ysi s obj ect
/ / PS i s t he Power Suppl y obj ect
/ / pr ocess gener al condi t i ons t hat ar e st at e i ndependent
i f DA. get Temper at ur e( ) < 0F cal l t er mi nat eChar ge( )
i f DA. get Temper at ur e( ) > 113F cal l t er mi nat eC
Data Members
C_rate:Double
Cells:Int
TerminalVoltage
Methods
fastCharge()
slowCharge()
Responsibilities
Implement charging
algorithm for lead acid
battery types
Lead Acid Class Summary
e ( 1)
PS. set Vol t ag * 2. 25 v )
fast charging
40
NiCad batteries are charged at a constant current. Many end of charge
rmination conditions exist based upon voltage and temperature. Inflection point
etecti
ing process.
for NiCad cells is endothermic, and the battery temperature can
ly charged level,
and battery temperatures rise. Other voltage
gers can be used as a backup to the primary
tteries.
l s
di t i ons t hat ar e st at e i ndependent
mper at ur e( ) < 41F cal l t er mi nat eChar ge( )
mi nat eChar ge( )
har ge( )
l t aTi me( ) > 90 mi nut es cal l t er mi nat eChar ge( )
cal l t er mi nat eChar ge( )
ent ( C_r at e amps)
DVdt ( ) <=- 20 mv/ mi n eoc=t r ue / / - dv/ dt ( backup) or
i f DA. get DTdt kup) t hen end
i f eoc / / f ast
PS. set Cur r ent ( C_r at e*. 025) / / set up t r i ckl e char ge
st at e=2
end i f
case ( 2)
/ / t r i ckl e char ge unt i l t i me expi r es
end sel ect
end f unct i on
Listing 11. Nickel Cadmium fast charging algorithm
te
d on calculation of the second derivative of voltage is an advanced method of charge
termination that has superior performance over other termination methods.
Temperature sensing also produces valuable indications of the charg
The charging process
actually drop below ambient temperature until the battery reaches a ful
when the process quickly turns exothermic
termination triggers, and temperature trig
trigger. Listing 11 is an example of a fast charge algorithm for NiCad ba
f unct i on f ast Char ge( )
al st at i c st at e=0 / / st or e st at e i nf or mat i on bet ween c
/ / DA i s t he dat a anal ysi s obj ect
PS i s t he Power Suppl y obj ect / /
/ / pr ocess gener al con
i f DA. get Te
i f DA. get Temper at ur e( ) > 104F cal l t er
t aT( ) >15F cal l t er mi nat eC i f DA. get Del
i f DA. get De
i f DA. get Vol t age( ) >= ( 1. 5V * Cel l s)
sel ect case ( st at e)
case ( 0)
r r PS. set Cu
st at e=1
case ( 1)
D2Vdt 2( ) =0 eoc=t r ue / / i nf l ect i on poi nt or i f DA. get
i f DA. get
( ) >=1. 8F/ mi n eoc=t r ue / / dT/ dt ( bac
char ge
Data Members
oltage
Met
()
C_rate:Double
Cells:Int
TerminalV
hods
fastCharge
slowCharge()
Responsibilities
ging
ry
NiCad Class Summary
Implement char
algorithm for Nickel
Cadmium (NiCad) batte
types
41
Data Members
C_rate:Double
Cells:Int
TerminalVoltage
Methods
fastCharge()
slowCharge()
Responsibilities
Implement charging
algorithm for Nickel
Metal Hydride (NiMh)
battery types
NiMh Class Summary
Nickel Metal Hydride batteries are charged at a constant current in a similar
fashion as the Nickel Cadmium battery. The voltage termination characteristics are
typically not as pronounced as the NiCad battery. Temperature indicators for the NiMh
battery are also more difficult to determine because the charging reaction is exothermic
throughout the charging cycle, although heat is more rapidly generated when the cell is
being overcharged. As with the NiCad cell, a comprehensive charge termination strategy
includes multiple trigger conditions, or backup conditions, and many of these conditions
are identical to those used with NiCad batteries. Listing 12 is an example of a fast charge
algorithm for NiMh batteries.
f unct i on f ast Char ge( )
st at i c st at e=0 / / st or e st at e i nf or mat i on bet ween cal l s
/ / DA i s t he dat a anal ysi s obj ect
/ / PS i s t he Power Suppl y obj ect
/ / pr ocess gener al condi t i ons t hat ar e st at e i ndependent
i f DA. get Temper at ur e( ) < 41F cal l t er mi nat eChar ge( )
i f DA. get Temper at ur e( ) > 104F cal l t er mi nat eChar ge( )
i f DA. get Del t aT( ) >15F cal l t er mi nat eChar ge( )
i f DA. get Del t aTi me( ) > 90 mi nut es cal l t er mi nat eChar ge( )
i f DA. get Vol t age( ) >= ( 1. 5V * Cel l s) cal l t er mi nat eChar ge( )
sel ect case ( st at e)
case ( 0)
PS. set Cur r ent ( C_r at e amps)
st at e=1
case ( 1)
i f DA. get DVdt ( ) <= - 10 mv/ mi n eoc=t r ue / / - dv/ dt or
i f DA. get DTdt ( ) >= . 9F/ mi n eoc=t r ue / / dT/ dt ( backup) t hen end
e char ge unt i l t i me expi r es
Listing 12. Nickel metal hydride fast charging algorithm
i f eoc / / f ast char ge
ckl e char ge PS. set Cur r ent ( C_r at e*. 025) / / set up t r i
st at e=2
end i f
case ( 2)
/ / t r i ckl
end sel ect
end f unct i on
42
Lithium Ion (Li Ion) batteries are the most advanced types in this group. These
batteries are charged at a constant current at a particular cell terminal voltage. This
voltage level varies among manufacturers, typically 4.1 or 4.2 volts/cell. A unique aspect
to proper charging of Li Ion batteries is monitoring battery terminal voltage, and not
charging voltage, while charging in current regulation mode. To perform this
measurement, the supply must be effectively turned off during the measurement.
Some manufacturers do not recommend a float or trickle charge after charging.
If trickle charging is desired, it should be done in a similar manner to the fast charge, but
t a greatly reduced rate or .0
Data Members
C_rate:Double
Cells:Int
TerminalVoltage
CellVoltage
Methods
fastCharge()
slowCharge()
Responsibilities
Implement charging
algorithm for Lithium
(LiIon) battery types
Ion
LiIon Class Summary
a 25C or lower, and terminated after a fixed time period.
a fast charge algorithm for Li Ion batteries.
or mat i on bet ween cal l s
t
= ( Cel l Vol t age * Cel l s) cal l t er mi nat eChar ge( )
r ent ( C_r at e amps)
l l V
t age( Cel l Vol t age*Cel l s)
Cur r ent ( ) <( 50ma*Cel l s)
end i f
end sel ect
end f unct i on
Listing 13. Lithium Ion fast charging algorithm
Listing 13 is an example of
f unct i on f ast Char ge( )
st at i c st at e=0 / / st or e st at e i nf
/ / DA i s t he dat a anal ysi s obj ect
/ / PS i s t he Power Suppl y obj ect
/ / pr ocess gener al condi t i ons t hat ar e st at e i ndependen
r ge( ) i f DA. get Temper at ur e( ) < 41F cal l t er mi nat eCha
i f DA. get Temper at ur e( ) > 104F cal l t er mi nat eChar ge( )
i f DA. get Del t aT( ) >15F cal l t er mi nat eChar ge( )
> 90 mi nut es cal l t er mi nat eChar ge( ) i f DA. get Del t aTi me( )
l t age( ) > i f DA. get Vo
sel ect case ( st at e)
case ( 0)
PS. set Cur
st at e=1
case ( 1)
PS. set Cur r ent ( 0) / / t ur n of f suppl y
PS. get Sampl e( ) / / get a sampl e wi t h suppl y of f
l t age( 1) =Cel l s*( Ce ol t age- 50mv) i f DA. get Vo
ol PS. set V
st at e=2
end i f
case ( 2)
i f DA. get
t er mi nat eChar ge( )
43
Battery connector
Perhaps the simplest part of the projec
G iety of b ay, it is difficult to ha nector that
w ttery to th me of the most com
AA type and D type, have standard battery holders types that can be used to charge a
n tteries simultaneously as seen in Figure two
prongs sticking out, or even flat metal contacts as it is often seen in cellular telephone
batteries. For those reasons, the team decided to fit the charging system with the most
common types of connectors. Thus, some standard AAA, AA, C and D type connectors
along with some alligator clips for the prongs, and a clamp system for the metal contacts,
will be provided with the charger. This should accommodate most types of batteries.
t may prove to be the hardest to achieve.
iven the wide var atteries tod ve a universal con
ill attach the ba e charger. So mon types of batteries, like
29. Others may have umber of these ba
Figure 29. Example Battery Holders.
ign: Overall Printed Circuit Board (PCB) Des
The design is based on a two-board design. The control board contains the
ents such as the
gital signals (5 volts
ircuit voltages) are
atic for this
e
n in Figure A2.
uits that implement the main switching power
ply, along with the voltage and current sense
circuits have been shown in Figures 7, 9, 10, 11, and 13. The boards will
the control board and
the boards.
microcontroller, accessories, and various headers to peripheral compon
LCD display and IR remote detector. Only low power analog and di
el shift c or less, with the exception of low power RS-232 lev
transmitted and received on this board. The comprehensive circuit schem
board is shown in the Appendix as Figure A1. The preliminary PCB artwork for th
system control board is show
The power board contains the circ
rocontroller linear sup supply and mic
circuits. These
be connected by an interconnecting cable that supplies power to
een transmits PWM signals and voltage/current sense signals betw
44
Final Product Design
After integrating all of the components described above, the finished design product
is envisioned to appear as shown in Figure 30.
Mode : PC Temp.
Voltage : 10.000 V Battery: 80.3 F
Current : 1.520 A Ambient: 70.0 F
Battery | Com Temp. Sensors
Mode : PC Temp.
Voltage : 10.000 V Battery: 80.3 F
Current : 1.520 A Ambient: 70.0 F
Figure 30. Finished Product Design.
45
Parts List
The finalized parts list shown in Table 14 includes all parts necessary to implement the
echnical Design discussed above.
Qty.
T
Table 14. Implementation Parts List.
Refdes Part Num. Description
1 IC1 PIC18F452-I/P PIC ntroller Microco
1 IC2 MAX el converter 232 S 232 lev R
1 IC3 AD7705BN Analog to digital converter 16 pin dip
1 IC4 M rochip precision rail-to-rail op amp 8pin dip CP607-I/P Mic
1 IC5 TC1411NCPA Microchip power mosfet driver 8pin dip
1 Q1 ECS-80-20-4 CRYSTAL 8.00MHZ 20PF HC-49/US
1 Q2 MP024S CRYSTAL 2.4576MHZ HC-49, 32PF
2 R1 3296Y-1-103 Bourns 3296Y 10K pot .5W top adjust 3/8" SQ CERM SL MT
1 R2 3296Y-1-200
Bourns 3296Y 20 ohm pot .5W top adjust 3/8" SQ CERM SL
MT
1 R3 ERD-S2TJ 222V 2.2K 1/4W 5%
1 R4 ERO-S2PHF4703 470K 1/4 W 1% metal film
2 R5,R7 3296Y-1-203 Bourns 3296Y 20K pot .5W top adjust
1 R6 MFR-25FBF-10K0 10K 1/4W 1%
2 R8 CFR-25J B-1K0 1K 1/4W 5%
1 ERD-S2TJ 470V 47ohm 1/4W 5%
1 Z1 LM4040AIZ-2.5 LM4040AIZ-2.5 precision 2.5V reference TO92 package
1 2-640379-4 S DIP 15AU CONN IC SOCKET 40PO
2 2-640358-4 OS DIP 15AU CONN IC SOCKET 16P
2 2-640463-4 CO N IC SOCKET 8POS DIP 15AU N
2 C1,C2 1206CG200J 9B200 20pf disk cap
1 C3 ECA-1EM100 10uF Electrolytic 25VDC
5 C4,C5,C6,C7,C8 ECA-1HM010 1uf c Electrolyti
2 C9,C10 GRM0335C1E300J D01D 30pf disk cap
1 EEU-FC1E470 47uF
1 D1 1N4148 1N4148
3 LM34DZ-ND IC SENSOR TEMP PREC FAHR TO-92
1 CFAH4004A-YYB-J P CrystalFontz 40x4 LCD
1 GP1UM27XK Sharp GP1UM28XK IR remote control receiver
1 351-43-0201 molex RC car battery connector plug
2 357-28-0201 molex RC car battery connector socket pin
4 rs232,temp,pb 22-23-2091 molex 9 pin .100 pin header
4 22-01-3097 molex 9 pin .100 connector
3 ICSP,LCD1 22-23-2061 molex 6 pin .100 pin header
2 22-01-3067 molex 6 pin .100 pin connector
2 LCD2 22-23-2041 molex 4 pin .100 pin header
2 22-01-3047 molex 4 pin .100 connector
2 IR 22-23-2031 molex 3 pin .100 pin header
2 22-01-3037 molex 3 pin .100 pin connector
100 08-50-0114 molex Crimp terminals for .100 housings
2 747905-2 9 pin D-sub Female
46
1 747904-2 9 pin D-sub Male
1 03-09-2022 molex .093 2 cir Plug 12A
5 03-09-1022 molex .093 2 cir Receptacle 12A
1 molex .093 male terminals 14-20 crimp 02-09-2103
1 02-09-1104 molex .093 female terminals 14-20 crimp
1 02-09-211 18-22 crimp 8 molex .093 male terminals
1 BH48A AA 8 cell battery holder AL
1 BH26CW C 6 cell battery holder
1 BH24DL D 4 cell battery holder
1 364-1042-ND Power Line EMI Filter, 10A
1 12FR010 RES CURRENT SENSE .010 OHM 2W
1 IRFP244 HEX/MOS N-CH 250V 15A TO-247AC
3 10CTQ150-1-ND DIODE SCHOTTKY 150V 10A TO-262
2 LM7805CT-ND Voltage Regulator, 5V,1A
4 493-1079-ND CAP 0.33uF, 35V Elec Radial
3 P11214-ND CAP 27UF 25V ELECT FC RADIAL
1 688CKS035M 6800uF 35V Elect Radial CAP
2 P11855-ND CAP 2700UF 200V ELECT TS-UQ
1 182S12 Power Toroid Transformer 225W 24V@9.38A
47
Testing Proced fication and V ures: Veri alidation
A vital part to a successful implemen er design is the
ability to test individual components and i the
alternative desig echnical desig hases.
Beginning with on and detaile as agreed
to modularize th d test each com er it has been verified
that each component functions alone, the erfaced with local
subsystem components and eventually em of the entire design.
The entire desig that the liste
section will discuss the testing procedures the more
formal testing p ll be used been
prototyped.
Hardware Testin
tation of the entire Smart Charg
nterfaces between components during
n analysis, t n, and especially the implementation p
the concepti d definition of this design, the team h
e design an ponent separately. Aft
component will be int
erge as a functioning part
d requirements specificati n must verify ons are met. This
that have already been performed and
rocedures that wi when the hardware and software has
g:
Power Supply: Since the switch-mode p sign, the
gine built a prototype ith
these supplies, to determine the voltage and current outputs under varying parameters and
WM signals, and determine what is necessary to proceed with the power supply design.
his prototype was first tested with digital multimeters and an oscilloscope. The pulse
idth modulation signal was driven by a pulse generator and varied with respect to
equency and duty ratio.
The final power supply design will be tested to verify that can output a voltage in the
nge of 0-20 V and a current in the range of 0-10 A. The PWM signal will be adjusted to
etermine the voltage and current resolutions of 20 mV and 10 mA, respectively.
icrocontroller and Accessories: The microcontroller and control board accessories
ecessary for high-level feedback have been tested during the actual design phase to
ecide what can be feasibly implemented given the time, budget, and experience
onstraints. In addition, the group individually tested these logic components in a
readboard circuit to compare the compatibility of interconnected devices and decide
hich devices should be purchased for the actual implementation. The breadboard
rototype is shown in Figure 31.
ower supply is the core of this de
electrical en ers have power supply in order to gain experience w
P
T
w
fr
ra
d
M
n
d
c
b
w
p
48
Figure 31. Breadboard for Testing During the Design Process.
Software Testing:
Microcontroller software: The microcontroller software will be tested with the
Microchip MPLAB IDE and In-Circuit Debugger-2 (ICD-2). The microcontroller and
various parts of the logic system can be easily tested with a development board, such as
the LAB-X1 board, before it is implemented in the actual design. The software routines
e
r-
ers of the public to rate the ease of use of this
application.
System Testing:
will be individually tested with test scripts with varying input parameters to determine if
they return accurate results. In addition, the scripts will test the communication protocols
between the logic system interfaces.
The final logic board design will also be tested with the ICD-2 module to make sure
that the voltage and current feedback signals are accurate to within 20 mV and
10 mA tolerances for error.
Visual Basic Custom PC application: The PC application will be tested and
debugged with the Microsoft Visual Basic.NET environment. It will be tested on th
common Microsoft Windows XP and Windows 2000 operating systems to ensure
compatibility with Microsoft Windows users. In order to test the requirement for a use
friendly interface, the design group will create a survey allowing their engineering
olleagues, professors, and memb c
As each component passes the preliminary testing procedures, it will then be
interfaced with the rest of the system on its board (power board and control / logic
board). The hardware will be tested and troubleshot by hand with digital multimeters and
an oscilloscope. This step is to ensure that good soldering methods were used and that the
system is relatively free of excessive amounts of electrical noise.
After following the testing procedures discussed and validating that the system meets
the LCD and infrared remote requirements, the entire design will meet the stated design
requirements specifications.
49
Financial Budget
The teams labor budget has been set by the Electrical and Computer Engineering
Department at $10.00 per hour for each student. This is shown in Table 15. The estimated
material cost is shown in Table 16.
Table 15. Estimated Labor Cost.
Design Team
Member
Cost per Hour Hours Per
Week
Number of
Weeks
Estimated Cost
Claudiu Bouruc $10.00 10 15 $1,500.00
Eric Boyer $10.00 10 15 $1,500.00
Mike Petrak $10.00 10 15 $1,500.00
Steven Savage $10.00 10 15 $1,500.00
Total Cost $6,000.00
Unit Total
Table 16. Estimated Material Cost.
Qty. Description Cost Cost Part Num.
1 PIC18 8 $9.38 F I/P PIC Microcontroller $9.3 452-
1 MAX 232 $3.31 RS 232 level converter $3.31
1 AD770 $9.70 5BN Analog to digital converter 16 pin dip $9.70
1 MCP6 $1.33 07-I/P Microchip precision rail-to-rail op amp 8pin dip $1.33
1 TC141 $0.95 1NCPA Microchip power mosfet driver 8pin dip $0.95
1 ECS-8 $0.58 0-20-4 CRYSTAL 8.00MHZ 20PF HC-49/US $0.58
1 MP024 $2.08 S CRYSTAL 2.4576MHZ HC-49, 32PF $2.08
2 3296Y ot .5W top adjust 3/8" SQ CERM SL MT $2.50 $5.00 -1-103 Bourns 3296Y 10K p
1 3296Y 2.50 $2.50 -1-200
Bourns 3296Y 20 ohm pot .5W top adjust 3/8" SQ CERM SL
MT $
1 ERD-S $0.07 2TJ 222V 2.2K 1/4W 5% $0.07
1 ERO-S PH $0.17 $0.17 2 F4703 470K 1/4 W 1% metal film
2 3296Y $5.00 -1-203 Bourns 3296Y 20K pot .5W top adjust $2.50
1 MFR-2 1 $0.11 5FBF-10K0 10K 1/4W 1% $0.1
2 CFR-2 $0.13 5J B-1K0 1K 1/4W 5% $0.07
1 ERD-S $0.07 2TJ 470V 47ohm 1/4W 5% $0.07
1 LM404 .39 $2.39 0AIZ-2.5 LM4040AIZ-2.5 precision 2.5V reference TO92 package $2
1 2-6403 $1.80 $1.80 79-4 CONN IC SOCKET 40POS DIP 15AU
2 2-6403 CONN IC SOCKET 16POS DIP 15AU $0.87 $1.74 58-4
2 2-6404 ONN IC SOCKET 8POS DIP 15AU $0.57 $1.14 63-4 C
2 1206C $0.19 G200J 9B200 20pf disk cap $0.10
1 ECA-1EM1 .21 $0.21 00 10uF Electrolytic 25VDC $0
5 ECA-1 $1.05 HM010 1uf Electrolytic $0.21
2 GRM0 $0.11 335C1E300J D01D 30pf disk cap $0.05
1 EEU-F $0.28 C1E470 47uF $0.28
1 1N414 $0.07 $0.07 8 1N4148
3 LM34D -ND $6.99 Z IC SENSOR TEMP PREC FAHR TO-92 $2.33
1 CFAH4 $48.70 004A-YYB-J P CrystalFontz 40x4 LCD $48.70
1 GP1UM UM28XK IR remote control receiver $1.33 $1.33 27XK Sharp GP1
1 351-43 201 molex RC car battery connector plug $0.44 $0.44 -0
50
2 357-28 molex RC car battery connector socket pin $0.10 $0.20 -0201
4 22-23-2091 molex 9 pin .100 pin header $0.87 $3.48
4 22-01-3097 $2.68 molex 9 pin .100 connector $0.67
3 22-23- $1.80 2061 molex 6 pin .100 pin header $0.60
2 22-01- in connector $0.48 $0.96 3067 molex 6 pin .100 p
2 22-23-2041 molex 4 pin .100 pin header $0.47 $0.94
2 22-01-3047 molex 4 pi $0.35 $0.70 n .100 connector
2 22-23-203 molex 3 pin .100 pin h $0.78 1 eader $0.39
2 22-01-3037 molex 3 pin .100 pin con $0.58 nector $0.29
100 08-50- molex Crimp terminals for . gs $5.34 0114 100 housin $0.05
2 747905 9 pin D-sub $4.94 -2 Female $2.47
1 747904 9 pin D-sub $1.82 -2 Male $1.82
1 03-09- molex .093 2 cir Plug 12A $0.33 2022 $0.33
5 03-09- molex .093 2 cir Receptacle 12A $1.80 1022 $0.36
1 02-09- molex .093 male terminals 14-20 crimp $0.79 2103 $0.79
1 02-09-1104 molex .093 female terminals 14-20 crimp $0.78 $0.78
1 02-09-2118 molex .093 $0.81 $0.81 male terminals 18-22 crimp
1 H48AAL A 8 cell battery holder B A $1.46 $1.46
1 BH26C C 6 cell battery holder W $1.60 $1.60
1 BH24DL D 4 cell battery holder $1.71 $1.71
1 364-1042-ND 0A $ $ Power Line EMI Filter, 1 18.53 18.53
1 12FR010 RES CURRENT SENSE .010 OHM 2W $1.56 $1.56
1 IRFP244 HEX/MOS N-CH 250V 15A TO-247AC $3.16 $3.16
3 10CTQ150-1-ND DIODE SCHOTTKY 150V 10A TO-262 $0.88 $2.64
2 LM7805CT-ND Voltage Regulator, 5V,1A $0.53 $1.06
4 493-1079-ND CAP 0.33uF, 35V Elec Radial $0.23 $0.92
3 P11214-ND CAP 27UF 25V ELECT FC RADIAL $0.28 $0.84
1 688CKS035M $10.00 $10.00 CAP 6800uF 35V Elect Radial
2 P11855-ND CAP 2700UF 200V ELECT TS-UQ $ $8.12 16.24
1 182S12 Power Toroid Transformer 225W 24V@9.38A $ $ 54.66 54.66
To $2 tal 49.92
Team Funding
e teams member.
gn team m or this de
ct.
dule
Th material funding has been set at $75 per design team
embers, this yields a total material funding of $300 f
With
four desi sign
proje
Project Sche
The Smart Ch d a strategy for completing a successful design
2005 semester. This strategy is shown in the fo an
ntation Ga art: Table 17 shows the detailed tasks and description a
gure 32 shows th entation schedule in a timeline format.
arger team has
g
develope
implementation during the Sprin rm of
Impleme ntt Ch nd
Fi e implem
51
Table 17. Implementation Gantt Chart Tasks and Description.
52
Figure 32. Implementation Gantt Chart Timeline View.
53
54
Design Team Information
Steven Savage
Computer Engineer
Team Leader, PC Software Design
Claudiu Bouruc
Electrical Engineer, Hardware Design
Eric Boyer
Electrical Engineer, Hardware Design
Mike Petrak
Computer Engineer, Microcontroller Hardware and Software, Interfacing
Conclusions and Recommendations
The design presented above was inspired by todays need of a universal battery
charger. The Smart Charger is intended to provide charging for the most common type of
rechargeable batteries. It is designed to be a very powerful tool for the knowledgeable
engineer or technician.
The ability of the charger to output real time graphs with the current and voltage
levels during battery charging makes it a very useful tool for engineers. Depending on the
chemistry of the battery that is being charged, some parameters are closely monitored,
thus giving the user an insight of the charging process.
Since the heart of the Smart Charger system is a switching power supply with
variable output, the system can easily convert from a battery charger to just a plain power
supply. This versatility would be appealing in the industry.
One of the constraints that our team was confronted with was to come up with an
elegant solution for a connector that would hook up to any battery topology. As trivial as
this may sound, this is a very complicated issue due to the fact that batteries com
countless shapes and forms. So far the team decided to have multiple connectors that
would fit the most common types of batteries, but this is an area where there is room for
improvement. This is just one example of many where the project could be developed
further. Overall, our system is a pioneer in the hybrid world of battery chargers and
power supplies, and could provide a solid base for future teams to build upon.
References
e in
1. Microchip MCP 607 Precision Operational Amplifier Data Sheet.
2. Microchip PIC18F452 Data Sheet.
3. Analog Devices AD7705 External Analog-to-Digital Converter Data Sheet.
4. Maxim RS-232 Interface Data Sheet.
5. CrystalFontz 40x4 Liquid Crystal Display Data Sheet.
6. LM34 Precision Temperature Sensor Package Data Sheet.
7. Sharp GP1UM28YK Infrared Detecting Unit Data Sheet.
Figure A S c de ssory Devices. rs to Acce with Hea
55
chemati 1. Logic Control Board
Appendix
56
Figure A2. Preliminary System Control PCB Artwork.
Table A3. Communication Protocol.
PC sends Device Replies
Packet Type Byte 0 1 2 Byte 0 1 2 3 4 5 6 7 8 notes
set Voltage 'V' hb lb 'v' hb lb Vmax=0xFFFF, 0V=0x0000
set Current 'I' hb lb 'i' hb lb Imax=0xFFFF, 0A=0x0000
set Control 'C' 0,1 'c' 0,1 0=local control, 1=pc control
set OutputOnOff 'O' 0,1 'o' 0,1 0=output off, 1=output on
get Data 'R' 'r' Vhb Vlb Ihb Ilb T0hb T0lb T1hb T1lb device to send actual voltage, current, temperatures (V,I 16bit, T 10 bit)
get PWM 'P' 'p' hb lb device replies with current 10 bit PWM value
get Status 'S' 's' Mode Control errorCode get mode, control, last error status
impromptu error 'e' errorCode device detects error or warning condition and transmits error code without promping
General Notes:
multi byte data types expressed in big endian form
Votage and Current input/output are 16 bit values
10 bit values (such as temperature and pwm status) are right justified in 16 bit field
57
Table A4. Device Error Codes.
Error Codes
Code Description Notes
0 Power on reset Normal message during a power up
1 Watchdog reset Watchdog timer timed out
2 reserved
3 reserved
4 ADC consistency check failed AD7075 and internal AD differ too much
5 PWM at maximum PWM is at maximum and the supply cannot achieve the set point
6 PWM at minimum PWM is a minimum and the supply cannot achieve the set point
7 Over Voltage fault Voltage exceeds max output for the desired current set point
8 Over Current fault Current exceeds max output for the desired voltage set point
9 reserved
10 communications timeout
During PC control, device must receive a message every 10 seconds
or a loss of communication is assumed
11 UART frame error
12 UART error
13 SPI error
14 communication failure to AD7075
15 reserved
16 reserved
17 reserved
18 reserved
19 reserved
20 reserved
58