You are on page 1of 9

Basic Smart-watch Multimedia Device

EE8205 Embedded Computer Systems

Mohammed N. Ahmed - 500191879


Electrical and Computer Engineering
Ryerson University
Toronto, Canada

Abstracta smart-watch style multimedia device is designed in


this presented project. A simple game, weather app and image
gallery are implemented. The use of several hardware peripherals
and software features are described in the design of the device.
Final results and discussions are presented at the end.

I. INTRODUCTION
Todays smart devices industry is expanding rapidly.
Initially, the smartphone was the device that initiated the
effort to make everyday devices smarter by integrating
microcontroller electronics, user interactivity and internet
connectivity. A new effort in the industry is to create a smart
watch, expanding greatly on the traditional wrist watch that
did little more than tell time. Smart watches include fitness
tracking, text and call capability, emails, navigation, and
internet enabled services. A basic smart-watch style device
would include simple implementations of such a system.
In this project, a basic smart-watch type embedded
device is designed with basic multimedia and interactive
features. A Cortex M4 SoC is used to interface with many
peripherals to realize the feature list. The multimedia device
had a few basic apps including a basic version of a classic
video game Space Invaders, and a weather monitoring
application is also implemented that displays basic ambient
weather information. These programs are selectable to run
on the device screen by the user. The device has been
designed to be expandable in terms of its functionality to
include an image gallery, compass, and possibly other
applications.
The hardware components used is the Texas
Instruments TM4C123GXL development board with a
Cortex M4F SoC, a Sensor hub add-on also by Texas
Instruments, a 1.8 Adafruit LCD screen, and a generic slidepotentiometer.

The interface for selecting an app will be a pushbutton on the


device. In a more complex project, a touchscreen could be
implemented where the user interacts with the entire device on
the touch panel with a graphical user interface.
The design features and user interfaces are discussed here:

1.

This game consists of a single user-controlled gun ship


that can fire missiles or laser beams at aliens. The
aliens move across the top of the screen in a time of
about 10 seconds where the player has to score as
many points as possible. There is one obstacle on
screen that the user has to fire around. At the end of
the game the score information is displayed. If the
player scores more than 10 points, the player wins the
game, but if less than 10 points are scored, the aliens
win the game.
The user interface for this game includes a slidepotentiometer to control the left-right movement of the
gun ship across the screen. To fire the laser or missile,
one of two pushbutton switches are to be pressed.
2.

Ambient Weather App:


In this app the temperature, pressure, altitude and
humidity are displayed. The ambient weather app
shows ambient temperature and the temperature of any
object up to 10cm away from the temperature sensor
in degrees Celsius. Also, atmospheric pressure is
displayed in mbar along with altitude in masl (meters
above sea level). Lastly, the ambient humidity is
displayed in percentage.

II. OBJECTIVES AND FEATURES


On start-up of the device, a menu will be displayed on the LCD
that shows the apps available on the device. The user may select
the app to start using it. The device will be designed to include
a few basic apps. The video game app will be a simple
implementation of the popular game Space Invaders, and a
weather monitoring app. Therell also be a simple image
gallery.

Space Invaders Game:

3.

Image Gallery:
The simple image gallery displayed saved images
from system memory. These images can be scrolled
through using the pushbuttons. Left scrolling by left
pushbutton and right scroll by right pushbutton. This

app can be expanded to display images from a memory


card or SD card interface.
III. DESIGN METHOD: FUNCTIONS & PERIPHERALS
There are many peripherals available on the Cortex
M4 SoC that are usable by the developer. In this project,
many on-board peripherals were utilized that make this
project possible. For the Space invaders game engine, a
Systick based timer is used to generate an interrupt that runs
the game engine routine every 33.3 ms; the game engine runs
at 30 Hz.

read by SysTick interrupt at 30Hz to process movement. The


user slides the pot left or right to control movement of the
gunship on screen, and fires missiles or lasers using one of
two buttons on the device, which are interfaced through
GPIO. We see the game engine control flow graph in Figure
2.
The Ambient Weather app uses a special add-on
sensor board to the Cortex M4 development board that
contains sensors such as temperature, barometric pressure,
humidity and accelerometer. Also sensors on the add-on
board are interfaced using an I2C interface to the Cortex M4
board. Some of the sensors are polled using a SysTick
interrupt while other sensors are digital output that is read
using a hardware-triggered interrupt to the microcontroller.
The readout is refreshed every 1s. The temperature, pressure
and humidity information is obtained in float format, which
is then converted to a signed integer and decimal number
before output to LCD. Also, altitude is calculated as a
function of atmospheric pressure. The low-level drivers for
each sensor are provided by the vendor and are used in the
main program for initialization and reading data. Figure 3
shows the connection interface to Cortex M4 using I2C
interface.

Fig. 1. Game Engine software routine call graph


The interrupt routine handles the movement of the
player gunship, the aliens and the fired missiles or laser
beam. The function to write to the LCD screen takes place in
the main foreground routine as it is a much more timeconsuming task than running the game engine in the SysTick
interrupt handler routine.

Fig. 3. Sensor board interface scheme.


Fig. 2. Game Engine control flow graph.
Also, the LCD screen is interfaced with the
microcontroller using an SSI module for data
communication. The LCD peripheral is run through a driver
provided by the vendor. The movement of the player gunship
is controlled through a slide-potentiometer interfaced
through ADC. The ADC peripheral on board the M4 SoC is

Finally, the simple image gallery displays images


saved in the system ROM. The images are saved in bmp
format where each pixel is represented by a hexadecimal
number. The user navigates the images using left and right
pushbuttons on the device. The image gallery app can be
expanded to read images saved on an external memory card.
This memory card such as a micro SD card can be interfaced

to the microcontroller through an SPI interface for high speed


communication.
IV. DESIGN METHOD: SOFTWARE/FIRMWARE DESIGN
The software design of the game and weather application as
well as the firmware design for the use of hardware modules
such as GPIO ports, SystTick timer interrupts, and I2C
interfaces are custom designed for this project. Vendor
provided driver code is utilized for the sensor add-on board and
the LCD board. These drivers provide application level access
to low-level functions that drive the vendor hardware such as
initialization routines, setup, and reading or writing data from
the add-on device.
In this section, some basic code structure is provided that
describes the functionality of the Space Invaders game, the
complete code is 2000 lines of code not including peripheral
drivers! The code structure of the Ambient Weather app follows
after.
A. Space Invaders game:
#include <stdio.h>
#include <stdint.h>
#include // includes here for LCD andother peripherals
// this section contains global variable declarations
// and function declarations
void EnableInterrupts(void); // Enable interrupts
void Delay10ms(unsigned long count); // time delay in 0.1 seconds
unsigned long TimerCount;
unsigned long buttonMissile;
unsigned long buttonLaser;
// ************Ports Initializations Section***************
// Port F buttons and LEDs onboard: PF4, PF0 input, PF3 ouput LED
// (moved to port F) Port E for Inputs: Slide Pot: PE2 (Ain1), Buttons:
PE0, PE1
// (moved to port F) Port B for Outputs: LEDs: PB4, PB5 4-bit DAC:
PB3-0
// LCD outputs not defined here.
void PortFInit(void){
// PortF Initialization sequences
}
void PortEInit(void){
// PortE Initialization sequences
}
void ADC0_Init(void){
//ADC0 periph. initialization sequence
}
//****************SysTick Initialization***************
//Initialize SysTick power inturrepts for reading slit pot
// Initialize SysTick interrupts to trigger at 40 Hz, 25 ms
void SysTick_Init(unsigned long period){
// SysTick initialize to period of 33.33ms
}
void SysTick_Init(unsigned long period){
// SysTick initialize to period of 33.33ms

}
// ********************** Images **********************
const uint16_t Missile0[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF,
0x0000, 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFFFF, 0x0000, 0x0000,
0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0x0000,
0x0000, 0xFFFF, 0x0000,
};
// other images for onscreen instances are described similarly
//
// ************GAME ENGINE INIT AND ROUTINES************
// This sections controls motion of sprite and aliens
// Above defined images will be manipulated here
void EnemyInit(void){
// the enemy character draw generated here
}
void SpriteInit(void){
// the player gunship routines here
}
void fireMissile (){
// missile fire routine here
}
// similar routines for Laser fire
void detectCollision (){
// detect collision between fire and enemy here
}
void SysTick_Handler(void){
//main game engine is run here at every interrupt
// all functions are initialized and called here
}
//**************LCD OUTPUT ROUTINE*****************
// the player gunship, aliens and missles/laser are all drawn using this
routine
// function calls made to the LCD driver include
void Draw(void){
// routines for drawing all characters and images on screen
// routine for moving the characters on screen
}
//******************MAIN ROUTINE********************
int main(void){
// all routines initialized
//peripherals initialized
//SysTick initialized
while(1){
draw(); // the call to draw function here
Flag = 0; // clear Flag for interrupt
// game engine runs in interrupt routine
}
}

In this Space Invaders game application software, the


routines for drawing to the LCD peripheral are described in a
separate c file provided by the vendor, and that is declared in
this program as an include. The functions for string output,
drawing bitmap images and initialization routines are all called
from within the main program. The game engine where the
characters are moved, missiles and lasers fired, and the
collisions are detected, is run in the interrupt handler routine.
This way we have good scheduling of processor time. The
SysTick interrupt occurs every 33.33 ms, which is more than
enough to run the game engine. The draw routines to the LCD
is run the in the main super-loop as it takes longer to execute a
draw to the LCD. We can see from the operation of the game
app that everything runs smoothly, utilizing the processor time
efficiently.
Once the game engine is initialized and is operating as
controlled by the periodic interrupts, the flag is set in the
interrupt routine to draw the entire images and movement
sequence in the main routine. The main routine then resets the
flag. The LCD driver is used to draw the bmp images of aliens,
gun ship, missile, laser and the textual information.
In the following section, the registers set up needed for enabling
and using the ADC peripheral on the SoC is described. There
are several registers that need to be defined for the peripheral to
be operational. Of note, the ADC runs at 125 kHz sampling rate,
which is too fast, so we will only read the ADC using the 30Hz
SysTick interrupt that runs the gam engine.

Steps to configure and initialize the ADC peripheral:


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Enable clock for Port E for ADC input (ADC0 on


port E)
DIR register set to 0 for pin input
AFSEL register enabled for alternate function
(ADC)
DEN register disables as this is analog input
AMSEL register enabled as this is analog input
SYSCTL_RCGC0_R register enabled to enable
port clock
Bit 8 and 9 of SYSCTL_RCGC0_R specify the
max sampling rate of ADC0, which is 125KHz.
Sequencer priority is set.
Disable sequencer to prepare for configuration.
Bit 3 in ADC_ACTSS_R register is set to 0.
Configure trigger event in sample sequencer in
ADC_EMUX_R register.
Configure input source in ADCSSMUX3_R
register for PE4.
Configure
sample
control
in
the
ADC_SSCTL3_R register.
Finally, enable sample sequencer 3 but setting bit
ASEN3 in the ADC_ACTSS_R register.

ADC Initialization, input and conversion are shown and


discussed:
Table 1. The ADC0 registers in the TM4C SoC. These registers
are set in the following code.
Address

3117

0x400F.E100

16

15Oct

ADC
3114

0x4003.8020

13Dec
SS3

31-16

7-0

Name

MAXADCSPD
10Nov

08Sep
SS2

06-Jul

SYSCTL_RCGC0_R
04May
SS1

02-Mar

1-0
SS0

ADC0_SSPRI_R

ADC0_EMUX_R

15-Dec
EM3

08-Nov
EM2

04-Jul
EM1

3-0
EM0

0x4003.8000

ASEN3

ASEN2

ASEN1

ASEN0

0x4003.80A0

MUX0

0x4003.80A4

TS0

IE0

END0

D0

ADC0_SSCTL3_R

0x4003.8028

SS3

SS2

SS1

SS0

ADC0_PSSI_R

0x4003.8004

INR3

INR2

INR1

INR0

ADC0_RIS_R

0x4003.800C

IN3

IN2

IN1

IN0

ADC0_ISC_R

0x4003.8014
Apr-31

31-Dec
0x4003.80A8

11-0
DATA

ADC0_ACTSS_R
ADC0_SSMUX3_R

ADC0_SSFIFO3

//****************ADCInitialize**********************
void ADC0_Init(void){ unsigned long volatile delay;
SYSCTL_RCGC2_R |= 0x00000010;
// 1) activate clock for
Port E
delay = SYSCTL_RCGC2_R;
// allow time for clock
to stabilize
GPIO_PORTE_DIR_R &= ~0x10;
// 2) make PE4 input
GPIO_PORTE_AFSEL_R |= 0x10;
// 3) enable alternate
function on PE4
GPIO_PORTE_DEN_R &= ~0x10; // 4) disable digital I/O
on PE4
GPIO_PORTE_AMSEL_R |= 0x10;
// 5) enable analog
function on PE4
SYSCTL_RCGC0_R |= 0x00010000;
// 6) activate ADC0
delay = SYSCTL_RCGC2_R;
SYSCTL_RCGC0_R &= ~0x00000300; // 7) configure for 125K
ADC0_SSPRI_R = 0x0123;
// 8) Sequencer 3 is
highest priority
ADC0_ACTSS_R &= ~0x0008;
// 9) disable sample
sequencer 3
ADC0_EMUX_R &= ~0xF000;
// 10) seq3 is software
trigger
ADC0_SSMUX3_R &= ~0x000F;
// 11) clear SS3 field
ADC0_SSMUX3_R += 9;
// set channel Ain9 (PE4)
ADC0_SSCTL3_R = 0x0006;
// 12) no TS0 D0, yes IE0
END0
ADC0_ACTSS_R |= 0x0008;
// 13) enable sample sequencer
3
}
//***********************ADC0_In*******************
// Slide-Pot inputs to ADC
// Busy-wait Analog to digital conversion
// Input: none
// Output: 12-bit result of ADC conversion
unsigned long ADC0_In(void){
unsigned long volatile result;
ADC0_PSSI_R = 0x0008;
// 1) initiate SS3
while((ADC0_RIS_R&0x08)==0){}; // 2) wait for conversion done
result = ADC0_SSFIFO3_R&0xFFF; // 3) read result
ADC0_ISC_R = 0x0008;
// 4) acknowledge completion
return result;
}
//******************Convert ADC input*****************
// Convert a 12-bit binary ADC sample into a 32-bit unsigned
// fixed-point distance (resolution 0.001).
// Input: sampled 12-bit ADC sample
// Output: 32-bit distance (resolution 0.001)
unsigned long Convert(unsigned long sample){
unsigned long volatile result;
//shift by 10 (divide by 2^10, multiply by 16 to get 0 to 64
position on screen
result = ((30*sample)>>10);
return result;
}

The process to initialize the SysTick interrupt process


and the interrupt handler routine are described as follows. The
periodic SycTick interrupt is used to run the game engine at
30Hz (every 33.3ms). The entire game engine runs in the
interrupt handler routine, as described before. To enable a
system to perform interrupts, we must firstly arm the device for

interrupt processing, then enable the NVIC peripheral, enable


global interrupts, set interrupt priority, and set the hardware
event interrupt trigger source.
The interrupt trigger source can be the SysTick timer,
or other on board timers. Also, hardware-triggered interrupts
could be employed for interrupts that are not periodic, such as
faults. To make sure the system runs smoothly and that the
processor does not get stuck in endless calls for interrupts, it is
important that the process in the interrupt service routine does
not take longer than the interrupt period, and that the ISR does
not contain any backward loops. This is part of robust real-time
system design that makes efficient use of interrupts.
The LCD draw routine is described below is called from the
main loop. This is because the time it tooks to write images to
the screen, then clear and re-write is longer than the time it takes
to run the entire game engine. So in the interrupt routine where
the game engine runs, a semaphore flag is set for main loop.
The LCD draw routine is taken from the vendor provided driver
to draw bitmap images on screen such as the one below.

Fig. 4. An alien sprite bmp image to write to LCD.


//********ST7735_PrintBMP*****************
// Bitmaps contain their header data and may contain padding
// to preserve 4-byte alignment. This function takes a
// bitmap in the previously described format and puts its
// image data in the proper location in the buffer so the
// image will appear on the screen after the next call to
// ST7735_DisplayBuffer();
// inputs: xpos horizontal pos of bottom left corner of image,
//
ypos vertical pos of bottom left corner of image,
//
ptr
pointer to a 16 color BMP image
//
threshold grayscale colors above this number make
pixel 'on' 0 to 14
//
0 is fine for ships, explosions, projectiles, and bunkers
// outputs: none
void Nokia5110_PrintBMP(unsigned char xpos, unsigned char
ypos, const unsigned char *ptr, unsigned char threshold);
// There is a buffer in RAM that holds one screen
// This routine clears this buffer
void Nokia5110_ClearBuffer(void);

Table 2. SysTick set up registers.


Address

3124

2317

16

15Mar

Name

$E000E010

COUNT

CLK_SRC

INTEN

ENABLE

NVIC_ST_CTRL_R

$E000E014

24-bit RELOAD value

NVIC_ST_RELOAD_R

$E000E018

24-bit CURRENT value of SysTick counter

NVIC_ST_CURRENT_R

Table 3. SysTick periodic interrupt priority register


Address

31-29

2824

23-21

20Aug

05-Jul

40

Name

$E000ED20

TICK

PENDSV

DEBUG

NVIC_SYS_PRI3_R

Steps to configure and initialize the SysTick interrupt:


1.
2.
3.
4.
5.
6.

Fist, the NVIC_ST_CTRL_R register is cleared to


disable SysTick during setup.
Set the NVIC_ST_RELOAD_R register with the
countdown value for periodic interrupt.
Clear the NVIC_ST_CURRENT_R register to
clear the counter.
Re-enable NVIC_ST_CTRL_R for core clock
periodic SysTick interrupts.
Set INTEN in the NVIC_ST_CTRL_R register to
enable interrupts
Set
the
interrupt
priority
with
NVIC_SYS_PRI3_R register.

//*****************SysTick Initialization******************
//Initialize SysTick power inturrepts for reading slit pot
// Initialize SysTick interrupts to trigger at 30 Hz, 33.33 ms
void SysTick_Init(unsigned long period){
NVIC_ST_CTRL_R = 0;
// disable SysTick during setup
NVIC_ST_RELOAD_R = period;
// reload value for 25ms (at PLL
80MHz)
NVIC_ST_CURRENT_R = 0;
// any write to current clears it
NVIC_SYS_PRI3_R = NVIC_SYS_PRI3_R&0x00FFFFFF; // priority 0
NVIC_ST_CTRL_R = 0x00000007; // enable with core clock and
interrupts
EnableInterrupts();
}
// ***********SysTick Handler to run game engine***********
// ISR handler for SysTick interrupt
// executes every 33.33 ms, collects a sample, converts, moved
gunship, and sets flag for main.
void SysTick_Handler(void){
//main game engine is run here at every interrupt
// all functions are initialized and called here
ADCdata = ADC0_In(); //read ADC
Distance = Convert(ADCdata); //convert to distance for
player
Sptrite.x = Distance; //player position onscreen
If (buttonMissile == 0){ //read button for missile
MissileInit();
PortFLED = 0x02 //Green LED on
}

If (buttonLaser == 0){ //read button for Laser


LaserInit();
PortFLED = 0x08 //Red LED on
}
fireMissile();
fireLaser();
Flag = 1; //semaphore for draw routine in main loop
}

B.

Ambient Weather app:

In this section, the basic software structure is presented to show


how the sensors are interfaced by I2C, and how the gathered
numbers are converted to numbers that the viewer can
understand. Again, the actual full code is about 1000 lines of
code, so the simplified code structure will be presented, but
with all design details present.
#include "sensorlib/i2cm_drv.h" //I2C driver
#include "sensorlib/tmp006.h" // temperature sensor
#include "sensorlib/bmp180.h" //pressure sensor
#include "sensorlib/sht21.h" // humidity sensor
#include // other includes for gpio, LCD driver, stdio and etc.
// define I2C addresses
#define TMP006_I2C_ADDRESS
#define BMP180_I2C_ADDRESS
#define SHT21_I2C_ADDRESS

0x41
0x77
0x40

// global instance structure for each sensor:


tTMP006 g_sTMP006Inst;
tBMP180 g_sBMP180Inst;
tSHT21 g_sSHT21Inst;
// new data flag : set by interrupt
volatile uint_fast8_t g_vui8DataFlagTMP006;
volatile uint_fast8_t g_vui8DataFlagBMP180;
volatile uint_fast8_t g_vui8DataFlagSHT21
// TMP006 callback function. Called through interrupt routine
void
TMP006AppCallback(void*pvCallbackData,uint_fast8_tui8StatusT
MP006)
{

// check for data from temp sensor and set flag


}
// BMP180 callback function. Called through interrupt routine
void BMP180AppCallback(void* pvCallbackData, uint_fast8_t
ui8StatusBMP180)
{
// check for data from temp sensor and set flag
}
// SHT21 callback function. Called through interrupt routine
SHT21AppCallback(void*pvCallbackData,uint_fast8_tui8StatusSH2
1)
{
// check for data from temp sensor and set flag
}

// Initialize the LCD display


ST7735_InitR(INITR_REDTAB);
// print welcome message
ST7735_SetCursor(1,1);
ST7735_OutString ("Weather Monitor");
// section to initialize and configure the I2C interface and enable
interrupt on port E
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
// other long initializations, initialize the 3 sensors
// routines to handle hardware interrupt and collect data
//
//master interrupt enable
ROM_IntMasterEnable();

// I2C interrupt handler for the sensors. I2C3 interface used on the
TM4C SoC
void TMP006I2CIntHandler(void)
{
//data read sequence for TMP006
}
void BMP180I2CIntHandler(void)
{
//data read sequence for BMP180
}
Void SHT21I2CIntHandler(void)
{
//data read sequence for SHT21
}

while(1)
{
// data flag reset routine
g_vui8DataFlagTMP006 = 0;
//read measurements for temperature
//read measurements for pressure
//read measurements for humidity
//convert float numbers to integer and decimal parts for display
i32IntegerPartBMP180 = (int32_t) fMeasurement;
i32FractionPartBMP180 =(int32_t) (fMeasurement * 1000.0f);
i32FractionPartBMP180=i32FractionPartMeasurement(i32IntegerPartMeasurement * 1000);

// the hardware triggerd interrupt is read on Port E


void IntGPIOe(void)
{
//GPIO port E pin is initialized to read interrupts from sensor
board
}

// calculate altitude from pressure measurement


fAltitude = 44330.0f * (1.0f - powf(fPressure
/ 101325.0f,
1.0f / 5.255f));
// display measurements to LCD (repeated for each
of 3 sensors)
ST7735_SetCursor(1,5);
ST7735_OutString
("Pressure:
");
//or
temperature, or altitude, or humidity
ST7735_SetCursor(11,5);
ST7735_OutUDec (i32IntegerPartMeasurement);
//measurement for TMP, BMP or SHT
ST7735_SetCursor(14,5);
ST7735_OutString (".");
ST7735_SetCursor(15,5);
ST7735_OutUDec
(i32FractionPartMeasurement);
//measurement
for TMP, BMP or SHT

// main section to initialize interrupts, initialize sensors, collect data,


convert and display.
Int main(void)
{
// variables decleration
float fAmbient, fObject;
int_fast32_t i32IntegerPartTMP006;
int_fast32_t i32FractionPartTMP006;
float fPressure, fAltitude;
int32_t i32IntegerPartBMP180;
int32_t i32FractionPartBMP180;
float fHumidity;
int32_t i32IntegerPart;
int32_t i32FractionPart;
// initialize system clock to 40 MHz from PLL
ROM_SysCtlClockSet (SYSCTL_SYSDIV_5|YSCTL_USE_PLL |
SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
// enable the port E peripheral
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

}
}

In the above section, vendor provided driver code was utilized


to initialize the sensors, read measurements, and convert the
data. The I2C driver is also vendor provided. The Main code
that collects the data and presents information in readable
format for viewer is custom-written, as is the interrupt handlers
that read data from the sensors every 1s.

The information gathered from the sensors, and calculated


into integers and decimal numbers is then output to the LCD
using the LCD driver routine calls. The LCD driver defines
cursor position, text string output and numerical output for this
application.
V. RESULTS
In this project, a basic multimedia device was design
and implemented that could be used as a basis for a smartwatch. We have 3 apps where the user can play a game, see the
ambient weather conditions, and browse images stored in
memory. So far, the complexity of each component shows the
design effort required in implementing a marketable smart
device.
In the design of user control, a home screen was
created that shows all the applications available to be selected.
The user can select which application to run. However, only the
Space Invaders game can be selected to run form this home
screen. The complete implementation of other apps into one
large program controlled through the home screen selection
proved to be very difficult as discussed in the discussion section
to follow.
The Space Invaders game is successful in allowing
complete user interaction. The player gun ship can be moved
through the use of the slide pot, the missile and lasers can be
fired using the two pushbuttons, and the game keeps record of
the aliens shot. Also, the user has only 10 seconds to shoot the
aliens. If 10 points are scored, the user wins the game with an
on-screen message. The game can be further expanded to
include aliens that are constantly refreshed, and aliens that can
fire back at player. Also, graphics can be improved where
damage to items on screen is visualized with the use of missiles
or laser.
The Ambient Weather app is also implemented
successfully, but needs to be loaded separately to use as the
home-screen selection could not be made to work.
Nevertheless, the ambient temperature in C, atmospheric
pressure in mbar, the altitude in meters above sea level, and
percent humidity are shown on screen. Furthermore, the
temperature sensor also shows object temperature of any object
held about 5-10cm away from the sensor, such as a hand. The
measured information is shown on the screen in the form of
text.
With increased effort in user-interface design and
graphical design, a better weather app can be implemented that
includes graphics, and also real time location-based weather
through the use of internet connectivity. With the limitations of
on-board memory, it is difficult to implement fancy graphics. A
system with expandable storage memory would be needed to
implement better user interface design.
Finally, the image gallery is a simple app the displays
images saved in system memory. The images are small as bmp
graphics use large memory space. The total ROM size on the
TM4C SoC board is about 256 KB. The user can scroll through
the images left or right using the on-board left or right
pushbuttons.

The feature list was successfully implemented.


However, it proved difficult to design a home-screen where any
of the apps could be launched. Also, a compass could not be
implemented due to the complexity in calculating north from
the devices magnetometer whichp returns values in Tesla in an
x-y-z plane. Lastly, an important part of a smart-watch would,
of course, be a time read-out. A time program could be easily
implemented using periodic SysTick interrupts, however, the
time would be reset every time power was cut to the device and
an interface would have to be designed to set the time every
time the device is powered up. A smaller separate battery
powered MCU could be used to keep the system clock running
would need to be implemented to have the device always count
time.
VI. DISCUSSION
The described feature list in the Objectives and Results
section was successfully achieved. However, some features
could not be fully integrated into a stand-alone system where
the user could run any program from an app selection home
screen. This is due to the increased complexity of code that
needs to be integrated into one large program.
The Space Invaders game is selectable to run from the
home screen, however, the weather monitoring app is not.
This is because there are driver incompatibilities in the
drivers provided by the vendor for use with the sensor board.
In integrating the ambient weather app with the complete
system including home screen and Space Invaders game,
there are sensor board drivers that cause driver redefinition
errors for ports and peripherals on the device as defines
separately in the game and weather apps. A large effort
would need to be undertaken to modify the vendor drivers
for the sensors and the peripheral definitions used for the
game to make sure that no variable, port or peripherals are
being multiply defined. Also, the vendor provided interrupt
routines used in the sensor board drivers conflict with the
SysTick periodic interrupt used to run the game engine, the
priorities are mismatched which causes the processor to get
endlessly locked in never ending interrupts. Again the
hardware interrupt drivers would need to be redesigned to
use a different interrupt scheme that does not interfere with
the game app, or other device apps.
Finally, as discussed previously, a compass app was to
be implemented, but proved to be large project on its own.
The magnetometer sensor on the sensor board generated 3dimensional magnetic field values in Tesla. This 3
dimensional matrix would need to be manipulated to generate
a magnetic north compass direction in the 2 dimensional flat
plane. This matrix computation is a complex process that can
be implemented as a separate project on its own, rather than
with a complete device with a game and weather app that was
also implemented with considerable design effort.
VII. CONCLUSION
This project was an attempt to create a basic
multimedia device that can be used as a basis for a more
advanced development where a much larger set of features is

implemented into an actual smart-watch product. An ARM


Cortex M4 SoC was used, which provided enough power to
run the programs and tasks required for the project.
A successful development resulted in the
implementation of the Space Invaders game, an Ambient
Weather app, and a simple image gallery. The design of each
component required a system-level understanding of how the
software flow architecture will control the underlying
hardware assets. Using the software structure, the
software/firmware was designed to create the applications
needed. There was success in creating each of the application
needed, however more effort would be needed to fully
integrate the device into a true smart-watch multimedia
device.

The firmware design effort created the interfaces


needed to control the peripherals on the Cortex M4 SoC such
as SysTick periodic interrupts, ADC, GPIO interface for
switches and LEDs, SPI for LCD and I2C for the sensors.
The software design used the firmware interface to create an
application for the user such as the game, weather app or
image gallery.
REFERENCES
[1] J. Valvano, Embedded Systems: Introduction to ARM Cortex-M
Microcontrollers, 5th ed., vol. 1. UT Austin, 2014
[2] J. Valvano, Embedded Systems: Real-Time Interfacing to ARM
Cortex-M Microcontrollers, 4th ed., vol. 2. UT Austin, 2014

You might also like