Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
1 | P a g e
Body Temperature Regulation Vest for Quadriplegic Wearer – Phase II
December 11
2009
ECE 480 Design Team One:
Jarred Davis
Merav Nahoom
Christa Pline
Jawad Zaheer
Rachel Bouserhal
Facilitator: Ramakrishna Mukkamala
2 | P a g e
Executive Summary
One of the potential obstacles of a spinal injury is a reduced ability to regulate
one‟s body temperature. This inability of the body to regulate its own temperature in
extreme weather can impair basic body functions. This disorder typically accompanies
paralysis of the legs and arms, leaving a person wheelchair-bound. In an effort to provide
greater independence and increased safety for people with this disability, a jacket was
developed to regulate body temperature. This jacket controls the temperature of an
individual by heating or cooling water and sending it through a network of tubes in the
lining of the jacket. By expanding on this, a more convenient and versatile design was
made. An automated system that detects the ambient temperature and reacts accordingly
was added as well as a more convenient user interface and LCD screen.
Acknowledgments
Team 1 would like to thank:
Mr. Gregg Mulder
Dr. Charles Owen
Mr. Steven Blosser
Mr. Neal Langford
Dr. Rama Mukkamala
3 | P a g e
Table of Contents
EXECUTIVE SUMMARY ...................................................................................... 2 INTRODUCTION .................................................................................................. 4 BACKGROUND .................................................................................................... 5 DESIGN APPROACH ........................................................................................... 6 TECHNICAL DESCRIPTION .............................................................................. 11
Hardware ..............................................................................................................................................11 Peltier Junction ............................................................................................................................................11 PIC microcontroller ....................................................................................................................................12 Transistors ...................................................................................................................................................12 Relays ............................................................................................................................................................14 Vest ...............................................................................................................................................................15 Keypad ..........................................................................................................................................................16 Liquid crystal display(LCD) .......................................................................................................................20 Temperature Sensor ....................................................................................................................................21
Software..................................................................................................................................................23 User Interface ..............................................................................................................................................23 Pulse Width Modulation .............................................................................................................................26 TESTING ............................................................................................................ 29
Peltier Junction Testing ..............................................................................................................29
Duty Cycle Testing .........................................................................................................................31 Heating .........................................................................................................................................................31 Cooling ..........................................................................................................................................................33 Automatic .....................................................................................................................................................33
Testing with the User ....................................................................................................................35
FINAL COST ...................................................................................................... 37 CONCLUSION .................................................................................................... 37 APPENDIX 1 – TECHNICAL ROLES, RESPONSIBILITIES, AND WORK ACCOMPLISHED. .............................................................................................. 40 Merav Nahoom ............................................................................................................................................41 Christa Pline ................................................................................................................................................43 Jarred Davis .................................................................................................................................................44 Rachel Bouserhal .........................................................................................................................................46 Jawad Zaheer ...............................................................................................................................................47 APPENDIX 2 – LITERATURE AND WEBSITE REFERENCES ........................ 49
4 | P a g e
Introduction
A healthy human is able to maintain a constant body temperature of 98.6°F
(37°C) despite the temperature of the environment. In a hot environment, the body sends
a signal to the brain via the spinal cord with the information that the body is overheating;
the brain then sends a signal back down the spinal cord and tells the body to cool itself by
perspiration. Many people with spinal cord injuries, however, are unable to complete this
operation. With the loss of the ability to sweat, a person needs a careful control of his or
her environmental conditions or their body temperature will begin to rise excessively.
Similarly in a cold environment, the body may not be able to get the messages through to
the brain that the body is cooling down and if left untreated, the person will soon become
hypothermic.
There are a variety of clothing products designed to heat or cool individuals in
order to regulate body temperature. Some heating garments use a heat source connected
to stationary equipment, with a heating system attached to the clothing. Due to the high
power requirements, the battery power needed for this type of system is either very bulky
(lead acid) or prohibitively expensive (lithium-ion), resulting in very limited mobility
because of the electrical connections. Cooling vests use ice water that is pumped from a
reservoir and is circulated throughout the vest.
These designs, aimed at those working or living in harsh environments, often are
not intended for those with medical conditions, such as quadriplegia. Some quadriplegics,
as well as having trouble regulating temperature, have trouble sensing when something is
too hot or cold. Many of the heating products on the market use heating coils or similar
technology which can easily overheat and are unsafe for those with limited sensation.
5 | P a g e
Background
The goal of this project was to modify a heating/cooling system for the use of
quadriplegic wearers. Last semester, in combined effort with the MSU Resource Center
for Persons with Disabilities (RCPD), a jacket was designed to control the temperature of
an individual by heating or cooling water and sending it through a network of tubes lining
the jacket. The system attaches directly to, and is powered by, the users‟ wheelchair.
When activated, it pumped heated (or cooled) water though medical grade tubing in the
jacket, this in turn influenced the temperature of the wearer. There were limitations in the
design that are addressed to complete the project.
One of the limitations in the first design was power consumption. Since the
system is powered by the wheelchair‟s battery, power conservation was a necessity. The
peripherals draws large amount of current that drained the battery quickly. Pulse width
modulation was attempted to achieve energy conservation last semester. However, high
currents kept burning out the control system. Consequently, no pulse width modulation
was successfully implemented. A high current is also a limiting factor in implementing
any automated setting. In this design, a different approach was applied to achieve power
conservation. This approach steps down the voltage to an appropriate level; it will be
discussed further in the following sections.
For a design to be truly effective, it must be easy for the customer to use. In phase
I of the project there was limited user control. The only settings were off, heating and
cooling. The switches for these settings were not accessible by the user. Adding an
extendable keypad allowed not only additional heating and cooling options but also a
more accessible and convenient user interface.
6 | P a g e
With such a specialized product, a complete working design would be significant
as no product like this is currently available.
Design Approach
In addition to the limitations addressed in the previous design a number of new
features were added. Two separate approaches were taken in the design process. First, the
previous system needed to be addressed; this was done by researching and testing the
previously implemented components. The new components also needed to be researched
and analyzed. The design decisions were based on a number of design specification
including safety, power consumption, accessibility, comfort, portability and cost. These
specifications were rated (as seen in Table 1) and their weights in the component matrix
(Table 2) were used to aid in component decisions.
Table 1 Design Factor Matrix
Factor Relative Order of
Significance
Relative Weight
Safety 1 10
Power Consumption 2 9
Automatic Control 2 9
Accessibility 4 8
Comfort 5 8
Cost 6 6
Robustness 7 5
Portability 9 4
7 | P a g e
Table 2 Component Based Design Matrix
Design Component Microcontroller Thermoelectric
Device Garment Style Material
PIC PSoC Peltier Heater Jacket Vest Poly-Mesh Nylon
Factor Weight
Safety 10 5 5 9 6 5 5 5 5
Power Consumption 9 5 5 7 6 5 5 5 5
Automatic Control 9 6 8 8 6 5 5 5 5
Accessibility 8 5 5 5 5 4 7 5 5
Comfort 8 5 5 5 4 4 7 9 5
Cost 6 7 6 8 4 5 5 7 5
Robustness 5 5 5 5 5 6 5 9 5
Portability 4 5 5 9 3 5 5 5 5
Total 351 363 463 336 312 383 394 330
The basic functionality of the system was mapped out on FAST diagram and is
shown in Figure 1. Each block in the diagram was then broken down into the hardware
and software requirements as well as how they would be measured, applied, and
connected.
Figure 1: FAST Diagram
8 | P a g e
Once the components required to implement the new design were selected, an
estimate for the budget was compiled. Many components were already included in the
design from the previous semester. Each component was checked for usability, and
several were incorporated in the new design including the heatsink, fans, water pump,
tubing, and connectors. This aided in keeping the cost within the budget. Table 3 shows a
breakdown of the original cost estimate from the initial design phase.
Total Budget: $500
Table 3 Initial project budget estimate
Parts Cost Range
Vest $100 - $120
Temperature Sensors $20-50
Circuit Components $10 -$20
LCD Display $10-$30
Relays $10-$20
Microcontrollers $10 - $20
Thermoelectric Device $20-$30
Total $180 - $290
Once these decisions were made, a timeline was drawn up in a Gantt chart which
can be seen in Appendix 5. Although the timetable was a convenient gauge of where we
should stand in the design process, we were not able to adhere to it completely. We were
not grossly off track but the time required for troubleshooting was more than expected
due to which the time for testing and modification suffered. Despite these discrepancies,
the end goal was reached with time to finalize and refine.
9 | P a g e
One of the major changes that were made from the original design was to
implement the automated system without measuring the body temperature. In the
original design a body temperature reading was going to be taken into account for the
automatic control of the system. This reading was to be taken under the arm of the wearer
using a thermistor. Because the vest was designed to be worn over a shirt, an accurate
reading was very hard to obtain. If the wearer lifted their arm at all, the temperature
dropped drastically. To resolve this issue, we tried to take an average of readings but the
sensor took at least a minute to stabilize once it was disturbed.
Internal body temperature needs to be at a constant value of 98.6 degrees
Fahrenheit, an increase of one degree can be quite significant. These small changes are
hard to pinpoint without an accurate reading. The temperature under the arm is already
generally about one degree less than that of the internal temperature of the body and any
movement can change the reading.
A study was conducted, Experimental Hyperthermia in Traumatic Quadriplegia,
that showed the change in internal temperature in quadriplegics over time when in an
extreme environment. The results of this study were included in the decision process of
the duty cycles. The complete study can be seen in Appendix 3.
Another change made to the design was adding low and medium manual options
to the heating and cooling settings rather than the full on or full off options in the original
design. As a microcontroller was needed for an automatic setting this was a natural
extension of the system options. The medium and low setting could easily be obtained by
changing the operating duty cycle of the system controlled by the microcontroller. This
also aided in controlling the power issue, power is conserved when the system is in the
10 | P a g e
off portion of the duty cycle. Different duty cycles were tested and decided on according
to the test responses. These results can be seen in the testing section.
The same kind of thermoelectric device was kept from the previous design
because of its capabilities to heat and cool rather than just heat or just cool. Different
models of this component were tested (the results can again be seen in the testing section)
and a decision was made. These particular thermoelectric devices need a reversed current
polarity to change from heating to cooling and vice versa. A few options were discussed
for reversing the polarity of the current but in the end a relay system was decided upon to
do this task.
Another important decision in the design process was the choice of a
microcontroller. After some deliberation the decision was between a PIC (Programmable
Interface Controller) and a PSoC (Programmable System on Chip). Many factors were
compared including the cost, complexity, and limitations of each part. In the end, the PIC
was chosen because it was readily available and all team members were familiar with it.
The PIC had all the capabilities required to complete the design specifications of this
project and will be discussed further in the following technical description of the
components.
Implementing and programming the microcontroller was a major addition to the
system that permitted additional options desired for the overall system. These options
include extra manual options as well as the automatic setting. Using the design approach
of mixing digital and analog components was the difference between the new and old
system design and made all the options of the desired system attainable.
11 | P a g e
Technical Description
Our system required a great deal of both software and hardware design. The entire
system is monitored and controlled by a microprocessor. Using multiple relays, the
output signal from the microprocessor drives the pump and peltier junction of the device.
The operation and individual components of the project will be explained in more detail
in the following sections.
Hardware
Peltier Junction – This device is used to heat and cool the water that is
circulated through the jacket that is worn by the user using the thermoelectric effect. The
thermoelectric effect is an exchange in voltage for a change in temperature.
Thermoelectric cooling devices are typically used only for cooling, though some can be
used for both heating and cooling by reversing the polarity of the current flow; a peltier
junction is one such component.
There is a calorific effect of an electrical current at the junction of two different
metals. This effect is called the Peltier effect. When current flows through a circuit, heat
is exuded from the upper junction and absorbed at the lower junction. The heat absorbed
can be quantified by
Where Q is the heat absorbed by the lower junction per unit time, I is the current
through the circuit. is the Peltier coefficient of the entire thermocouple, and Πa and
Πb are the peltier coefficients of each material. Peltier cooler/heaters are solid-state active
12 | P a g e
heat pumps that transfer heat from one side of the device to the other. The peltier junction
is activated using a 13.8 volt source. When a positive voltage is sent to the peltier
junction, it outputs a cold temperature, inversely a negative voltage results in the warm
temperature output.
PIC microcontroller – The microcontroller is the driving force of this entire
project. PIC is a 40 pin microprocessor that has AC/DC converter capabilities as well as a
built in pulse width modulator. Both of these features were ideal in the context of this
design. To automatically adjust the temperature of the jacket the PIC receives a voltage
reading from a temperature sensor. Using the Analog-to-Digital Convertor (ADC) of the
microchip, an input voltage value is converted to a hexadecimal value. This value is then
used to determine the appropriate pulse width modulated output of the microcontroller.
Since the system is able to heat and cool, the microprocessor has two separate outputs for
each state. Temperatures below 70°F cause an output to occur at pin 16 of the PIC.
Similarly, temperatures above 80°F cause an output at pin 17. The pulse width
modulation is based on the severity of the temperature. For example, a temperature of
30°F will result in a pulse width modulated signal that is completely high, where as a
temperature of 50°F will produce an output signal that is high only 50 percent of the time.
The internal Pulse Width Modulation of the PIC did not satisfy the specifications of the
system‟s design. However, this was implemented with software.
Transistors – Transistors are used to boost the current of the output signal from
the PIC microcontroller. The relay used to control the cooling of the Peltier junction
13 | P a g e
requires a 5 V and 50 mA signal to switch states. The output signal of the microprocessor
is 5 volts, but only 7 mA. Thus, the current of the output signal has to be increased.
Originally, a line driver IC was implemented to amplify the current; however, this design
had the drawback of causing the output voltage to drop to 3.6 volts. This voltage level
then became too low to switch the relay. By implementing a transistor stage to the output
signal of PIC, current is allowed in increase without causing a voltage drop. The output
of the cooling relay will be going to the double pull double throw (DPDT) relay that will
be switching the Peltier junction. Another transistor stage was needed to boost the current
going into the DPDT from the heating pin of the PIC. Current boosting stages using
transistors are simple and require little calculations.
Figure 2: Current Boosting Circuit
The basic circuit for such a stage is shown in Figure 2. First, the correct transistor must
be chosen. To do so, the correct current gain and maximum collector current must be
figured out. To find the maximum collector current needed the equation below is needed.
IC (max) Vs
RL
To find minimum required gain the equation below could be used. Where
IL is the
current through the load, and
IIC is the maximum current sourced by the microcontroller.
14 | P a g e
HFE f 5 IL
IIC (max)
For our purposes, the 2N222A transistor satisfied all the requirements. Finally, the base
resistance is based on the equation below where,
VIC is the voltage coming out of the
microcontroller.
L
FEICB
I
HVR
5
Figure 3: Current Boosting Switching and Transistor Stage
1
2
3
4
5
1
3
56
4
2
8 7
24V
13.8V
13.8V
5V
8.2 K
4.7 K
HEATING
PIN 16
COOLING
Pin 17
PIC
18
45
20
DP
DT
RE
LA
Y
SP
DT
RE
LA
Y
Relays – Two different relays are used in this design, a single pull double throw
(SPDT) relay and a double pull double throw relay (DPDT). The DPDT is a power relay
with a control voltage of 24V. Figure 4 is a pin diagram of the DPDT relay. Pins 8 and 7
are the control voltage pins while pins 5 and 6 are the output pins. When no voltage is
applied to pins 7 and 8, the output receives the voltage seen at pins 1 and 2. When the
relay is switched on, the output receives the voltage seen at pins 3 and 4. The Peltier
15 | P a g e
junction needs +13.8V to cool and -13.8V to heat. Pin 8 is connected to the output of the
transistor heating stage and pin 7 is connected to 24V. Pin 5 and 6 are connected to
ground and input of the Peltier junction respectively. Pin 4 and 3 are connected to 13.8V
and ground respectively. Pins 2 and 1 are connected to ground and the output of the
cooling SPDT relay respectively. This is done to create an “OFF” state when using Pulse
width modulation. Therefore when the microprocessor sends a signal from the cooling
pin the SPDT relay will turn on and the Peltier receives 13.8V. During a cooling cycle
when the cooling pin goes low, for pulse width modulation, the relay sees no voltage
from pins 1 and 2 and the Peltier receives 0V. Similarly when the microprocessor sends a
signal from the heating pin the relay turns on and sends a -13.8V to the Peltier, which is
the voltage at 4 and 3. Again when the heating pin is low in a heating pulse width
modulation cycle the Peltier receives 0V which is the voltage seen by pins 1 and 2. A
schematic of this circuit is shown in figure 3.
Figure 4: Power Relay
Vest – The idea of changing the original jacket concept to a vest came from the
sponsor of this project. This change, along with being easier to manufacture, makes the
garment easier to use for the consumer. To make the vest as versatile as possible,
channels were sown in the lining for the tubes, rather than attaching them directly. There
are more channels than tubes to permit the tubes to be repositioned for maximum
comfort. This also allows the tubes to be completely removed for cleaning purposes.
16 | P a g e
Keypad – The 4 rows x 3 columns keypad matrix (12 keys), 96AB2-152-R made
by Grayhill Inc, is used to allow the user to choose the system‟s mode of operation. Even
though the keypad has 12 keys, only seven keys are required for the options of this
project. The first three buttons on the first row determine the manual heating level while
keys four through six on the second row control the manual cooling level. The seventh
key activates automatic mode. The initial idea was to connect all the matrix pins directly
to the PIC, but to save pins on the microcontroller it was decided to implement the
system using one pin. This implementation requires the use of the ADC on the PIC. Each
button on the keypad is represented with a different voltage value; this was done using
multiple voltage dividers. The output voltage is send to the pin 34 of the PIC. The
schematic of the keypad interface required to give a unique value is shown in the figure 5
while the different voltage value for each key is shown in the Table 4 below.
17 | P a g e
Figure 5: Keypad Schematic
Table 4: Voltage values of keypad buttons
Button Operation Value (V)
Range of
Operation (V)
1 Hi Heat 0.1412 0.1 – 0.2
2 Medium Heat 0.3057 0.25 – 0.35
3 Lo Heat 0.4876 0.4 – 0.5
4 High Cool 0.5904 0.55 – 0.6
5 Medium Cool 1.1549 1.1 – 1.2
6 Lo Cool 1.6636 1.6 – 1.7
7 Automatic 1.9349 1.8 – 2.0
5V
15KΩ 3.3KΩ 680Ω 180Ω
560Ω 680Ω 820Ω
PINS 1 2 3 4 5 6 7
1nF
Row 2 Row 3 Row 4 Col 2 Col 3 Col 1 Row 1
18 | P a g e
Throughout the assembly process there were many unexpected problems that
occurred in the system. When the automatic and manual modes of the system were first
tested, the system was wired almost completely on a proto board with the ambient
temperature simulated with a voltage source. This was possible since the system reads the
temperature as a voltage value. For example, 0.78 volts seen at the pin is equivalent to
78°F. The microprocessor worked perfectly using this method of testing. In the next
phase of testing, the entire system was transferred to a breadboard. This transferal caused
some of the input values going to the microcontroller to change. As a result, the system
did not work as anticipated. The programming of PIC uses voltage ranges to determine
the appropriate output. Each button of the keypad has an input voltage value that fits into
a specified voltage range as indicated in Table 4. Because of the input voltage values
changing, the specified voltage ranges needed to be changed as well. To ensure that the
voltage ranges were accurate each button voltage was tested using a digital multimeter.
Once the new ranges were programmed into PIC, the system worked properly.
Another source of error developed when the LCD was programmed to display
ambient temperature. The programming is written to display the input temperature value
whenever the user presses a button on the keypad during the manual operation of the
system. In automatic mode, the ambient temperature is recorded and displayed every
three minutes. When the LCD was first programmed, the low cooling mode and the
automatic mode were both displaying the wrong temperature value. The rest of the
operation modes did not share this issue. The reason for this problem was attributed to the
fact that the buttons triggering the automatic and low cooling modes had voltages that
were very close to the reference voltage that is used in the ADC conversion of the PIC.
19 | P a g e
For the purpose of this project, PIC uses a 2.5 volts reference to convert decimal values to
hexadecimal values, thus any input value close to 2.5 would cause an inaccurate
conversion. To remedy this issue the voltage ranges for each button were lowered by
choosing different resistor values so that the output voltage from the keypad was never
greater than 2 volts. The current circuit diagram of the keypad with modified resistor
values is shown above in Figure 5.
When the automatic function of the code was initially tested it did not behave as
expected. In the correct execution of automatic mode the system is programmed to read
ambient temperature and output a signal based on that value. If automatic mode is being
initialized for the first time, it will output a constant value for one minute based on the
input temperature to allow the peltier junction to establish an initial value. After the
minute has expired the code determines the appropriate pulse width modulation output.
However, the original coding caused the peltier to output cooling for one minute
whenever automatic mode was initialized no matter what the ambient temperature was.
After extensive debugging, it was determined that the initial cooling was caused by a
voltage spike that occurred when the entire system was turned on. The programming
would output a signal for cooling when it received an input voltage over .80 volts. When
the system would turn on the voltage spike had a high enough voltage to trigger the
cooling condition in the program. To fix this problem a delay has been added (Figure 6)
to the beginning of the main function. This allows the system to wait approximately ten
seconds before reading the input voltage from the temperature sensor.
Figure 6: Delay Loop
while(1)
{
DelaySec();
if(timeCnt >= 10)
{
timeCnt = 0;
break;
}
}
20 | P a g e
Figure 7 - User Interface
Liquid crystal display(LCD) – LCDs are electronically controlled light valves.
An LCD with a small number of segments, such as those used in digital watches and
pocket calculators is used in this project. The LCD will display the current ambient
temperature and the mode that the user chose which makes it easier for the wearer to
know about the surroundings. The wiring diagram for connecting LCD to the
microcontroller is not complicated and it uses the parallel data port to send the data. We
have utilized 10kΩ potentiometer in order to control the intensity of the screen. The
schematic of LCD connected to the PIC is shown in figure 8 below. Additional
information on those pins could be found in the software section on the LCD.
21 | P a g e
Figure 8: Wiring Diagram of LCD connected to PIC
PIC
18
f45
20
GND
VDD
Contrast
Reg Select
R/W
Enable
Data0
Data1
Data 2
Data 3
Data 4
Data 5
Data 6
Data 7
LC
D M
OD
UL
E
5 V
RD0
RD1
RD 2
RD 3
RD4
RD5
RD6
RD7
RC5
RC7
RC6
Temperature Sensor
The temperature Sensor is used to measure the ambient temperature on which the
system does heating and cooling. The National Semiconductor designed the precision
integrated-circuit temperature sensors, LM34 whose output voltage is linearly
proportional to the Fahrenheit temperature and does not require any external calibration.
It outputs approximately +10mV/°F over its wide operating temperature range of -50°F to
+300°F. As it is calibrated in Fahrenheit temperature compared to other linear sensors
calibrated in degrees Celsius, the user is not required to do extra calculations to obtain
convenient Fahrenheit scaling.
The LM34 only has three terminals. Pin 1 is connected to ground while pin 3 is
connected to a 5 volt source. The output of the sensor is connected to Pin 2 of the PIC
microprocessor. This reading is sent to a built-in Analog to Digital converter on the PIC
22 | P a g e
which stores the value in hex. Figure 9 shows the wiring diagram of how it is connected
to PIC.
Figure 9: Wiring diagram of Temperature sensor with Microprocessor
LM 34
PIC
18
f45
202
The output of the sensor is used to determine which mode of Peltier junction (heating or
cooling) with PWM, should start. The temperature is checked every minute to account for
any changes. The actual ambient temperature will also be sent to the LCD screen for the
user to know the surrounding temperature.
The sensor is attached outside the system box beside the switch so it can detect
the ambient temperature as shown in figure 9.
According to initial plans, we connected the output of the sensor with 100kΩ and
connected to -5V to operate the sensor over its full temperature range of −50°F to
+300°F. As it was hard to get -5V from the system and the ADC of the PIC cannot take
in negative voltages. Thus, we decided to directly connect the sensor to pin 2 and operate
the sensor over limited range of positive temperatures.
23 | P a g e
Software
Since the entire system is monitored and operated through the PIC
microcontroller, the programming was very extensive. Two separate functions, labeled
„automatic‟ and „manual‟, are used to execute the system‟s mode of operation. A larger
function labeled „main‟ contains both of the previously described functions and allows
the system to run continuously when going between automatic control and manual
control operations. The upper level design of the software in figure 10 is broken down to
the two main parts mentioned above.
Figure 10: upper level design
Within the automatic and the manual functions, the code was broken down into smaller
functions. Each function has its own single purpose and will be discussed further in the
following section.
User Interface
Keypad - In order to determine which button was pressed in the keypad, as
discussed in the previous section, each key press generated a different voltage. One of the
libraries supported by the PIC allows reading voltage and then converts it to a
hexadecimal value. The library that is used for that conversion is ADC.h, it converts an
Is Automatic?
start
Automatic Manual
yes No
Check button status Check button status
24 | P a g e
analog value to a digital value to be used in software. After reading the value from the
key pressed, demonstrated in figure 11, the value that was read is compared to a range of
values to determine which key was pressed. The hexadecimal value is calculated with a
reference voltage of 2.5 volts. The hexadecimal value is a 10 bit voltage value. This
means we have 1024 bits. Therefore, the calculation is as follows:
Figure 11 – Function to determine a key press
LCD Screen - The LCD connects to eleven pins on the PIC. There are eight I/O
data bus line pins on the LCD that is connecting to the PIC. Those pins control the
displayed message on the LCD. The Register Select (RS) pin of the LCD is set to zero
when giving instruction input to the LCD, and set to one when giving data input to the
LCD. The Read Write pin (R/W) is set to zero in order to write to the LCD and set to one
when reading from the LCD. Enable (E) pin enables the signal to allow reading and
writing to and from the LCD.
void KeyPressed()
{
keyValue = Read ADC result // reference voltage 2.5
if(keyValue >= 0x0014 && keyValue <= 0x0028) // 0.1-0.2 V
buttonNum = '1';
else if(keyValue >= 0x0033 && keyValue <= 0x0047) // 0.25-0.35 V
buttonNum = '2';
else if(keyValue >= 0x0051 && keyValue <= 0x0066) // 0.4-0.5 V
buttonNum = '3';
else if(keyValue >= 0x0070 && keyValue <= 0x007A) // 0.55-0.6 V
buttonNum = '4';
else if(keyValue >= 0x00E1 && keyValue <= 0x00F5) // 1.1-1.2 V
buttonNum = '5';
else if(keyValue >= 0x0147 && keyValue <= 0x015C) // 1.6-1.7 V
buttonNum = '6';
else if(keyValue >= 0x0170 && keyValue <= 0x0199) // 1.8-2 V
buttonNum = '7';
}
25 | P a g e
The main two functions to control the LCD are presented in Figure 12 in pseudo
code.
InitLCD() – clears the screen and set the cursor to the home position of the screen. The
W/R pin is set to zero to allow writing messages to the screen. Before each instruction is
transmitted RS is set to zero and E is set to one after transmission RS is set to zero.
DATA includes the eight I/O pins. After each instruction, a delay is implemented. The
delay is to allow time for the LCD to react before implementing the next instruction.
InputChar(char x) – outputs a character to the screen. In the case of this function, a data
input is sent to the LCD; therefore, the RS pin is set to one.
Figure 12 – LCD functions
void InitLCD()
{
int i;
RW = 0;
RS = 0;
E = 1;
DATA = Clear Screen
E = 0;
Delay();
RS = 0;
E = 1;
DATA = Set cursor to home position
E = 0;
Delay();
}
void InputChar(char x)
{
RS = 1;
E = 1;
DATA = x;
E = 0;
Delay();
}
26 | P a g e
Pulse Width Modulation
As mentioned earlier, Pulse Width Modulation (PWM) is the preferred method to
regulate motor speed because no additional heat is generated. In addition, it is energy
efficient when compared to linear regulation. The PWM duty cycle is defined as
Ton/Toff (%) in one period and the range is 0% - 100%. Controlling the pulse width
modulation of the system is an important aspect of this project. By controlling the duty
cycle of the Peltier Junction, the heating or cooling rate of the water can be controlled.
Moreover, implementing PWM will help in controlling and reducing the amount of
current that is drawn from the battery, hence reducing power consumption.
The period achieved by using the PIC‟s PWM is about 400 µs. The formula used to
calculate it is as follows:
PR2 – is an 8-bit PWM register
TOSC – is a timer oscillator
TMR2 Prescale Value – Range of prescale value for timer 2.
For a 40MHz crystal oscillator used in the system, TOSC is equal to , PR2 is 255 and
max TMR2 prescale is 16. Therefore, the maximum period will be
= 256 • 4 • • 16 = 409.6 µs
For more details on how to calculate the period for PWM refer to the PIC data sheet on
page 149.
A higher period was required for this system (one minute period). Therefore, a
different approach was taken in order to accommodate the necessary period.
27 | P a g e
Timers are a PIC peripheral function that can run in the background without interfering
with the rest of the program. On the 18F4520 there are four timers that can be used,
which run via hardware in the background. These timers are numbered Timer0, Timer1,
Timer2, Timer3. A timer can be set up using the timer.h library functions. In this example
code, Timer0 is setup, so the internal clock can be used:
// Setup the timer with a 1:256 prescaler with 16 bits resolution
OpenTimer0( TIMER_INT_OFF & T0_16BIT & T0_SOURCE_INT & T0_PS_1_256 )
Figure 13 – PWM using the internal clock of the PIC
The frequency of the internal clock is based on the frequency of the external clock
divided by four. In this case, the external clock is 40MHz; therefore, the frequency of the
internal clock would be 10MHz. In order to create a delay of one second, the prescale
value needs to be considered. By dividing the frequency of the internal clock by the
prescale value of 256 a result of 39,062 is obtained. In the DelaySec() function in Figure
13 the clock gets incremented until it reaches the desired value (39,062). To create a
period of one minute with a Duty Cycle of 50%, the function will count thirty seconds
before it will change the state of the pin.
unsigned int timeCnt = 0;
void DelaySec()
{
while(ReadTimer0() < 39062)
;
WriteTimer0(0);
timeCnt++;
}
OpenTimer0(TIMER_INT_OFF & T0_16BIT & T0_SOURCE_INT & T0_PS_1_256);
while(1)
{
if(timeCnt > 30)
{
timeCnt = 0;
PORTDbits.RD3 = !PORTDbits.RD3; }
DelaySec();
} CloseTimer0();
28 | P a g e
Figure 14 - Counter Values and PWM Output
Figure 14 shows how the counter works with the PWM that is implemented in Figure 13.
The explanation for the calculation of the timing and the frequency of the internal clock
can be obtained from the PIC data sheet pages 123-125.
29 | P a g e
Testing
Peltier Junction Testing
As it was one of the more important components, extensive testing was performed
to decide which peltier junction had the best performance. Figure 15 and 16 shows the
graphs of the performance of three different peltier junctions for heating and cooling.
Figure 17 shows the current drawn by each device
The first model, Peltier 1, was the original from last semester; the device was
supposed to be optimized, but it was drawing more current than expected. Because of this
fact a new eltier, Peltier 2, of the same model was obtained and tested as well. This drew
less current but had a similar time response. The third, Peltier 3, was another model rated
at a lower current. Despite being rated at a lesser current, the device drew the same
amount as Peltier 2 and had a slower response time. Peltier 2 was chosen as the final
thermoelectric device.
30 | P a g e
Figure 15: Heating Response of Peltiers
Heating
0
10
20
30
40
50
60
0 10 20 30 40 50
Time (minutes)
Wate
r
Tem
pera
ture
(C
) Peltier 1
Peltier 2
Peltier 3
Figure 16: Cooling Response of Peltiers
Cooling
0
5
10
15
20
25
0 10 20 30 40 50
Time (minutes)
Wate
r
Tem
pera
ture
(C
)
Peltier 1
Peltier 2
Peltier 3
Figure 17: Current Response of Peltiers
Current Draw
0
1
2
3
4
5
6
7
8
9
0 2 4 6 8 10 12
Time (minutes)
Cu
rren
t (A
)
Peltier 1
Peltier 2
Peltier 3
31 | P a g e
Duty Cycle Testing
Heating
Another area where a large amount of testing was required was the duty cycles for
the automatic and high/medium/low settings of the manual option. As many different
types of tests were performed as time allowed. The first round of testing was done before
the microcontroller was implemented. Figure 18 shows a comparison of water
temperatures reached by the system for a 40% duty cycle both inside (at an ambient
temperature of 25 oC) and outside (ambient temperature of 10
oC). The system at this
time was running without a person wearing the jacket, so the body temperature was not
affecting it.
Figure 18: Duty Cycle Testing
Duty Cycle 40%
-10
0
10
20
30
40
50
0 10 20 30 40 50
Time (Minutes)
De
gre
es
Ce
lsiu
s
Inside (25 C)
Outside (10 C)
Duty Cycle
32 | P a g e
After the microcontroller was implemented and the system was operational in all
aspects, more testing was done to decide which duty cycles would be the most beneficial
to the system. For high heating, a 100% duty cycle was decided on. Figure 19 shows
three different options for medium heating. Medium heat 1 is the original estimate of a
60% duty cycle with a period of one minute. Medium heat 2 is the water temperature
with 60% heating and 40% cooling (period of one minute), and medium heat 3 is a 40%
heating duty cycle with a period of five minutes.
Figure 19: Medium Heat Options
Medium Heat Duty Cycles
0.00
5.00
10.00
15.00
20.00
25.00
30.00
35.00
40.00
45.00
50.00
0 2 4 6 8 10 12 14 16
Time (Minutes)
Wate
r T
em
pera
ture
(C
)
Medium Heat 1
Medium Heat 2
Medium Heat 3
Figure 20 shows the low heating options.
33 | P a g e
Figure 20: Low Heating Duty Cycle Options
Low Heating Options
0.00
5.00
10.00
15.00
20.00
25.00
30.00
35.00
40.00
45.00
0 10 20 30 40 50
Time (minutes)
Wate
r T
em
pera
ture
(C
)
Low Heat 1
Low Heat 2
Testing for the final prototype was different from previous testing. With the first
tests, water temperature was tested in an open reservoir. When bringing the system out
into a very cold environment a lot of heat was lost through this open reservoir method. To
conserve heat as much as possible the reservoir was (done away with), the casing was
closed as tightly as possible, and as much insulation was added as possible to the tubes
that were exposed to the air. In these tests, a thermometer was placed inside the vest and
the temperature readings were taken in this manner.
Cooling
The high cooling was also set at 100%. The cooling response of the Peltier is a
little more limited. A medium duty cycle was chosen at 60% and a low at 30%.
Automatic
The automatic setting were based on the previous duty cycle testing, expected
values of body temperature readings (see Appendix 3 for study results), and input from
the sponsor. Table 5 shows the ranges of temperatures and corresponding duty cycle
settings.
34 | P a g e
Table 5: Initial Duty Cycle Estimates
Temperature Range Setting Duty Cycle
Below 40o Heating 100%
Between 40 o
and 50 o
Heating 80%
Between 50 o
and 60 o
Heating 60%
Between 60 o
and 70 o
Heating 40%
Between 70 o
and 80 o
Off 0
Between 80 o
and 90 o
Cooling 50%
Above 90 o
Cooling 100%
After testing the Duty Cycle with the above values, some changes were made.
The results for 80% and 100% Duty Cycle were very close. Also, the 60% and 40% Duty
Cycle were too high for the temperature rage. The new values for the new Duty Cycle are
indicated in Table 6 below.
Table 6: Updated Duty Cycles
Temperature Range Setting Duty Cycle
Below 40o Heating 100%
Between 40 o
and 50 o
Heating 60%
Between 50 o
and 60 o
Heating 40%
Between 60 o
and 70 o
Heating 20%
Between 70 o
and 80 o
Off 0
Between 80 o
and 90 o
Cooling 50%
Above 90 o
Cooling 100%
35 | P a g e
Testing with the User
Now that the duty cycles were chosen and tested, it is necessary that we test the
system on the user. The vest needs to maintain the user‟s body temperature in extreme
weather. First, the user was taken outside where the ambient temperature was about
32oF. His initial body temperature reading was 98
oF. His body temperature was
monitored for 20 minutes. Readings were taken and recorded every ten minutes. After 20
minutes of being outside his body temperature dropped to a 97 oF with the system off. We
then turned on the system. Given the ambient temperature, the system was on the highest
heating setting. After ten minutes his body temperature was raised to a 97.5 o
F and then
maintained at that magnitude for the rest of the test. Figure 21 below represents the
results of the test. The blue portion of the graph represents the time period with the
system off, and the red region represents the time period the system is on.
This test insured proper functioning of the system in a worst-case scenario. The
system was outside with the user for 20 minutes and not turned on; all components were
cold before the system was turned on. The pump sees more resistance in cold weather,
and thus becomes slower. In normal use the system will turn on the moment the ambient
temperature was detected. It will take it a shorter time period to heat the vest since the
components would not be cold already.
36 | P a g e
Figure 21 – results of user test
37 | P a g e
Final Cost
Table 7 Final Cost
Parts Cost Range
DC/DC Converter $12.63
Temperature Sensors $1.25
Keypad $12.26
Fabric $15
Tubing Connectors $27.48
Relays $4.69
Zipper $3
Total $76.31
Conclusion
Our system is designed to be used with quadriplegics who have some mobility. It
has an automatic setting. This is done by an ambient temperature sensor which translates
the read temperature into a voltage. This voltage is then converted to hexadecimal and is
read by the microprocessor. Depending on the value read by the temperature sensor, the
microprocessor will drive the system to go in one of six modes: four ranges of heating
and two ranges for cooling. Different ranges of temperature were achieved by using pulse
38 | P a g e
width modulation. For example, the highest heating cycle would have a 100% duty cycle
and the lowest would have a 20% duty cycle.
The output signals of the microprocessor will go into transistor current boosting
stages. This is done so that the relays could be driven. The outputs of the transistor stages
will go into the switching circuitry. By manipulating this circuitry +13.8V sent to a
thermoelectric device, the Peltier junction, when the system is cooling and -13.8V when
the system is heating. It also sends 0V when the pulse width modulated signal is low.
This system also has a manual override using a 12 button key pad. In case the user
wants to break out of the automatic setting and choose the heating or cooling intensity a
keypad was added to the system. The keypad again provides the user with six different
modes of heating or cooling. It also allows the user to revert back to automatic mode if
desired.
To make the user interface more convenient and LCD screen was added. The
LCD screen displays the current ambient temperature and what mode the system is in.
The LCD and keypad will be extended from the system, on the back of the wheelchair, to
the user. Thus, allowing the user to have constant monitor over the ambient temperature
and constant control over how hot or cold the system gets.
Our system offers a more independent life for quadriplegics with some mobility.
It offers a safe way of giving them the ability to support extreme weather. The next step
is to universalize this design. Some quadriplegics do not have any sort of mobility, but
still experience problems in body temperature regulation. However, controlling this
system would be impossible. A way offer them an ability to use this system would be to
add a voice activated command that would respond to the users control requests with no
39 | P a g e
need to be mobile. Another improvement on this design could be done on the casing. A
better insulated system could lead to better performance in extreme weather. The casing
could also be altered to function with no need to be covered, which can also lead to better
results.
The system designed satisfies all design requirements, making this a safe product
to be used for body regulation with quadriplegic. Refer to the figure 22 below for the
schematic of the system.
Figure 22 - schematic of the system
40 | P a g e
Appendix 1 – Technical roles, responsibilities, and work
accomplished.
The technical roles were divided up at the beginning of the semester and can be
seen in Table 1.
Table 1 Initial Technical Roles
Name Technical Roles
Jarred Davis Power
Christa Pline Circuit Assembly
Rachelle Bouserhal User Interface
Jawad Zaheer Temperature Sensors
Merav Nahoom Software/Programming
This was adapted many times during the semester and collaborative efforts were required
for most areas of the project. Following is a personal description from each member of
the technical work they did throughout the semester.
41 | P a g e
Merav Nahoom
As the only Computer Engineer, I was assigned to the role of developing software
for the microcontroller and implementing a user interface. After the hardware
components were chosen, I had to focus my research on the data sheet of the PIC. As
a result of this, I learned how to access different data, read ports, and understand the
memory management of the PIC. In addition, I learned how to effectively use the
MPLAB, which is the C language editor and compiler.
I had to design a workflow chart for myself and break the work into sections. I
started by listing all the components that needed to be implemented in order to
develop a successful product. After listing all the components, I prioritized them. The
priority of each component was my guideline for the rest of my work. I started by
implementing the outlined goals of the automated part of the system. My team and I
decided that we will detect ambient temperature. The ambient temperature will be the
deciding factor of whether the system will be cooling or heating. I started by reading
the temperature from the thermistor, by utilizing the ACD library that the PIC
supports. Next, I used a simple “if” and “else” statements and divided the different
temperature ranges to perform different functions. A big portion of the development
42 | P a g e
of the automated system was based on the function I wrote to implement Pulse Width
Modulation that will satisfy our design specifications.
I started by developing a test case for Pulse Width Modulation, which is the most
important aspect of the automated system of our project. First, I produced high and
low pulses. Next, I had to implement it by using a clock. A clock, in this case, is very
important in controlling the period of each cycle. Another major test case was the
user interface, which includes the keypad and the LCD. I approached this by
separating the LCD to a separate test code from the keypad. This way I could test
them separately. After perfecting the code for each one of those components I
combined them together to the main code.
In my work chart I broke down the components of our design to different
functions. I also followed this pattern in developing my code. Before adding any
component to the main code, I created a separate file that implements only a specific
component. Only after it was working on its own, according to the standards that I
specified in my design stage, I combined it into the main code. By doing this, I
managed to debug the code more easily and eliminate potential problems in the early
stages of the development.
Extensive testing should take place in every new product developed with an
emphasis on safety and reliability. Ideally, the programming stage would be the last
thing in developing this kind of a system. However, because of time constraints, I had
to develop the software as the hardware was being developed. Therefore, I developed
a small test board that simulated the system and tested my code on that board. I
believe this gave us some more time for testing and fixing bugs.
43 | P a g e
Christa Pline
The first major technical aspect that I worked on was changing the thermoelectric
device. The original test of the system showed that this element was drawing quite a
bit of current. A new model and new component of the same model were both
ordered. After changing the Peltier Junction I ran the same kinds of tests that had
been run on the old system, for current and temperature. There was less current draw
but there was also less temperature response. The Peltier was changed again with the
new component of the same model number had the same temperature response of the
first component but less current draw.
The next section that needed to be worked on was making the relay system. To
change the polarity of the current we decided on a relay system. Two relays were
required with transistor stages to boost the current and it took the whole group effort
to get the desired output of the second relay.
At the beginning of the project I wrote some pseudo code for how the automatic
and manual setting to function. The programming was not an area that I worked
extensively on but there were some issues with the automatic program that I helped to
work out. Because of the large number of changes in the code some of them are used
in the final version and some of them have been built upon and some done away with.
44 | P a g e
Assembling and testing the system was the final part of the project and I did a lot
of work in this area. Once the programming was done for the day and uploaded on the
microcontroller I would assemble the system and test for functionality. This was
greatly a group effort as well. Each of us has done a fair share of testing of the
components separately and as a whole system throughout the design process.
Jarred Davis
My technical portion of the project involved implementing power boosting
techniques and integrating the software of the project with the hardware. Merav
Nahoom wrote the code required to run our entire project. Once Merav finished
compiling a portion of the code I had the opportunity to test the code using the
hardware of our device. Using the debugging mode of the MPLAB software I was
able to trouble shoot the programming, if there were any problems in the functionality
of the project I could locate the problem in the code and make corrections.
For our system to function properly we need to amplify the output signal of our
microprocessor. I implemented a line driver component in an attempt to boost the
current level. This implementation proved to be useless since the line driver caused
the current to increase to the appropriate level but unfortunately the voltage dropped
to a level too low to run our system. As a result my teammate, Rachel Bouserhal,
45 | P a g e
implemented a current booster using transistors which proved to be successful in
running our project. After Rachel completed the assembly of the transistor stage I
tested the system with Christa Pline, and we discovered that the system was
functioning properly.
The keypad was wired in two different ways. I was responsible for the first
method of wiring. I used three different voltage dividers, which allowed each row of
the keypad to have a different voltage value. I used this method because the
architecture of the keypad does not allow the microprocessor to distinguish between
rows; it could only distinguish columns. Thus I used the voltage dividers to make
each row distinguishable. For this method to work properly three microprocessor pins
are needed. This method however, was not implemented into our current design.
Jawad Zaheer developed the current wiring method using some of the concepts from
my design. This design is an optimized version of the previous implementation, and
only requires the use of one microprocessor pin.
There were multiple issues with in system operation when the hardware was
transferred from a proto board to a bread board. It was my responsibility to evaluate
these problems, and correct them. This involved testing the microprocessor input
voltages and making changes to the programming based on these values. Hardware
connections also had to be checked and corrected if necessary.
46 | P a g e
Rachel Bouserhal
I am a very analog and hardware oriented person. My technical role involved the
manipulation of switching circuitry and analog circuits. Our project needs both a
+13.8V supply and a -13.8V supply. Since power is supplied from the wheel chair its
unsafe to convert the supply voltage. I created a switching circuit using relays that
will supply the Peltier junction both +13.8V and -13.8V when it is cooling and
heating respectively. Also, using circuit manipulation I created an “OFF” state where
0V is being sent to the Peltier junction when it is low in a pulse width modulation
cycle. This involved a lot of trial and error. Working on it until I achieved my desired
results, helped me better understand relays.
Since the inputs of the relays are outputs of the microprocessor, each input needed
a current booster to trigger the relay. I also created each current boosting stage from
the outputs of the microcontroller into the relay. This involved some analog circuitry.
I had to look back to my analog classes to design a transistor stage that I can drive
into saturation given the specifications of our system. This involved using the correct
transistors and the correct base resistances. This is a useful circuit to understand. It
can be used in many applications.
47 | P a g e
After everything was implemented, testing was a very important part of our
project. Understanding the effects of different duty cycles of pulse width modulation
on the temperature of the vest could only be done through testing. After both the
manual settings and automatic had been programmed I tested the system. To ensure
that the results we expect are received. Our project was testing heavy and everyone
did a portion of it. Testing helped us better understand our system and make any
calibrations to it we need to have it perform the way we want it.
I have focused my education on circuits and analog theory. I am glad that I was
able u se my knowledge in those areas and contribute to my team. Everyone on the
team had significant roles that were necessary for the completion of the project.
Jawad Zaheer
During the entire design process, I was given several responsibilities. In
the beginning, I was assigned to develop a temperature sensor that can detect the
ambient temperature. It is one of the integral parts of the project as the heating and
cooling of the system primarily depends on it. I researched several elements that
measure temperature such as thermistors, thermocouples. Thermistors are nonlinear
to any temperature scale and needs calibration while thermocouples have low output
levels and require cold junction compensation. Then I came across National
48 | P a g e
Semiconductor part, LM 34, which fulfilled our project needs. The output voltage of
LM34 is linearly proportional to the Fahrenheit temperature and does not require any
external calibration.
I was also involved in developing the user interface. I setup the LCD to the
PIC microcontroller so software can be implemented on it. I also created the current
keypad design implementation with multiple resistors going into single pin of the
PIC. I also worked with the Sponsor, Stephen Blosser, for the case for the user
interface. The user interface is extended from the system to the case using the printer
port cable to make it easier for wearer to use.
I was also responsible for integrating different components together as
well as troubleshooting hardware and software issues. After everyone finished their
task, the whole system was first implemented on the breadboard. After that was
successful, the whole system was transferred to project board and tested again. There
was extensive testing required to understand the Pulse Width Modulation required
optimizing the system. Once all issues in the design were accounted for, I finally
made the PCB layouts of the project using the program Eagle. From designing to
troubleshooting, it gave me an opportunity to apply my knowledge and gave me a
chance to learn about various aspects of the design.
49 | P a g e
Appendix 2 – Literature and website references
2N222. Digital image. Kmitl. Web.
http://www.kmitl.ac.th/~kswichit/npn/2n2222.gif
ECE 302: Electronic Circuits. Wierzba, Gregory M. Print.\
Embedded C, Pont, Michael J. Print.
Expiremental Hypothermia in Traumatic Quadriplegia. Totel, G.L., R.E. Johnson,
F.A. Fay, J.A. Goldstein, and J. Schick. International Journal of Biometeorolgy 15.2
(1971): 346-55.
High-Performance Modules. http://www.tetech.com/Peltier-Thermoelectric-Cooler-Modules/High-Performance.html
MPLAB C18 Libraries
http://ww1.microchip.com/downloads/en/devicedoc/MPLAB_C18_Libraries_51297f.pdf
MPLAB C18 User’s Guide
http://ww1.microchip.com/downloads/en/devicedoc/MPLAB_C18_Users_Guide_51288j.
PIC18F4520 Data Sheet
http://ww1.microchip.com/downloads/en/DeviceDoc/39631B.pdf
Transistor Circuits. Welcome to the Electronics Club. 12 Nov. 2009.
http://www.kpsec.freeuk.com/trancirc.htm#pnp