• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
final paper.doc
 

final paper.doc

on

  • 657 views

 

Statistics

Views

Total Views
657
Views on SlideShare
657
Embed Views
0

Actions

Likes
0
Downloads
14
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    final paper.doc final paper.doc Document Transcript

    • Bluetooth-enabled Thermal Sensor By Bonnie Benjamin Kavitha Sagi Shelly Wisted ECE 345, SENIOR DESIGN PROJECT FALL 2002 TA: Russ Schreiber 10 December, 2002 Project No. 12
    • ABSTRACT The Bluetooth-enabled Thermal Sensor is a wireless interface between a temperature sensor and a personal computer (PC) to monitor an infant’s temperature. The design is achieved by transforming an analog temperature reading into a digital signal that will be transferred using the Bluetooth Standard to a personal computer. The data is displayed in a user interface on the PC. This document is a summary of the methods employed in designing, implementing, testing, and integrating the system. ii
    • TABLE OF CONTENTS 1. INTRODUCTION .............................................................................................. 1 1.1 Objective.........................................................................................................1 1.2 Changes Since Proposal..................................................................................1 1.3 Block Diagrams...............................................................................................2 1.4 Specifications..................................................................................................3 1.5 Subprojects......................................................................................................3 2. DESIGN PROCEDURE ..................................................................................... 4 2.1 Manipulating Circuit.......................................................................................4 2.1.1 Temperature Sensor...............................................................................4 2.1.2 Adder.....................................................................................................4 2.1.3 Amplifier................................................................................................4 2.1.4 Rectifier.................................................................................................4 2.1.5 PIC16F877.............................................................................................4 2.1.6 MAX232................................................................................................5 2.2 Bluetooth ........................................................................................................5 2.2.1 Bluetooth Transmitter ...........................................................................5 2.2.2 Bluetooth Receiver................................................................................5 2.3 User Interface .................................................................................................5 3. DESIGN DETAILS ..............................................................................................7 3.1 Manipulating Circuit.......................................................................................7 3.1.1 Adder.....................................................................................................7 3.1.2 Amplifier................................................................................................8 3.1.3 Rectifier.................................................................................................9 3.1.4 PIC16F877...........................................................................................10 3.1.5 MAX232..............................................................................................10 3.2 Bluetooth ......................................................................................................10 3.2.1 Bluetooth Transmitter .........................................................................10 3.2.2 Bluetooth Receiver...............................................................................11 3.3 User Interface ...............................................................................................11 4. DESIGN VERIFICATION ................................................................................ 12 4.1 Testing...........................................................................................................12 4.1.1 Manipulating Circuit............................................................................12 4.1.2 Bluetooth.............................................................................................13 4.1.3 User Interface.......................................................................................14 5. COST ................................................................................................................ 15 5.1 Parts..............................................................................................................15 5.2 Labor.............................................................................................................15 5.3 Grand Total....................................................................................................15 6. CONCLUSIONS.................................................................................................16 6.1 Accomplishments..........................................................................................16 6.2 Challenges.....................................................................................................16 6.3 Future Work..................................................................................................16 APPENDICES....................................................................................................17 REFERENCES...................................................................................................23 iii
    • 1. INTRODUCTION 1.1 Objective The objective of this project is to provide a wireless solution for monitoring an infant’s temperature. To monitor and treat a fever, the temperature must be taken every two to four hours by using a thermometer. To obtain a temperature reading, one must insert the thermometer orally, rectally, or aurally. Our solution is to create a prototype that could, in the future, be implemented by strapping the sensor to the infant’s inner thigh or underarm and continuously transmitting the signal to a monitor that a parent can have anywhere throughout the house. Since it is a wireless device, there would be no danger of the infant being strangled by wires involved with the sensor. After the Bluetooth Special Interest Group (SIG) introduced the Bluetooth Standard to the world, the types of wireless applications has increased dramatically. The SIG’s goal is to produce affordable, wireless solutions that are not limited to any one company. But, rather, the SIG encourages collaboration and compatibility between the manufacturers of Bluetooth solutions [1], [2]. Our project applies the Bluetooth technology to a wireless temperature system. The temperature is sent from the transmitter on the patient to a circuit (where it is processed) and then to a PC (where it is displayed and stored). The wireless temperature sensor allows a parent to monitor its infant’s temperature continuously by strapping the device to the child’s leg where the parent can be alerted through a monitor if the child’s temperature rises or decreases dramatically. Since it is a wireless device, the hazard of wires and cords is not present. The data will also be taken continuously so the infant’s temperature can be tracked over a period of time. 1.2 Changes Since Proposal The original specifications of the project limited the temperature range to 90-110°F. The temperature sensor has a very wide range of temperatures (-50 – 350°F) and a relatively small output voltage range [3]. The extended range allows for more precision in transmitting the temperature through the manipulating circuit. In the initial proposal, the Bluetooth link would be made using basic chips. After researching Bluetooth extensively, it was discovered that this technology was still in the infant stages of development and not very prevalent in industry. Most vendors in Europe and Asia only offered whole modules which prompted the team to change the scope of the project. 1
    • 1.3 Block Diagrams Temperature Manipulating Bluetooth Bluetooth User Sensor Circuit Transmitter Receiver Interface Adder Amplifier Rectifier PIC 16F877 Max232 Fig. 1. Block Diagram. Table 1. BLOCK DIAGRAM DESCRIPTION Block Function 1. Temperature Sensor The temperature sensor reads an input temperature and outputs a corresponding voltage. 2. Manipulating Circuit 2a. Adder The adder shifts the voltage range to a manageable range. 2b. Amplifier The signal is amplified to increase resolution. 2c. Rectifier The rectifier eliminates the negative portion of the signal. 2d. Programmable Integrated Circuit The PIC is used to transform the data to serial, bit format. (PIC) 2e. MAX232 The voltage range of the signal is modified to fit the RS232 standard. 3. Bluetooth Transmitter The transmitter functions as the server in the Bluetooth link. 4. Bluetooth Receiver The receiver functions as the client in the Bluetooth link. 5. User Interface The user interface allows the parent to view the output temperature on the PC. 2
    • 1.4 Specifications The specifications for our project are as follows: • Temperature must be within the specified range (68-105°F) • Receiver must be within 10 meters of the transmitter [4] • LabVIEW must be enabled on the receiving device • Data transmission rate up to 20 kbps [5] 1.5 Subprojects Our project is divided into three subprojects. The first subproject is the analog, manipulating circuit. It consists of outputting the temperature according to the RS232 standard. The second subproject establishes a wireless link between Bluetooth devices. The third subproject entails the user interface retrieving the data from the Bluetooth receiver. 3
    • 2. DESIGN PROCEDURE 2.1 Manipulating Circuit 2.1.1 Adder The adder shifts the lower end of the temperature range that will be monitored down to 0 V. By putting this step early in the analog signal manipulation, the majority of the signal loss occurs early in the process. After this step, the circuit behaves with a small loss of signal. 2.1.2 Amplifier The voltage range from the sensor that will be detected is small. If a range of only a few hundred millivolts is sent to the PIC, it will be difficult to register small changes in temperature. By amplifying the signal, the degrees per volt decreases dramatically. Monitoring an infant’s temperature down to a small fraction of a degree is not necessary. The effects of such a small change are moot to the infant’s health. An amplifier is ideal because it allows the engineer to clip the signal at supply voltages. Originally, the amplifier was designed to clip the voltage at +5V and at 0V based on powering the supply voltages as such. But, the amplifier needs to have a balanced V+ and V- [6]. So, by clipping at ±5V, the upper, temperature limit is set. And, at the next stage, the lower limit will be set. 2.1.3 Rectifier There are two types of rectifiers that could be implemented—the half-wave or full-wave rectifiers. The half-wave is used in this application because it zeros out the negative portion of the signal. The full-wave rectifier will invert the negative signal [7]. But, by implementing the half-wave rectifier, the temperature below 68° (0 V) will be read as 0V. The customer must be cognizant of the fact that there are rails to where the signal saturates (i.e. a temperature lower than 68° will still be displayed as 68°). In the case of human, body temperature, a temperature lower than 68° is not reasonable. Another method for clipping the signal would be to use a diode clipper that clips at both 0 and 5 volts. Since the voltage range is so small, there is a risk of losing resolution. The diodes are not as exact as op amps and could contribute to the signal loss issue. 2.1.4 PIC16F877 Initially, the team thought of using an A/D and a parallel to serial shift register. It was discovered late in the project that a parallel to serial shift register would not provide the start and stop bits necessary for asynchronous transmission. The method of transmission could have been synchronous, but there are no means of clocking the Bluetooth transmitter, which is the Impulsesoft Serial Port Adapter (iSPA). Asynchronous transmission also allows each individual character to be self contained so if it becomes corrupt along the way, the characters before and after it remain unaffected [8]. Another disadvantage of the parallel to serial shift register is the lack of internal baud rate generation. The baud rate can be set using an external clock in the shift register, but the RS232 standard for asynchronous transmission would still need start and stop bits to function. A chip that would will provide the baud rate as well as the stop and start bits is a Universal Asynchronous 4
    • Receiver Transmitter (UART). Given the problems discussed above, a few solutions are available. A microcontroller with A/D and UART capabilities or individual A/D and UART chips can be used. Since the problem was apparent late in the design process, the microcontroller was chosen over the individual chips. The parts shop offers many microcontrollers, but the most common are the Motorola’s 68HC912B32 and Microchip’s PIC16F877 [9]. Both microcontrollers contain the necessary functionality, but the PIC has fewer instructions to master, therefore it was chosen. The PIC is used to convert analog data into a serial bit stream. The data must be in this format for the Bluetooth transmitter. The A/D in the PIC is used to convert the analog input to digital bits. The A/D is a 10 bit converter but the design only uses the eight most significant bits. To improve accuracy of the A/D, an 8-bit A/D could be used but such precision is not required for our project. Each bit is representative of 4.888 mV which represents only 0.42°F per bit. 2.1.5 MAX232 The voltage range of the signal up to this juncture is 0 to 5V. The visible range of a serial port is between -12 to 12V [5]. This chip adjusts the incoming range to fit RS232 standards. At the serial port, in our case the Impulsesoft Serial Port Adapter (iSPA), will interpret -12 to -5V as a digital 1 and 5 to 12V as a digital 0. 2.2 Bluetooth There was a lot of research that went into deciding which Bluetooth transmitters and receivers would best meet our design goals. One of the challenges with choosing Bluetooth products is that individual companies design their products to meet the Bluetooth specifications in different ways. In theory, they should be able to work together, however sometimes they cannot communicate. A risk was taken when selecting products because we could not be certain that the products would be able to communicate with each other. The best situation would be to select a transmitter and receiver from the same company, but there were no companies that offered Bluetooth products as a client and receiver that would meet our design goals. The devices were primarily purchased based on customer service, deliverable time, and purchase price. 2.2.1 Bluetooth Transmitter Bluetooth requires data to be in binary format [8]. This project transmits data to a laptop, so the easiest solution would be a serial port adaptor. Most Bluetooth devices come equipped with several data transmission profiles such as a file transfer profile or a serial port profile. A Universal Serial Bus (USB) was considered, but it was not clear if the device could communicate with the circuit. Therefore the Impulsesoft Serial Port Adaptor (iSPA) was implemented [10]. 2.2.2 Bluetooth Receiver There were several design decisions that we had to make when selecting an appropriate Bluetooth receiver. There were several products that we had to choose from as our receiving Bluetooth device. The primary goal was to select a product that we would be able to easily acquire the data from. Another requirement was that was necessary was that the device have an external antenna. There were a few different types of products that would meet our goal. The Bluetooth USB, or Bluetooth PCMCIA card could easily achieve obtain the data. The decision was made to use a laptop computer as the ending data acquisition computer, so the Bluetooth PCMCIA Card (PC Card) was purchased 5
    • [11]. However if a desktop computer is desired as the data acquisition source, then the Bluetooth USB can be used in place of the PC Card. Taking cost into consideration, the Belkin PC Card was selected as the final Bluetooth receiving device [4]. 2.3 User Interface Simplicity and ease of use were basic design goals in designing the user interface. The uUser should be able to work the instrument without much knowledge of the system. The ideal situation would be to allow the user to start running the program and allow them to see the current and recent past temperatures. The user should be able to select the appropriate communication port, data rate, and amount of desired information and see the corresponding output temperatures. National Instrument’s LabVIEW software is the software chosen to write the end computer interface programsoftware. LabVIEW has a lot of powerful data acquisition capabilities and display tools, which are why it was selected as the final software program [12]. 6
    • 3. DESIGN DETAILS 3.1 Manipulating Circuit 3.1.1 Adder The voltage signal from the temperature sensor is shifted so that the lower, temperature boundary is at 0 V (68°F). And, the higher boundary (105°F) is at 0.356 V. The overall signal will be from -1.72V to 5.28V. The nodal analysis of the adder is given by Vo − V− V− − (−0.72) V− − Vin = + (1) R1 R2 R3 where R1 = R2 = R3. The final form of the equation is Vo = -(Vin – 0.72) (2) The schematic for the adder is shown in Figure 2. V- Vo Vin Fig. 2. Adder. 3.1.2 Amplifier Then, the voltage signal is amplified from a 0.356-volt range to a 5-volt range. This is accomplished with a 12.5 V/V gain. The 0 to 5V range is needed for the input of the PIC 16F877 chip. The overall signal will (ideally) be from -5 V to +5V. But, the op-amp saturates at ± 4.3V. Figure 3 7
    • denotes the layout of the amplifier. The amplifier is characterized by Vo − V − V − − Vin = (3) R2 R1 The equation simplifies to R2 Vo = − Vin (4) R1 For a gain of 12.5 V/V, R1 = 12kΩ and R2 = 150kΩ. Vo Vin V- Fig. 3. Amplifier. 3.1.3 Rectifier The rectifier zeros out the negative signal – which is below the range of temperature we want to track. There is no gain for this stage of the circuit. The signal we are left with is a 68°-105°F range. The inverter is added to the end of the rectifier to account for the fact that the rectifier is an inverting amplifier. Fig. 4. Rectifier. 8
    • Vo = V − = 0V (5) Vin V- (when both diodes are shorted) Vo (where Vin < 0V) V0 − V − V − − Vin = (6) R2 R1 Vin V- R2 Vo Vo = − Vin (7) R1 (when both diodes are conducting) (where Vin > 0V) Fig. 5. Diode Clipper. 3.1.4 PIC16F877 In order to transmit data using the Bluetooth Standard, data must be in digital format. Since the Bluetooth transmitter for this project is a serial port adaptor, the data must conform to RS232 standards. The PIC is powered by a 5V power supply and a 10.000MHz crystal oscillator that functions as the clock. A resistor-capacitor (RC) oscillator is not used because it is sensitive to temperature changes. The PIC’s A/D converter changes the input from a voltage to parallel, binary bits. The A/D is a 10-bit converter storing the result in two registers, A/D Result High register (ADRESH) and A/D Result Low register (ADRESL). By left-justifying these two registers, ADRESH stores the eight most significant bits. The ADRESH register feeds data to the USART. In addition to converting parallel data to serial, the USART also allows the user to set the baud rate. It also provides start and stop bits which are required for the RS232 standard. The asynchronous transmitter within the USART provides two modes of setting the baud rate, high speed and low speed. Shown below is the equation for the high speed mode: Fosc Baud rate = (8) [16( X + 1)] While both options are plausible in this application, the high speed option reduces baud rate error in some cases. So, it is more ideal in this case. A common baud rate for most computers is 9600 so that is the speed that is used in this project. In the case of this project, the Baud Rate = 9600 and Fosc = 10.000 MHz. By solving for X from Equation (8), the nearest integer value of X is 63 [9]. The code for the PIC is given in Appendices 4-6. 9
    • 3.1.5 Max232 The output of the USART is a string of serial bits where a logic “0” is 0V and a logic “1” is 5V. The RS232 standard dictates that the range of the data should be between -10 to 10 volts. The MAX232 converts the 0-5V range to a -10-10 V range. The MAX232 employs a voltage-doubler, a voltage inverter, and capacitors to modify the range of the serial bits [5]. The output is connected to a serial connector as shown below in Figure 6. Fig. 6. Serial Connector. Pin 5 is soldering to ground and pin 2 is output from the MAX232. This connecter is plugged into the iSPA 3.2 Bluetooth Physical link with serial null modem cable iSPA as Laptop / PC Circuit PCMCIA with serial Server port application Parameters that Serial parameters used Serial parameters used matches the serial port for configuring iSPA: Bluetooth Link in the application: of the circuit: Baud rate : 9600 Baud rate : 9600 Baud rate : 9600 Data bits :8 Data bits :8 Data bits :8 Stop bits :1 Stop bits :1 Stop bits :1 Parity : None Parity : None Parity : None Fig. 7. Bluetooth Communication. 3.2.1 Bluetooth Transmitter iSPA functions as the server in the Bluetooth wireless link. It mimics a serial cable connected to a computer, or as in our case, a circuit. The device is configured to function as the server using the provided software. This software also allows the user to create a pass key for the device. This pass key can be used for security purposes or to ensure Bluetooth communication with a particular device. 10
    • 3.2.2 Bluetooth Receiver – There was prepackaged user software included with the Bluetooth PC Card. This software is used to install the card properly in the Windows XP environment and is also used to establish a connection with the iSPA. 3.3 User Interface Several programs were written in the process of designing the final program. LabVIEW’s serial port Virtual Instruments (VI’s) are used to acquire the streaming data from the iSPA. The Belkin PC card is located at communication port 4 (COM4). Knowing this, the data that is collected in the buffer of the communication port (COM port) can be accessed and displayed in the end program [12]. The final LabVIEW program is displayed in Appendices 2 and 3. Appendix 2 shows the user interface and Appendix 3 shows the source code of the program. LabVIEW can access COM4 by entering the command ASRL4::INSRT in the ‘Resource Name’ field. On the user interface, the parent can select the desired baud rate and desired number of bits to be seen at the output. For this design, the baud rate is selected to run at 9600 baud and the desired bits are 8. The timing and data acquisition of the program are controlled by a few basic while loops. A stop button is displayed on the interface that will cause the program to stop running at any point in time. If the stop button has not been selected, the program waits until the desired number of bits has arrived in the buffer and displays the output. Running the while loop requires more time than acquiring the eight bits. Therefore, the screen will update continuously and it is necessary to clear the buffer at the end of each of the iterations. A sub-program entitled D/A is used within the final program and can also be seen in Appendix 3. This sub-VI is necessary to convert the 8-bit digital output to its corresponding analog output. Since the PIC16F877 only outputs the 8 most significant bits of its 10-bit conversion, a corresponding D/A conversion is required in LabVIEW for the program output. At the end of the D/A conversion, the program checks to make sure that the temperature is less than 105 degrees, which is the upper temperature limit of the circuit. The final program outputs the measured temperature and associated voltage and updates the visual thermometer. Also displayed on the user interface are the time and date of the last measurement taken and an error screen that displays any errors that have occurred in the program. 11
    • 4. DESIGN VERIFICATION 4.1 Testing 4.1.1 Manipulating Circuit The datasheet for the LM34CH gives a calibration curve for the sensor being 10mV/°F ranging from -1 V to 6V over a temperature range of -50°F to 350°F [3]. But, upon taking readings in the lab, the specifications were not accurate. The sensor was calibrated by varying the temperature and taking a series of readings. The calibration graph can be seen in Appendix 1, Figure 8. To verify that the analog circuit functioned as desired, a voltage was hard-wired to the input to the adder and was “added” to 0V for the sake of simplicity. At the end of each stage of the analog circuit (adder, amplifier, and rectifier), readings were taken to determine how much signal loss had occurred. The majority of the signal loss occurred during the adder. To combat that loss, different resistor values were tested. But, in the end, the 15kΩ resistors provided the least amount of loss at that stage. After the majority of the signal loss had been compensated for, the temperature sensor was wired into the circuit and the -0.72 V offset was added as the second input into the adder. The sensor has a 5V power supply, a ground, and a signal out pin. Each of these pins was connected accordingly. The sensor was placed in a plastic bag and submersed in a beaker. The beaker was heated on a hot plate to 10°F above the upper temperature limit. Ice was added to the solution in order to take readings at various temperatures in the desired window. The signal loss here was much more than when a voltage was hardwired into the input. The largest percent error obtained was 14% at the temperature boundaries. The larger signal loss can be attributed to the poor connection between the long wires and the pins on the temperature sensor. The performance of the analog circuit is listed in Appendix 1, Figure 9. Testing for the PIC was two pronged. First the A/D and USART were tested separately, and then the individual programs were combined to test the overall functionality of the PIC. The code used to test the A/D is provided in Appendix 4. In the code, port A and port B was configured as an input and output using the PORTA and PORTB registers respectively [9]. The input was further configured to be analog using the ADCON1 register. The program read an analog input from PORTA and transferred the result to PORTB. Without using a hexadecimal display, the input voltage was converted to digital bits and the output was measured across PORTB. For example, when the input is 5V, all the pins on PORTB should read between 4-5V, representing a logic “1.” Similarly a 0V input was also tested. The outputs were measured on PORTB. All output pins were consistently correct except for two pins—pin 5 and pin 8 were always low. When the input was high, the values on pin 5 and pin 8 were still a logical 0 but the voltage representation was higher than other pins. The digital bits were converted as follows 5 Quantization = (9) [2^10 − 1] Input voltage Digital representation of a particular voltage = (10) Quantization To investigate this problem further, other voltages inputs were also tested and the PIC was reprogrammed a number of times. Microchip, the manufacturers of the PIC16F877, could not deduce a reasonable explanation either. The problem persisted and there was not enough time to fix the problem. 12
    • The USART was tested using two methods. In the first method, the basic commands RSIN and RSOUT were used to produce an RS232 compatible, 9600 baud rate value that would feed itself [9]. This approach was employed because the datasheet lacked details about the above commands (RSIN and RSOUT) and this approach is simpler than the second method. This procedure helped to determine the functionality of RC6 (transmission output pin on port C) as well as the SERIAL package. The output of pin RC6 was input to the MAX232. The output of the MAX232 was connected to a PC via a serial cable. A HyperTerminal was opened on the computer side to see any transmitted data. After running a few trials and researching programs available online, it appeared that the RSIN command read its input from RC7 and could not be set in the program. The program was rewritten without the RSIN command and RSOUT was given an 8-bit binary value to continuously output that value. After talking with the course TA, it was discovered that the HyperTerminal could only read ASCII, so the program was rewritten again to accommodate the change. The program was examined for flaws, but no errors were obvious. Technical support in the department was consulted and it was determined that the fifo (first in first out) buffer of the COM port needed to be disabled for the data to be displayed. The problem persisted and Microchip suggested continuing to modify the program. The second method, which was used in the final program, implemented the Transmit Status and Control (TXSTA) register and the Receive Status and Control (RCSTA) register to control the USART. In the program (Appendix 5) the TXREG register was set to a constant hexadecimal or decimal value and then output RC6 to the MAX232 chip. It was unclear if the Transmit Shift Register Status Bit (TRMT) in the Transmit Status and Control (TXSTA) register should be a logic “1” or “0.” The TRMT sets the transfer shift register (TSR) as full or empty. So a trial-and-error method of testing was used. The TRMT was set to empty. As soon as the TXREG register was loaded with the result of the A/D, it would transfer to the TSR and out RC6. The output of the MAX232 was once again connected a HyperTerminal. The final program is also available in Appendix 5 and 6. The MAX232 chip was tested by verifying the voltage at the pins. This showed that the voltage- doubler and inverter were working therefore the chip did not accidentally burn out [5]. 4.1.2 Bluetooth The testing procedure to check the functionality of the Bluetooth devices was fairly simple. Both modules were powered up and the iSPA was configured to be the server. The Belkin PC card was enabled on the laptop. The COM ports on both the iSPA and the laptop were configured to have the same baud rates as well as the flow control options and number of stop bits. In the Belkin Bluetooth PC card, the only user options available are searching and data profiles. The PC card was set to the Serial Port Profile and to Bluetooth Device Discovery Mode [8]. The manual for the PC card was insufficient which resulted in a trial-and-error approach in ascertaining the connection. After the first successful attempt, the link was established successfully after having both devices properly powered and configured. In order to test basic data transmission between the devices, a HyperTerminal was established. By connecting the iSPA directly to a communication port on a computer terminal, a simulation was performed to confirm the functionality of the iSPA and Belkin PC card. HyperTerminal’s were opened on each computer and configured with the same baud rate, start bits, and hardware settings. By running the Belkin supported software on the laptop, a connection between the devices was confirmed. Then from the opened HyperTerminal’s, ASCII characters were be typed and transmitted between the computers. Every character sent was received correctly on the receiving end, concluding that the devices were transmitting data properly. 13
    • 4.1.3 User Interface To ensure that each aspect of the user interface was working properly, each aspect of the program was tested individually. The next step was to test the functionality of the program using a HyperTerminal to send the data to the laptop. To do this, the iSPA was again connected to a computer and a HyperTerminal was established. Series of 1’s and 0’s were sent to the LabVIEW program and analyzed. Initially there were some data flaws received in the Belkin PC serial port buffer. After testing many options, it was established that the LabVIEW software needed to be configured to read and write to the serial port instead of only reading from the serial port. This was an unexpected finding, but easily resolvable. After the final program was modified, the correct data was acquired from the buffer and the correct output temperatures were viewed on the user interface. 14
    • 5. COST 5.1 Parts • Impulsesoft iSPA unit........................................................................$455.50 • Belkin PC card.................................................................................$103.90 • PIC16F877............................................................................................$5.70 • LM741.............................................................................................6 x $0.29 • LM34CH.............................................................................................$31.09 • MAX232...............................................................................................$1.57 • 10.000 MHz crystal oscillator...............................................................$1.65 • Resistors......................................................................................17 x $0.054 • Capacitors...................................................................................................... o 33pF..........................................................................................$0.26 o 1 uF...........................................................................................$0.29 • D1N4001 (2)...................................................................................2 x $0.20 • Books............................................................................................................. o Bluetooth Revealed.................................................................$14.38 o Bluetooth 1.1: Connect Without Wires.....................................$9.99 o Discovering Bluetooth............................................................$17.44 Total: $644.83 5.2 Labor • Bonnie Benjamin ($32.50/hr)............................................................210 hrs • Kavitha Sagi ($32.50/hr)................................................................... 210 hrs • Shelly Wisted ($32.50/hr)................................................................. 210 hrs Total: $20,475 5.3 Grand Total Grand Total = (Parts) + (Labor) = $644.83 + $20,475 Grand Total = $21,119.83 15
    • 6. CONCLUSIONS This project pushes the envelope on wireless applications using the Bluetooth Standard. There are more devices that implement the wireless standard every year. With Bluetooth becoming more popular, it will be easier to develop applications using developmental kits in the future. The biggest obstacle in designing this project was finding Bluetooth components that would be compatible with one another as well as provide the information in an acceptable format for the user interface to process. A wireless, infant, temperature monitor can give peace of mind to a parent who is worried about his/her child. Since it uses the same concept as a baby, sound monitor (that is common in households with small children already), it is easy to implement the temperature monitor to work in conjunction with the sound monitor. 6.1 Accomplishments The team knew very little about wireless communication in general, let alone about the Bluetooth Standard. Coming from having little experience with Bluetooth to being able to demonstrate that the wireless portion of the project is functional was a very large step. Advanced knowledge of the functionality of op-amps was also achieved in using the single type of chip to perform several functions (adding, amplifying, and rectifying). In the area of the user interface, the team was challenged with learning how to acquire the data properly from the COM ports. We were able to manipulate the digital data and display it on the user interface. 6.2 Challenges The signal loss in the analog circuitry led to inaccurate temperature readings at the user interface. To eliminate this, the circuit needs to be more finely-tuned. From Appendix 1, Figure 9, the loss is consistent throughout the range of temperatures. Accounting for that would result in a more accurate temperature reading. The current status of the signal loss issue results in only a few tenths of a degree difference between the reading directly from the temperature sensor and the final value displayed in the user interface. Due to last minute design changes, the PIC program was never fully functional. Without this integral part, the voltage signal was not completely transformed into the necessary serial bit stream. This shortcoming can be attributed to the team’s lack of knowledge on the subject and the amount of time allotted for this part of the project. 6.3 Future Work To improve resolution, a temperature sensor with a smaller temperature range could be implemented. Furthermore, to enhance the project, more work should be done to complete the PIC program. The LabVIEW program could also be enhanced to display a graph showing temperature history. 16
    • APPENDIX 1. TEMPERATURE SENSOR CALIBRATION Tempterature Calibration 1.8 y = 0.0094x + 0.0817 1.6 1.4 1.2 Voltage (V) 1 0.8 0.6 0.4 0.2 0 30 50 70 90 110 130 150 170 Temperature (°F) Fig.8. Temperature Sensor Calibration. Temp vs. Vout 6 5 4 Output Voltage (V) 3 2 1 0 60 70 80 90 100 110 120 130 Temperature (°F) Fig. 9. Analog Circuit Performance. 17
    • APPENDIX 2. LABVIEW USER INTERFACE 18
    • APPENDIX 3. LAB VIEW FINAL PROGRAM 19
    • APPENDIX 4. A/D TESTING PROGRAM A/D Device 16F877 ' We are using a PIC16F877 Include A2D ' ** Load A2D routines ** Init A2d Define PortB=%00000000 Dim Result ' The ADC result ' *************** THE PROGRAM STARTS HERE**************** Define PortA=%00000001 ' Make AN0 (PortA.0) an input ADCON0=%10000001 ' Disable the cursor ADCON1=%00000000 ' Enable the analogue inputs BCF INTCON,7 'disables all interrupts gosub polling gosub again polling:If ADCON0<2>=1 then gosub polling 'gosub again Again: BSF ADCON0,2 Result=ADRESH ' Take a reading from PortA.0 Delayus(100) PORTB = Result 'shows result on port b Goto polling ' Infinite loop return End ' Mandatory END statement APPENDIX 5. USART TESTING PROGRAM AND FINAL PROGRAM 20
    • USART Device 16F877 ' We are using a PIC16F877 ' ** Declare the Variable used by the main program loop ** Dim InByte ' Serial character received ' ** Assign the Serial pins ** Define PortC %10111111 ' Configure the serial port '*********************** main program ****************************** BCF intcon,7 ' disables all interrupts SPBRG = 64 TXSTA = %10100110 ' Clock generated internally. RCSTA = %10000000 ' Serial port enabled. gosub Loop Loop: InByte = $36 TXREG = InByte gosub Loop return End FINAL PROGRAM Device 16f877 'Tells the program the Device we're using 'Declare variables Include A2D,SERIAL 'Include A2D so the chip knows Define PortA=%00000001 'makes PORTA bit 0 input) Define PortB %00000000 'makes PORTB all outputs to test a/d DIM channel 'A/d converter value INIT A2D ADCON0 = %10000001 '(Fosc/32 clock of 9.8304Mhz crystal. ADCON1 = %00000000 'makes the a/d result left justified INIT SERIAL Rin,Rout SPBRG = 63 TXSTA = %10000100 'We are in master mode, clock RCSTA = %10000000 'Serial port enabled APPENDIX 6. FINAL PROGRAM CONTINUED. 21
    • '********************START OF MAIN PROGRAM************************** Main: If ADCON0<2>=1 then gosub polling 'if adcon0<2>=1, there is a If ADCON0<2>=0 then gosub GetInput 'if go/done to 0 gosub Wait 'wait for acquire data to be done gosub USART USART: If PIR1<4>=0 then gosub waitps 'if TXREG is full, wait till empty If PIR1<4>=1 then gosub LoadUSART 'If TXREG is empty, go to sub. Polling: delayus(50) gosub main LoadUSART: MOVLW channel 'moves the output of a/d to the TXREG MOVWF TXRE BSF TXSTA,5 'TXEN = 1(transmission is enabled), Return GetInput: BSF ADCON0,2 'start conversion gosub wait 'wait acquisition time channel = ADIN(0) 'store conversion in channel MOVLW channel MOVWF PORTB Return Waitps: Delayus(10) return Wait: Delayus(50) 'Need min of 50usec wait for acquisition Return Goto Main 'if go/done is 0 then loop if not wait 22
    • REFERENCES The Official Bluetooth Wireless Info Site, 2001, http://www.bluetooth.com/ B. Miller and C. Bisidikian. Bluetooth Revealed, 2nd edition. Princeton, NJ: Prentice Hall PTR, 2002. National Semiconductor, “LM34: Precision Fahrenheit Temperature Sensors,” November 2000, http://www.national.com/ds/LM/LM34.pdf Belkin, “Bluetooth PC Card User Manual,” May 2002, http://web.belkin.com/support/download/files/F8T002_man.pdf Maxim Integrated Products, “MAX232: +5V-Powered, Multichannel RS232 Drivers/Receivers,” August 2001, http://pdfserv.maxim-ic.com/arpdf/MAX220-MAX249.pdf National Semiconductor, “LM741: Operational Amplifier,” August 2000, http://www.national.com/ds/LM/LM741.pdf A Precision Half-Wave Rectifier, 2000, http://www.play-hookey.com/analog/half-wave_rectifier.html N. Miller. Bluetooth Demystified. New York: McGraw-Hill, 2001. pp.50-54,180-4. Microchip, “PIC16F877: 28/40-pin 8-bit CMOS Flash Microcontroller,” 2001, http://www.microchip.com/download/lit/pline/picmicro/families/16f87x/30292c.pdf Impulsesoft, “iSPA1000 Reference Design,” 2002, http://www.impulsesoft.com/index.html M. Miller. Discovering Bluetooth. San Francisco: Sybex, 2001. pp.81-5. National Instruments, “LabVIEW Resources,” 2002, http://volt.ni.com/niwc/common.jsp? page=labview_resource&secondary=n&sidebar=n 23