48
SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING NAME: Amir Dillawar STUDENT ID: 200930623 COURSE: ELEC5451M ASSESMENT: Embedded Project Report DATE: 13 th December 2015

Embedded Systems Report

Embed Size (px)

DESCRIPTION

Report on a Temperature Logger Embedded System

Citation preview

Page 1: Embedded Systems Report

SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING

NAME: Amir Dillawar

STUDENT ID: 200930623

COURSE: ELEC5451M

ASSESMENT: Embedded Project Report

DATE: 13th December 2015

Page 2: Embedded Systems Report

Table of Contents Introduction ............................................................................................................................................ 1

Microcontrollers ................................................................................................................................. 1

The Temperature Logger Project ........................................................................................................ 3

Hardware Description ............................................................................................................................. 4

The mbed NXP LPC1768 ...................................................................................................................... 5

The TMP102 Temperature Sensor IC .................................................................................................. 7

The Nokia 5110 LCD ............................................................................................................................ 8

The Switches and Push Buttons ........................................................................................................ 11

Software Description ............................................................................................................................ 12

The User Interface ............................................................................................................................. 12

Software Structure ............................................................................................................................ 14

Results and Testing ................................................................................................................................. 5

Conclusion ............................................................................................................................................. 13

References ............................................................................................................................................ 14

Appendix 1 ............................................................................................................................................ 15

Appendix 2 ............................................................................................................................................ 24

List of Figures

Figure 1 - The basic structure of an embedded system .......................................................................... 1

Figure 2 - The structure of a basic microcomputer (Source: [2] ) ........................................................... 2

Figure 3 - The structure of a basic microprocessor (Source: [3] ) ........................................................... 2

Figure 4 - The structure of a basic microcontroller (Source: [2] ) ........................................................... 3

Figure 5 - Completely assembled Temperature Logger Project ............................................................. 4

Figure 6 - The circuit diagram for the Temperature Logger Project ....................................................... 4

Figure 7 - Block diagram of the Temperature Logger Project ................................................................. 5

Figure 8 - The mbed NXP LPC1768 microcontroller ................................................................................ 5

Figure 9 - Block diagram of the mbed NXP LPX1768 microcontroller (Source: [5] ) ............................... 6

Figure 10 - The TMP102 temperature sensor IC ..................................................................................... 7

Figure 11 - Block diagram of the TMP102 IC (Source: [6]) ...................................................................... 7

Figure 12 - Nokia 5110 LCD ..................................................................................................................... 8

Figure 13 - The pinout of the Nokia 5110 LCD Assembly (Source: [7]) ................................................... 9

Figure 14 - Block diagram of the PCD8544 LCD driver (Source: [8] ) ...................................................... 9

Figure 15 - Mapping of the DDRAM to the LCD for the PCD8544 LCD Driver ...................................... 10

Figure 16 - Buttons and switches used in the project........................................................................... 11

Figure 17 - The Welcome Screen .......................................................................................................... 12

Figure 18 - Default Screens 1 and 2 ...................................................................................................... 12

Figure 19 - Menu Screens 1 to 4 ........................................................................................................... 13

Figure 20 - The Adjust Brightness Screen ............................................................................................. 13

Figure 21 - The Adjust Sample Time Screen.......................................................................................... 13

Page 3: Embedded Systems Report

Figure 22 - The Erase File Screen and its sub-screens .......................................................................... 13

Figure 23 - The Temperature Plot Screen ............................................................................................. 13

Figure 24 - Part 1 of the Main Function Flowchart ................................................................................. 1

Figure 25 - Part 2 of the Main Function Flowchart ................................................................................. 1

Figure 26 - The Get Temperature Function flowchart ............................................................................ 1

Figure 27 - The Write to File Function flowchart .................................................................................... 1

Figure 28 - The LCD Update Function flowchart ..................................................................................... 1

Figure 29 - The Get Time Function flowchart ......................................................................................... 2

Figure 30 - The Display Error Function flowchart ................................................................................... 2

Figure 31 - The Write to Configuration File Function flowchart ............................................................. 3

Figure 32 - The LCD Display Function flowchart ..................................................................................... 4

Figure 33 - The Welcome Screen displayed on the LCD ......................................................................... 5

Figure 34 - Default Screen 1 displayed on the LCD ................................................................................. 5

Figure 35 - Default Screen 2 displayed on the LCD ................................................................................. 6

Figure 36 Menu Screen 1 displayed on the LCD ..................................................................................... 6

Figure 37 - Menu Screen 3 displayed on the LCD ................................................................................... 7

Figure 38 - The Adjust Brightness Screen displayed on the LCD ............................................................. 7

Figure 39 - The Adjust Sample Time Screen displayed on the LCD ......................................................... 8

Figure 40 - The Delete File Screen displayed on the LCD ........................................................................ 8

Figure 41 - Message Screen 1 displayed on the LCD............................................................................... 9

Figure 42 - Message Screen 2 displayed on the LCD............................................................................... 9

Figure 43 - Error Screen 1 displayed on the LCD ................................................................................... 10

Figure 44 - The graph of the temperature displayed on the LCD ......................................................... 10

Figure 45 - A graph of the results obtained with a sample time of 60s ................................................ 11

Figure 46 - A graph of the results with sample time of 10s .................................................................. 12

List of Tables

Table 1 - List of peripherals of the mbed NXP LPC1768 microcontroller (Source: [5] ) .......................... 6

Table 2 - Connections of the PCD8544 LCD Driver (Source: [8] ) .......................................................... 10

Table 3 - Results of the Temperature Logger with sample time of 60s ................................................ 24

Table 4 - Results of the temperature logger with sample time of 10s ................................................. 28

Page 4: Embedded Systems Report

1

Introduction

An embedded system is a computer system that is designed to perform only a specific task

using real-time parameters [1]. The system usually consists of a digital processing device or devices,

and mechanical and/or electrical input and output devices. The concept can be seen in Fig.1 below:

Figure 1 - The basic structure of an embedded system

An example of a typical, simple, embedded system is a programmable washing machine. The main

distinction between an embedded system and a general purpose computer system is the number of

tasks they are designed to perform. A general purpose computer system can perform several tasks,

for example a personal computer can browse the internet, do word processing, and play games;

however the embedded system is designed to perform only a single task – a programmable washing

machine does not need to stream online videos! The ‘brain’ of the embedded system is its digital

processing device. This device performs the processing/control operations for the system.

Depending on the application of the embedded system, this device can be a general purpose

microcontroller or a digital signal processor. Specifically, the digital signal processor is used for

embedded systems that deal with the processing of digital signals such as mixing of audio or video

signals, data encryption and decryption, data compression and decompression, and sound synthesis.

General purpose microcontrollers, on the other hand, are used for embedded systems that are not

based on the processing of digital signals, such as the one designed in this project.

Microcontrollers

To understand what a microcontroller is, we must first understand what a microcomputer is.

A microcomputer is essentially a computing device that has a central processing unit (CPU), memory,

input, output and peripheral devices each connected to each other by a series of data lines called

buses [2] as shown in the figure below:

Page 5: Embedded Systems Report

2

Figure 2 - The structure of a basic microcomputer (Source: [2] )

An example of such a system is the typical personal computer (PC) which has the following

components:

CPU – microprocessor

Memory – Random Access Memory (RAM), Read-Only Memory (ROM), Hard-Drives

Input/Output/Peripherals – Keyboard, Mouse, Webcam, Display, USB ports and devices, etc.

The CPU of a microcomputer system is usually a microprocessor. The basic microprocessor consists

of an Arithmetic and Logic Unit (ALU), a Control Unit, and Registers. The function of the

microprocessor is to execute the commands that are stored in the memory of the microcomputer,

the order in which these commands are executed is dictated by the CU and any calculations, logical

or arithmetic, is done by the ALU. The registers are used to store data or instructions for faster

retrieval than that offered by the memory. The basic structure of a microprocessor is shown in Fig.3.

Figure 3 - The structure of a basic microprocessor (Source: [3] )

A microcontroller is essentially a single integrated circuit that incorporates all the features of a

microcomputer in a low cost, low power, small scale chip. Even though the basic structure of the

microcontroller is similar to that of the microcomputer, the former is not designed to replicate the

range of functionality of the latter – the microcontroller is designed to be configured to execute the

single task of an embedded system. The structure of a basic microcontroller can be seen in Fig.4.

Page 6: Embedded Systems Report

3

Figure 4 - The structure of a basic microcontroller (Source: [2] )

As can be see, the microcontroller has a CPU that executes its programmes and perform its logical

and arithmetic operations. There are usually several registers in the CPU some for general use and

some that have specific uses called special purpose registers, for example [1]:

The status register – used to store information on the different characteristics of operations

carried out by the ALU.

The programme counter – contains the address of the next instruction to be executed by

the CPU

The instruction register – stores the instruction that is currently being executed by the CPU

The CPU uses an oscillator, normal a quartz crystal, to generate a clock signal that is used to keep the

internal operations of the CPU in sync. The memory of a microcontroller usually consists of RAM,

ROM and in most recent cases FLASH memory. The input and output peripherals attached to a

microcontroller are usually Timers, Interrupt controllers, Parallel I/O, Serial I/O and Analogue I/O.

The watchdog is a counter that continuously increments (or decrements) unless it is reset by a

programme or rolls over on its own. When a programme runs it should complete before the

watchdog rolls over, if it does it resets the watchdog when it is done, however, if it doesn’t it then it

means the program has hanged and when the watchdog rolls over the microcontroller is reset and

the programme is restarted. Thus, the watchdog ensures that the programme is executed correctly

by restarting the microcontroller if the programme does not execute correctly – much like a user

rebooting a PC when it freezes [4].

The Temperature Logger Project

This project uses the mbed NXP LPC1768 microcontroller development board and the Texas

Instruments TMP102 temperature sensor to create an embedded system that can:

1. Measure and display the current temperature, and the date and time

2. Upon instruction from user, store the measured temperature, date and time to a .csv file

3. Upon instruction from user, display the temperature measured as a graph

4. Allow the user to adjust the time between temperature reads

5. Allow the user to delete the log file stored in the FLASH memory of the microcontroller

6. Provide an easy to use menu interface that allows user input.

A system such as this can be used for a wide array of applications such as thermostats, industrial

temperature loggers, cold storage temperature monitors, and other applications that use the

monitoring and logging of temperature.

Page 7: Embedded Systems Report

4

Hardware Description

The Temperature Logger Project was built on a PCB. The finally assembly is shown below:

Figure 5 - Completely assembled Temperature Logger Project

The circuit configuration for the Temperature Logger Project can be seen in Fig. 6 below:

Figure 6 - The circuit diagram for the Temperature Logger Project

Page 8: Embedded Systems Report

5

As can be seen, the project uses the mbed NXP LPC1768 microcontroller development board, the

Nokia 5110 liquid crystal display (LCD), the Texas Instruments TMP102 temperature sensor

integrated circuit (IC), two switches and two buttons. A block diagram of the project is given in Fig.

7.

Figure 7 - Block diagram of the Temperature Logger Project

The mbed NXP LPC1768

The project uses the mbed NXP LPC1768 microcontroller board, which is shown in Fig.8.

Figure 8 - The mbed NXP LPC1768 microcontroller

The mbed NXP LPC1768 microcontroller development board uses a 100MHz ARM Cortex-M3

processor with 64kB of Static Random Access Memory (SRAM) and 512kB of Flash memory [5]. A list

of its peripherals are given in Table 1 [5]:

Page 9: Embedded Systems Report

6

Serial Peripherals Analogue Peripherals Other Peripherals

10/100 Ethernet Media Access Controller (MAC)

12-bit Analogue to Digital Converter (8 channels)

Real Time Clock (RTC)

USB 2.0 10-bit Digital to Analogue Converter General Purpose Direct Memory Access (DMA) controller (8 channels)

Four universal asynchronous receivers/transmitters (UARTs)

26 GIPOs

Two Controller Area Network (CAN) 2.0B Controllers

Motor Control PWM and Quadrature Encoder Interface (Supports 3-phase motors)

Three Synchronous Serial Port/Synchronous Peripheral Interface (SSP/SPI) Controllers

Four 32-bit general-purpose timer/counters

Three I2C bus interfaces

Inter-Interface Sound (I2S) interface

Table 1 - List of peripherals of the mbed NXP LPC1768 microcontroller (Source: [5] )

The block diagram of this microcontroller is shown below:

Figure 9 - Block diagram of the mbed NXP LPX1768 microcontroller (Source: [5] )

As can be seen the Microprocessor, Core, SRAM Controller, FLASH accelerator, Ethernet MAC, USB

and General Purpose DMA are all connected to ARM’s multi-layer Advanced High Performance Bus

(AHB) matrix and the other peripherals are connected to an Advanced Peripheral Bus.

As can be seen in Fig.7, the Temperature Logger project uses the I2C peripheral for

communication with the TMP102 IC and the SPI peripheral for communication with the Nokia 5110

LCD. The Nokia 5110 LCD also uses the PWM peripheral to control the brightness level of the LCD

Page 10: Embedded Systems Report

7

backlight and the GPIO peripherals for the VCC (power on the LCD), SCE, RST and D/C inputs. Also,

because the project requires data and time functionality, a backup battery is connected to the

microcontroller (pin 3) to ensure that the RTC does not lose power. The controller is powered by a

battery pack connected to pins 2 (VIN) and 1 (GND).

The TMP102 Temperature Sensor IC

The TMP102 temperature sensor IC used in the project is shown below:

Figure 10 - The TMP102 temperature sensor IC

Its block diagram is given by Figure 11.

Figure 11 - Block diagram of the TMP102 IC (Source: [6])

The TMP102 uses a diode temperature sensor to measure the temperature. The analogue output of

the temperature sensor is then converted to digital format by the on-board ADC and stored in the

temperature register of the IC. This value can be 12-bit or 13-bit depending on whether the IC is

configured in regular mode or extended mode respectively [6]. The IC is designed with maximum

absolute operating temperatures of -55°C to 150°C and a recommended operating range of -40°C to

125°C [6]. The TMP102 can be configured with fixed sample frequencies of 0.25Hz, 1Hz, 4Hz

(default) and 8Hz or it can be configured to take a temperature sample when instructed and then go

Page 11: Embedded Systems Report

8

to a low power state called shutdown mode, this is called taking a one-shot reading [6]. These

instructions are provided by a master device using I2C communication via the serial interface of the

IC.

For the project, the TMP102 is connected to the mbed microcontroller to facilitate I2C

operation with the TMP102 being a slave and the microcontroller being the master. As such, the SCL

pin of the TMP102 is connected to a SCL pin of the microcontroller (pin 27) and the SDA pin of the

TMP102 is connected to the corresponding SDA pin of the microcontroller (pin 28). This I2C interface

is used to configure the TMP102 to measure the temperature when instructed by the mbed

microcontroller (one shot mode) to then return to its shut down state. This temperature sample is

stored in the register as a 12-bit value because the TMP102 is configured in normal operating mode

as well. The TMP102 is powered using the regulated 3.3v output of the microcontroller (pin 40) and

the same GND (pin 1).

The Nokia 5110 LCD

The Nokia 5110 LCD, shown in Fig. 12, is a 48x84 matrix LCD controlled by the Phillips

PCD8544 driver [7].

Figure 12 - Nokia 5110 LCD

The matrix LCD and the drive IC come in a single integrated package, as shown above, with pinout

shown in Fig.13 below.

Page 12: Embedded Systems Report

9

Figure 13 - The pinout of the Nokia 5110 LCD Assembly (Source: [7])

The block diagram of the LCD driver is show in Fig. 14 below:

Figure 14 - Block diagram of the PCD8544 LCD driver (Source: [8] )

The following table explains the pin connections of the driver [8]:

Pin Connections

R0 to R47 LCD row driver outputs, connected to LCD

C0 to C83 LCD column driver outputs, connected to LCD

VSS1, VSS2 Ground, connected to GND pin of LCD Assembly (pin 2)

VDD1, VDD2 Supply voltage, connected to VCC pin of LCD Assembly (pin 1)

VLCD1, VLCD2 LCD supply voltage – powers the LCD backlight, connected to VLED pin of the LCD Assembly (pin 8)

T1 test 1 input

Not connected T2 test 2 output

T3 test 3 input/output

Page 13: Embedded Systems Report

10

T4 test 4 input

SDIN Serial data input, connected to MOSI pin of LCD Assembly (pin 6)

SCLK Serial clock input, connected to SCLK pin of LCD (pin 7)

D/C Data/Command connected to D/C pin of LCD Assembly (pin 5)

SCE Chip enable, connected to SCE pin of LCD Assembly (pin 4)

OSC Oscillator, connected to VDD

RES External reset input , connected to RST pin of LCD Assembly (pin 3) Table 2 - Connections of the PCD8544 LCD Driver (Source: [8] )

The LCD driver receives the data being sent though the SPI data link, and uses the D/C state to

determine if the data is a command or data to be displayed. If it is a command, the driver processes

the command, if it is data to be displayed then the data is stored in the buffer (DDRAM) and then

used to turn on or off the necessary dots on the display. The relationship between the data stored

in the buffer and the LCD is shown below:

Figure 15 - Mapping of the DDRAM to the LCD for the PCD8544 LCD Driver

The LCD Assembly is connected to one of the SPI peripherals of the microcontroller for the

project via its MOSI pin (pin 6) and its SCLK pin (pin 7). These are connected to pins 11 and 13 of the

microcontroller respectively. The LCD Assembly’s VLED pin is connected to one of the PWM pins of

the microcontroller (pin 21), this is done to use the PWM output to control the brightness of the LED

backlights of the LCD using the duty cycle of the PWM. The GND pin is connected to the same GND

as the microcontroller. The other pins of the LCD assembly are connected to GPIO pins of the

microcontroller, VCC to pin 7, SCE to pin 8, RST to pin 9 and D/C to pin 10. This allows the LCD to be

turned on or off or be reset the microcontroller, and to tell the LCD assembly that serial

communication will take place (SCE) and whether the data sent is a command or data to be

displayed (D/C).

Page 14: Embedded Systems Report

11

The Switches and Push Buttons

The Temperature Logger Project uses two switches and two buttons, as shown in Fig, 16.

Figure 16 - Buttons and switches used in the project

The power switch is placed between the battery supply and the Vin pin of the microcontroller to turn

the controller on or off. The second switch, labelled SW, is connected to pin 18 of the

microcontroller (GPIO) as an input. This switch toggles between the 3.3v regulated output of the

microcontroller (logical high) and ground (logical low). Buttons A and B are connected to pins 16 and

17 (GPIO) of the microcontroller respectively, also as inputs. These two pins are configured as pull

up pins, as such their normal state is high, and when the buttons are pressed they drive the pins to a

logical low.

Page 15: Embedded Systems Report

12

Software Description

The User Interface

Using the Nokia 5110 LCD assembly, the software around a simple user interface that

consists of several screens that are displayed at the appropriate time. These screens are:

1. The Welcome Screen

2. Default Screen 1

3. Default Screen 2

4. The Temperature Plot Screen

5. Menu Screen 1,2,3 and 4

6. The Sub-menu Screens:

a. The Adjust Brightness Screen

b. The Adjust Sample Time Screen

c. The Erase File Screen and its sub-screens:

i. Error Screen 1

ii. Message Screen 1

iii. Message Screen 2

The welcome screen, shown in Fig.17, is loaded when the Temperature Logger is first turned on.

Figure 17 - The Welcome Screen

The Default Screen 1 displays the Date, Time and Temperature, while Default Screen 2 displays the

same information plus indicates that the temperature is being logged to a .csv file, they are shown in

Fig. 18 below:

Figure 18 - Default Screens 1 and 2

When the menu is displayed, scrolling though moves you though Menu Screens 1 to 4, which are

shown below:

Page 16: Embedded Systems Report

13

Figure 19 - Menu Screens 1 to 4

If one of the options on the menu screen are selected one of the sub-menu screen are displayed.

These are shown in Figures 20 to 22.

Figure 20 - The Adjust Brightness Screen

Figure 21 - The Adjust Sample Time Screen

Figure 22 - The Erase File Screen and its sub-screens

If the Exit option is selected, then the default screen is displayed. If the user selects the option of

plot the temperature in real time, then the Temperature Plot Screen, shown in Fig. 23, is displayed.

Figure 23 - The Temperature Plot Screen

Page 17: Embedded Systems Report

14

Software Structure

The entire programme is broken up into several functions, based on different operations.

These are:

1. The Main Function – this allows the user to navigate through the screens, and displays the

appropriate screen and allows the user to adjust the brightness or temperature sample time.

2. The TMP102 Initialization Function – this initializes the TMP102 temperature IC, in Shut

Down mode, which enables it to read the temperature only when instructed to by the

microcontroller.

3. The Get Temperature Function – this performs a temperature conversion to get the

temperature, and if File Writing is enabled calls the Write to File Function to log the date,

time and temperature in .csv format. This function is attached to a timer that calls it, via

interrupt, depending on the value of the sample time.

4. The Write To File Function – this writes the data described in 3 to a .csv file.

5. The LCD Update Function – this enables the LCD to be updated every second, to update the

time, if the Logger is on the Default Screen (1 or 2).

6. The Get Time Function – the gets the current date and time from the RTC and formats it.

7. The Display Error Function – this function displays an error code by blinking the LEDs a fixed

number of times based on where the error occurs, this function is an extended version of

the function given to the student by Dr Craig Evans in the lab sessions. The function displays

an error if there were read or write errors between the microcontroller and the TMP102.

8. The Write to Configuration File Function – this function stores the user’s settings in a binary

file.

9. The LCD Display Function – this function updates the LCD based on which screen needs to be

displayed. It evaluates a switch case to determine the appropriate screen to display, and

then configures the LCD accordingly.

Each of these functions are described by their flowcharts in the figures that follow. The code for the

entire programme can be found in Appendix 1.

Page 18: Embedded Systems Report

1

Figure 24 - Part 1 of the Main Function Flowchart

Page 19: Embedded Systems Report

1

Figure 25 - Part 2 of the Main Function Flowchart

Page 20: Embedded Systems Report

1

Figure 26 - The Get Temperature Function flowchart

Page 21: Embedded Systems Report

1

Figure 27 - The Write to File Function flowchart

Figure 28 - The LCD Update Function flowchart

Page 22: Embedded Systems Report

2

Figure 29 - The Get Time Function flowchart

Figure 30 - The Display Error Function flowchart

Page 23: Embedded Systems Report

3

Figure 31 - The Write to Configuration File Function flowchart

Page 24: Embedded Systems Report

4

Figure 32 - The LCD Display Function flowchart

Page 25: Embedded Systems Report

5

Results and Testing

After the software was compiled and copied to the mbed microcontroller, the user interface

was tested. The Welcome Screen loaded correctly, as shown in Fig. 33.

Figure 33 - The Welcome Screen displayed on the LCD

After the Welcome Screen loaded, the Default Screen was shown, with the Temperature and Time

updating accordingly. This is shown below:

Figure 34 - Default Screen 1 displayed on the LCD

If the Temperature Logging was turned on through switch SW, the default screen changed and

indicated that file writing is taking place. This can be seen in Fig. 34.

Page 26: Embedded Systems Report

6

Figure 35 - Default Screen 2 displayed on the LCD

The Menu was displayed correctly and navigation was done in accordance to the software, two of

the Menu screens are shown in Figures 36 and 37 respectively.

Figure 36 Menu Screen 1 displayed on the LCD

Page 27: Embedded Systems Report

7

Figure 37 - Menu Screen 3 displayed on the LCD

The sub-menus were also displayed corrected and allowed the user to adjust the brightness (Fig. 38)

and adjust the sample time (Fig. 39).

Figure 38 - The Adjust Brightness Screen displayed on the LCD

Page 28: Embedded Systems Report

8

Figure 39 - The Adjust Sample Time Screen displayed on the LCD

The file deletion function also worked as expected. The sub-menu screen was displayed (Fig. 39),

and if the file existed and writing was not being done it was deleted (Fig. 40). If the file did not exist,

then it couldn’t be deleted (Fig. 41) and if the file writing was on, the error screen was displayed

(Fig.42).

Figure 40 - The Delete File Screen displayed on the LCD

Page 29: Embedded Systems Report

9

Figure 41 - Message Screen 1 displayed on the LCD

Figure 42 - Message Screen 2 displayed on the LCD

Page 30: Embedded Systems Report

10

Figure 43 - Error Screen 1 displayed on the LCD

Also, if the user choses the temperature plot option the temperature is plotted on the LCD. This can

be seen below:

Figure 44 - The graph of the temperature displayed on the LCD

The data logging function was tested using a sample time of 60s, a graph of the results can be seen

in Fig. 44. A table of the results are in Appendix 2.

Page 31: Embedded Systems Report

11

Figure 45 - A graph of the results obtained with a sample time of 60s

The sample time was adjusted to 10 seconds, and the device was placed in a much colder location to

test if it can read a negative temperature. A graph of the results are shown in Fig. 46 below, and a

table of the results can be found Appendix 2.

21.36

21.38

21.4

21.42

21.44

21.46

21.48

21.5

21.52

16:55:12 17:02:24 17:09:36 17:16:48 17:24:00 17:31:12 17:38:24

Tem

oer

atu

re

Time

Page 32: Embedded Systems Report

12

Figure 46 - A graph of the results with sample time of 10s

-4

-2

0

2

4

6

8

10

12

15:53:17 15:56:10 15:59:02 16:01:55 16:04:48 16:07:41 16:10:34

Tem

per

atu

re

Time

Page 33: Embedded Systems Report

13

Conclusion

The temperature logger project provides an easy to use interface, which is navigated

through using the two buttons on the project. It displays the date, time and temperature on the

LCD. The temperature is sampled at an interval that can be set by the user, with a default sample

time of sixty seconds. The user can also choose to have a real time graph of the temperature

displayed on the LCD, though the options in the user interface. The brightness of the LCD can also

be adjusted from its default value of 50%, this and the sample time are stored in a binary file in the

FLASH memory of the microcontroller to ensure that the user settings are saved if the

microcontroller is turned off. The project can log the temperature, date and time by writing that

information to a comma separated value (csv) file stored in the FLASH memory of the

microcontroller, this logging can be controlled by the user though the switch SW. The user also has

the option of deleting this file from the FLASH memory of the microcontroller. With these features,

the project successfully met all the aims set out in the Introduction.

The project has scope of expansion. The TMP102 has the ability to trigger an alarm if a

maximum or minimum temperature is passed [6]. This feature allows the TMP102 to function as a

thermostat, which can be used to regulate the temperature that is being measured. This can done

by using the microcontroller to turn on a cooling device, such as a fan, if needed. Also the user

interface can be improved, but the number of input devices such as buttons needs to be increased

and a larger LCD display would lead to more space for the information displayed by the interface.

One of the main drawbacks of the project is the dependence on the RTC to be configured manually.

The two buttons make it hard to set the current time just using the inputs currently configured, thus

the only way to set the RTC is by serial interface with a PC.

Page 34: Embedded Systems Report

14

References

[1] M. P. .. Canton, Embedded Systems Circuits and Programming, CRC Press, 2012.

[2] F. E. Valdez-Perez and R. Pallas-Areny, Microcontrollers - Fundamentals and Applications with

PIC, CRC Press, 2009.

[3] M. Eastaugh, “Microprocessor Tutorial,” 2004. [Online]. Available:

http://www.eastaughs.fsnet.co.uk/cpu/structure-index.htm. [Accessed 1 December 2015].

[4] M. Barr, “Introduction to Watchdog Timers,” 1 October 2001. [Online]. Available:

http://www.embedded.com/electronics-blogs/beginner-s-corner/4023849/Introduction-to-

Watchdog-Timers. [Accessed 1 December 2015].

[5] NXP B.V, “mbed NXP LPC1768 prototyping board (flyer),” ARM mbed (R), Neatherlands, 2009.

[6] Texas Instruments Incorporated, TMP102 Low-Power Digital Temperature Sensor With SMBus

and Two-Wire Serial Interface in SOT563 (datasheet), Dallas, 2015.

[7] Sparkfun Electronics Inc., “Graphic LCD 84x48 - Nokia 5110 - LCD-10168 - SparkFun Electronics,”

[Online]. Available: https://www.sparkfun.com/products/10168. [Accessed 1 December 2015].

[8] Phillips Semiconductors Inc., PCD8544 Datasheet, 1999.

Page 35: Embedded Systems Report

15

Appendix 1

Page 36: Embedded Systems Report

16

Page 37: Embedded Systems Report

17

Page 38: Embedded Systems Report

18

Page 39: Embedded Systems Report

19

Page 40: Embedded Systems Report

20

Page 41: Embedded Systems Report

21

Page 42: Embedded Systems Report

22

Page 43: Embedded Systems Report

23

Page 44: Embedded Systems Report

24

Appendix 2 Date Time Temperature

12/15/15 17:00:07 21.44

12/15/15 17:01:07 21.44

12/15/15 17:02:07 21.44

12/15/15 17:03:07 21.38

12/15/15 17:04:07 21.38

12/15/15 17:05:07 21.38

12/15/15 17:06:07 21.38

12/15/15 17:07:07 21.38

12/15/15 17:08:07 21.38

12/15/15 17:09:07 21.38

12/15/15 17:10:07 21.38

12/15/15 17:11:07 21.38

12/15/15 17:12:07 21.38

12/15/15 17:13:07 21.38

12/15/15 17:14:07 21.38

12/15/15 17:15:07 21.38

12/15/15 17:16:07 21.44

12/15/15 17:17:07 21.44

12/15/15 17:18:07 21.44

12/15/15 17:19:07 21.44

12/15/15 17:20:07 21.38

12/15/15 17:21:07 21.44

12/15/15 17:22:07 21.44

12/15/15 17:23:07 21.5

12/15/15 17:24:07 21.5

12/15/15 17:25:07 21.5

12/15/15 17:26:07 21.5

12/15/15 17:27:07 21.5

12/15/15 17:28:07 21.5

12/15/15 17:29:07 21.5

12/15/15 17:30:07 21.5 Table 3 - Results of the Temperature Logger with sample time of 60s

Page 45: Embedded Systems Report

25

Date Time Temperature

12/15/15 15:55:02 10.25

12/15/15 15:55:07 9.94

12/15/15 15:55:12 9.62

12/15/15 15:55:17 9.5

12/15/15 15:55:22 9.25

12/15/15 15:55:27 8.94

12/15/15 15:55:32 8.81

12/15/15 15:55:37 8.56

12/15/15 15:55:42 8.38

12/15/15 15:55:47 8.19

12/15/15 15:55:52 8.06

12/15/15 15:55:57 7.81

12/15/15 15:56:02 7.69

12/15/15 15:56:07 7.44

12/15/15 15:56:12 7.19

12/15/15 15:56:17 7.06

12/15/15 15:56:22 6.88

12/15/15 15:56:27 6.75

12/15/15 15:56:32 6.56

12/15/15 15:56:37 6.44

12/15/15 15:56:42 6.38

12/15/15 15:56:47 6.19

12/15/15 15:56:52 6.12

12/15/15 15:56:57 6

12/15/15 15:57:02 5.88

12/15/15 15:57:07 5.75

12/15/15 15:57:12 5.5

12/15/15 15:57:17 5.5

12/15/15 15:57:22 5.38

12/15/15 15:57:27 5.19

12/15/15 15:57:32 5.06

12/15/15 15:57:37 4.94

12/15/15 15:57:42 4.81

12/15/15 15:57:47 4.69

12/15/15 15:57:52 4.44

12/15/15 15:57:57 4.44

12/15/15 15:58:02 4.38

12/15/15 15:58:07 4.25

12/15/15 15:58:12 4.12

12/15/15 15:58:17 3.94

12/15/15 15:58:22 3.81

12/15/15 15:58:27 3.69

12/15/15 15:58:32 3.69

12/15/15 15:58:37 3.62

12/15/15 15:58:42 3.5

Page 46: Embedded Systems Report

26

12/15/15 15:58:47 3.31

12/15/15 15:58:52 3.31

12/15/15 15:58:57 3.19

12/15/15 15:59:02 3.06

12/15/15 15:59:07 2.94

12/15/15 15:59:12 2.88

12/15/15 15:59:17 2.81

12/15/15 15:59:22 2.75

12/15/15 15:59:27 2.62

12/15/15 15:59:32 2.56

12/15/15 15:59:37 2.5

12/15/15 15:59:42 2.38

12/15/15 15:59:47 2.31

12/15/15 15:59:52 2.25

12/15/15 15:59:57 2.19

12/15/15 16:00:02 2.12

12/15/15 16:00:07 2.12

12/15/15 16:00:12 2.06

12/15/15 16:00:22 1.88

12/15/15 16:00:27 1.88

12/15/15 16:00:32 1.81

12/15/15 16:00:37 1.69

12/15/15 16:00:42 1.62

12/15/15 16:00:47 1.56

12/15/15 16:00:52 1.5

12/15/15 16:00:57 1.44

12/15/15 16:01:02 1.38

12/15/15 16:01:07 1.25

12/15/15 16:01:12 1.12

12/15/15 16:01:17 1.12

12/15/15 16:01:22 1.06

12/15/15 16:01:27 1.06

12/15/15 16:01:32 0.94

12/15/15 16:01:37 0.88

12/15/15 16:01:42 0.88

12/15/15 16:01:47 0.81

12/15/15 16:01:52 0.81

12/15/15 16:01:57 0.75

12/15/15 16:02:02 0.62

12/15/15 16:02:07 0.62

12/15/15 16:02:12 0.5

12/15/15 16:02:17 0.44

12/15/15 16:02:22 0.38

12/15/15 16:02:27 0.38

12/15/15 16:02:32 0.31

12/15/15 16:02:37 0.31

Page 47: Embedded Systems Report

27

12/15/15 16:02:42 0.25

12/15/15 16:02:47 0.19

12/15/15 16:02:52 0.12

12/15/15 16:02:57 0.12

12/15/15 16:03:02 0.06

12/15/15 16:03:07 0

12/15/15 16:03:12 -0.06

12/15/15 16:03:17 -0.06

12/15/15 16:03:22 -0.12

12/15/15 16:03:27 -0.12

12/15/15 16:03:32 -0.19

12/15/15 16:03:37 -0.25

12/15/15 16:03:42 -0.31

12/15/15 16:03:47 -0.38

12/15/15 16:03:52 -0.44

12/15/15 16:03:57 -0.5

12/15/15 16:04:02 -0.56

12/15/15 16:04:07 -0.62

12/15/15 16:04:12 -0.69

12/15/15 16:04:17 -0.75

12/15/15 16:04:22 -0.75

12/15/15 16:04:27 -0.81

12/15/15 16:04:32 -0.81

12/15/15 16:04:37 -0.88

12/15/15 16:04:42 -0.88

12/15/15 16:04:47 -0.94

12/15/15 16:04:52 -0.94

12/15/15 16:04:57 -0.94

12/15/15 16:05:02 -1

12/15/15 16:05:07 -1

12/15/15 16:05:12 -1

12/15/15 16:05:17 -1.06

12/15/15 16:05:22 -1.12

12/15/15 16:05:27 -1.12

12/15/15 16:05:32 -1.19

12/15/15 16:05:37 -1.19

12/15/15 16:05:42 -1.25

12/15/15 16:05:47 -1.25

12/15/15 16:05:52 -1.31

12/15/15 16:05:57 -1.38

12/15/15 16:06:02 -1.38

12/15/15 16:06:07 -1.44

12/15/15 16:06:12 -1.44

12/15/15 16:06:17 -1.44

12/15/15 16:06:22 -1.44

12/15/15 16:06:27 -1.44

Page 48: Embedded Systems Report

28

12/15/15 16:06:32 -1.56

12/15/15 16:06:37 0.5

12/15/15 16:06:42 2.5

12/15/15 16:06:47 3.62

12/15/15 16:06:52 4.5

12/15/15 16:06:57 4.94

12/15/15 16:07:02 5.44

12/15/15 16:07:07 5.94

12/15/15 16:07:12 6.38

12/15/15 16:07:17 6.75

12/15/15 16:07:22 7.12

12/15/15 16:07:27 7.44

12/15/15 16:07:32 7.75

12/15/15 16:07:37 8.25

12/15/15 16:07:42 8.5

12/15/15 16:07:47 8.81

12/15/15 16:07:52 9.06

12/15/15 16:07:57 9.38

12/15/15 16:08:02 9.62

12/15/15 16:08:07 9.81

12/15/15 16:08:12 9.94

12/15/15 16:08:17 10.06

12/15/15 16:08:22 10.25

12/15/15 16:08:27 10.44

12/15/15 16:08:32 10.5

12/15/15 16:08:37 10.62 Table 4 - Results of the temperature logger with sample time of 10s