• No results found

Near ultrasonic close range communication for modern smartphones

N/A
N/A
Protected

Academic year: 2021

Share "Near ultrasonic close range communication for modern smartphones"

Copied!
50
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT TECHNOLOGY, FIRST CYCLE, 15 CREDITS

,

STOCKHOLM SWEDEN 2017

Near Ultrasonic Close Range

Communication for Modern

Smartphones

KRISTIAN ALVAREZ JÖRGENSEN

MICHAEL CHLEBEK

KTH ROYAL INSTITUTE OF TECHNOLOGY

(2)
(3)

Near ultrasonic close range

communication for modern

smartphones

Kristian Alvarez J¨

orgensen

Michael Chlebek

(4)
(5)

Abstract

NFC is a technology that allows close-range communication between mobile devices. Unfortunately, not all modern smartphones have the required API’s or hardware to utilize it. This thesis seeks therefore to develop a viable al-ternative to NFC for close range communication (less than 10 cm) between mobile smart phones. The goal is to evaluate the feasibility of using a novel scheme that utilizes near ultrasonic frequencies for close range communica-tion for both Android and iOS.

An iPhone and an Android device were used to test our proposed scheme. Range test were preformed on a quiet and noisy environment (food court in a shopping mall), and an interference test was done in the quiet environment. The scheme was shown to work in the tested quiet and noisy environment for ranges less than 1 cm. In the noisy environment, significant data loss happened at 5 cm for the tested android device, while data was somewhat reliably received at up to 10 cm in a quiet environment among both tested devices. Our tests also show that concurrently communicating devices spaced at least 110 cm away will not interfere with each other.

Our findings show that the proposed scheme could be a viable alternative for close range communication. By employing an error correcting code, tolerance to data loss could be improved. Using a different modulation technique is also advisable in order to improve the data transfer rate.

For future work, we suggest testing the near ultrasonic capabilities of a wider array of devices in order to determine the usefulness of the proposed scheme.

Keywords

Ultrasonic, Close range communication, Smartphones, NFC alternative, Cross-platform

(6)

Sammanfattning

N¨ara Ultraljudskommunikation p˚a Korta Avst˚and f¨or Moderna Smarta Telefoner

NFC ¨ar en teknologi som till˚ater kommunikation p˚a korta avst˚and mellan mo-bila enheter. Dessv¨arre finns det enheter som saknar h˚ardvarust¨od f¨or NFC samt att vissa enheter inte har denna funktionalitet tillg¨anglig f¨or apput-vecklare. Denna uppsats f¨ors¨oker d¨arf¨or att utveckla ett g˚angbart alternativ till NFC som m¨ojligg¨or kommunikation p˚a korta avst˚and mellan mobila en-heter. M˚alet med uppsatsen ¨ar att unders¨oka utf¨orbarheten av utvecklandet av ett schema som anv¨ander frekvenser som ligger n¨ara ultraljudsspektrumet f¨or att tillhandah˚alla kommunikation p˚a korta avst˚and f¨or b˚ade Android och iOS.

En Android och en iPhone enhet anv¨andes f¨or att testa schemat. Ett av-st˚andstest utf¨ordes i b˚ade en tyst och en bullrig milj¨o (restaurangtorg i en k¨opcenter), samt ett inteferenstest som gjordes i en tyst milj¨o. V˚art ut-vecklade schema har p˚avisats fungera i b˚ade den tysta och bullriga milj¨o vi testade i, p˚a avst˚and kortare ¨an 1 cm. I den bullriga milj¨on f¨ors¨amrades ¨

overf¨oringsm¨ojligheterna avsev¨art p˚a ett avst˚and av 5 cm f¨or den Android enhet vi testade p˚a, medan avst˚and p˚a upp till 10 cm var g˚angbara i den tysta milj¨on vi testade i. V˚ara test visade ¨aven p˚a att enheter positionerade minst 110 cm bort ifr˚an varandra kan kommunicera samtidigt utan att st¨ora varandra.

V˚ara resultat visar p˚a att v˚art schema skulle kunna fungera f¨or kommunika-tion p˚a korta avst˚and. Anv¨andandet av felkorrigerande koder skulle kunna f¨orb¨attra schemats tolerans mot dataf¨orluster. Anv¨andandet av en alternativ moduleringsteknik ¨ar ocks˚a att f¨oresl˚a f¨or att f¨orb¨attra ¨overf¨oringshastigheten. F¨or framtida arbeten anser vi att f¨orm˚agan att producera frekvenser som ligger n¨ara ultraljudsspektrumet b¨or unders¨okas hos en st¨orre m¨angd mobila enheter, f¨or att fastst¨alla anv¨andbarheten av det f¨oreslagna schemat.

(7)

ii

Nyckelord

Ultraljud, n¨arf¨altskommunikation, Smarta telefoner, NFC-alternativ, Mul-tiplatform

(8)

Acknowledgements

We want to dedicate special gratitude to David & ˚Asa Broman for providing us with the project and for all the help, feedback and guidance we have received along the way. Thanks!

We also wish to thank Thomas Sj¨oland and Johan Montelius for the help and support they have provided, and to KTH for providing us with office space to do our work. Lastly, we thank all our peers that have provided us with feedback and comments during the seminars and presentations during the last few months.

(9)
(10)

Contents

1 Introduction 1 1.1 Background . . . 1 1.2 Problem . . . 2 1.3 Purpose . . . 2 1.4 Goal . . . 2

1.5 Benefits, Ethics and Sustainability . . . 3

1.6 Methodology . . . 3

1.7 Delimitation . . . 4

1.8 Employer of the study . . . 4

1.9 Outline . . . 4

2 Theoretical Background 5 2.1 Human hearing range . . . 5

2.2 Digital modulation . . . 6 2.2.1 Amplitude modulation . . . 6 2.2.2 Frequency-shift keying . . . 7 2.2.3 Phase-shift keying . . . 7 2.3 Goertzel’s Algorithm . . . 8 3 Prior work 11 3.1 Academic work . . . 11 3.2 Services . . . 12 4 Method 15 v

(11)

vi CONTENTS

4.1 Materials . . . 16

4.2 Prestudy . . . 17

4.3 Communication scheme . . . 17

4.4 Experiment design . . . 18

4.4.1 Device to device communication . . . 19

4.4.2 Communication interference . . . 20

5 Implementation 21 5.1 Data transfer overview . . . 21

5.2 Modulation technique . . . 22 5.3 Wave generation . . . 23 5.4 Demodulation . . . 23 6 Results 25 6.1 Preliminary results . . . 25 6.2 Main results . . . 26

6.2.1 Device to device communication . . . 26

6.2.2 Communication interference . . . 27

7 Conclusions 29 7.1 Sources of error . . . 30

7.2 Future Work . . . 31

(12)

Chapter 1

Introduction

We use a variety of wireless technologies almost every day when we want to authenticate ourselves at work, surf the web at a coffee shop or connect our devices with nearby gadgets. In this thesis, we will specifically be looking at closed range communication technologies used for sending and receiving small messages.

1.1

Background

Various technologies and protocols for wireless communication between mo-bile devices exist today for different applications. Near Field Communication (NFC) is commonly used for close range communication within 10 cm [1]. NFC can be used for mobile pay services, access tokens, data transfer and more. Another increasingly popular technique to transfer data between de-vices over the last few years has been with near ultrasound, which has seen wide use in commercial products by Google and Blizzard [2]–[5]. The ranges are typically larger than with NFC, and limited by the power of the speak-ers.

(13)

2 CHAPTER 1. INTRODUCTION

1.2

Problem

The advantage with a close range communication protocol such as NFC is that physical or near-physical contact is required for connectivity between devices. NFC is furthermore reliable, and concurrent NFC connections in a small space do not interfere with each other. However, NFC requires com-patible hardware and accessible API’s for app developers, which is not the case on older devices and the iPhone-range of smartphones. The problem is thus that a close range communication protocol (defined as within 10 cm for the scope of this thesis) that is available for all smartphones does not currently exist.

To which extent could near ultrasonic communication be used to fill this gap?

1.3

Purpose

The purpose of this thesis was to describe the feasibility of using near ultra-sonic sound waves for short range communication between smart phones, in order to solve the problem presented earlier.

1.4

Goal

The overarching goal was to develop a close range communication technique that is available across a wide array of smartphones. This thesis evaluates a scheme for near ultrasonic communication that limits the range compared to previous designs. This scheme should provide reliable data transfer and be resistant to interference from neighbouring communications of the same type.

The results present the range of communication between devices using the proposed scheme as well as the guaranteed interference free distance between concurrent communications.

(14)

1.5. BENEFITS, ETHICS AND SUSTAINABILITY 3

1.5

Benefits, Ethics and Sustainability

The thesis benefits all those seeking a platform independent alternative to NFC. Those seeking communication methods for other use cases could po-tentially benefit as well.

Although adult humans find the sounds at near-ultrasonic frequencies in-audible [6], these frequencies are within the hearing range for toddler, young children and common household pets such as cats and dogs [7]. However due to the proposed communication scheme, the emitted sound is not very intense and it is not something that is perceived to be a problem unless a device is directly placed on an ear.

Another issue is one of confidentiality. Since the data is broadcast on an open medium, the data could be intercepted by a third party unbeknownst to the user. This issue can be mitigated by securing the data through en-cryption.

Since the aim is to develop a close range communication technique using widely adopted hardware parts, this project could possibly lead to a slight positive environmental impact. This due to the fact that users of smart phone devices without NFC-chips could (through the results of this project) utilize a close range communication technology without having to upgrade to NFC compatible devices.

1.6

Methodology

A scheme for close range near ultrasonic communication for smart phones was developed using the engineering method. The proposed scheme was evaluated by using a quantitative research methodology applied on a developed test application for Android and iPhone. Another option would have been to use a qualitative research method, but these are typically applied in areas which relate to understanding some aspect of social life [8].

(15)

4 CHAPTER 1. INTRODUCTION

1.7

Delimitation

Focus was placed on creating functioning data transfer with near ultrasound and testing its capabilities and limitations. Data transfer rate was therefore not analyzed, nor was any consideration placed on the data transfer speeds when deciding on the underlying signal processing techniques used.

The scheme devised was only implemented onto Android and iOS. These platforms hold the majority of the market and are therefore suitable to de-velop for. [9]

1.8

Employer of the study

This thesis was done for Broman Systems and Consulting, who supplied support, testing devices and development equipment.

1.9

Outline

Chapter 2 describes the theory needed to understand this thesis. Chapter 3 contains relevant previous work done with sound and near ultrasonic com-munication. Both academic papers as well as services which implement near ultrasonic data transfer are introduced.

In chapter 4 the method used for developing and testing the proposed scheme is presented. Chapter 5 is about the actual implementation of the scheme for near ultrasonic data transfer. The results of the tests run on the implemen-tation are contained in chapter 6. The conclusion of the thesis can be found in chapter 7.

(16)

Chapter 2

Theoretical Background

This chapter introduces the techniques used to encode digital data in analog signals, describe what makes near ultrasonic and ultrasonic sounds inaudi-ble as well as present a technology used for close range communications today.

2.1

Human hearing range

Humans can hear sounds ranging from 20 Hz to 20 kHz in frequency [6]. However, hearing ability declines with age and adults are typically only able to detect sounds up to 15-17 kHz on average [6] and the hearing threshold (the volume needed to detect a sound) increases abruptly after 12 kHz [10]. 66 dB is the median needed to detect a 18 kHz frequency, while the same figure for 20 kHz is almost 90 dB 1. [10]

Previous work with near ultrasonic frequencies shows that modern smart-phones are capable of generating and detecting frequencies in the 20-23 kHz range [12]. Generating and detecting frequencies close to 20 kHz should

1A vacuum cleaner produces 70 dB, while 90 dB is comparable to a Boeing 737 before

landing [11]

(17)

6 CHAPTER 2. THEORETICAL BACKGROUND

therefore be possible on most devices, while remaining imperceptible to the human ear.

2.2

Digital modulation

In order for a wave to transmit digital data over an analog medium, the carrier wave, that is, the wave carrying the data, must alternate between different distinguishable states, a process known as modulation. This is done by altering the amplitude, frequency and/or phase of the carrier wave. [13, p. 100] [14, p. 300].

2.2.1

Amplitude modulation

Amplitude modulation, or AM for short, is the simplest form of modulation. AM consist of varying the amplitude of the carrier wave according to the data being transmitted [15]. The drawbacks with amplitude modulation is that it is sensitive to noise. Any noise introduced will affect the carrier wave, which will in turn affect the demodulated signal. [16]

Amplitude-shift keying

The process of coding digital data via the modulation in amplitude of an analog signal is known as Amplitude-shift keying, or ASK for short. A finite number of amplitude levels are established which each correspond to a unique symbol, which is mapped to a unique pattern of bits. A symbol is transmitted by keeping the carrier wave at a fixed amplitude for a predetermined amount of time [15]. ASK has the same drawbacks as AM does, and using more amplitude levels increases this issue.

(18)

2.2. DIGITAL MODULATION 7

On-Off keying

On-Off keying, OOK for short, is the simplest form of ASK. Data is repre-sented via the existence or absence of the carrier wave [15]. Symbols can be definied either through the duration that the carrier wave is held for, as in Morse code [17], where a short duration is a ”dot”, while a long duration is a ”dash”; or the presence of the carrier signal for a fixed duration represents one symbol, while the absence represents another [15].

2.2.2

Frequency-shift keying

Frequency-shift keying, FSK, modulates the frequency of the carrier wave in order to transmit digital data. The most basic form of FSK, called Binary FSK(BFSK), has two distinct frequencies to represent a digital one and a dig-ital zero. By measuring which frequency the carrier symbol has at intervals given by a clock signal one can demodulate the data. [15]

2.2.3

Phase-shift keying

Phase-shift keying, PSK, functions by varying the phase of the carrier wave and thereby encodes digital data onto the analog signal. A distinct set of phases are assigned to a unique pattern of bits (See figure 2.1). In order to determine a phase shift there needs to be something to compare the received signal against. There are two general ways of doing this: either the signal can be compared against a reference signal, and from that comparison determine the phase of the received signal. That is the phase itself is seen as the carrier of information. Or the signal can be compared to itself. The difference in phase from the preceding sample would then constitute a change of phase and thus would be what encodes data. [15]

(19)

8 CHAPTER 2. THEORETICAL BACKGROUND

Figure 2.1: Binary phase shift keying - PSK with two distinct phases Image from Wikimedia

2.3

Goertzel’s Algorithm

Goertzel’s Algorithm (GA) filters everything outside an interval centered around a target frequency, which is known as a bandpass filter. It performs an efficient Discrete Fourier Transform (DFT) with lower computational over-head compared to a Fast Fourier Transform (FFT) as long as the number of target frequencies of interest are small [18], [19].

A sampled stream of data is processed a block (of size N ) at a time. Equation 2.1 (as expressed by [18], [19]) is applied for each sample x(n) in the block. The coefficient 2 cos(2πftone

fs ) (where ftone is the target frequency and fsis the

sample frequency) can be calculated in advance. The range of the bandpass filter that GA produces is the factor of the block size N and the sampling frequency fs.

(20)

2.3. GOERTZEL’S ALGORITHM 9 vk(n) = ( 0, if n = −1 or n = −2 x(n) + 2 cos(2πftone fs )vk(n − 1) − vk(n − 2) otherwise (2.1) From equation 2.1, the real and imaginary parts of the frequency can be calculated [18]–[20]. The amplitude X(k) (where k is the number of samples) can however be calculated directly (equation 2.2 as expressed by [19], [20]) without the need for complex arithmetic at the cost of phase information [19], [20]. |X(k)|2 = v2 k(N − 1) + v 2 k(N − 2) − 2 cos(2π ftone fs )vk(N − 1)vk(N − 2) (2.2)

(21)
(22)

Chapter 3

Prior work

Sending data through sound is nothing new, and so a large amount of prior work exists. Data transfer via dial-up was the back-bone of the Internet in the 90’s and continues to be used in remote areas [21]. In recent years research and services around the concept of sending data through sound have been done, both audibly and inaudibly [3]–[5], [12], [22], [23].

3.1

Academic work

Directional Data Transfer

Arentz and Bandara describe a way to use near ultrasonic sound waves for directional data transfer [12], similar to how IR was used in older mobile devices. Their scope is very similar and thus their findings and methodology are very relevant to this degree project.

The data is encoded by varying the duration of the signal pulse, similar to Morse code. They did not experience any ”significant reduction of transmis-sion quality” when they performed tests in buses, trains, outside and in ”noisy meeting rooms”. What qualified as ”significant reduction” and ”noisy” was not defined. They also describe large directional sensitivity, finding that ”if

(23)

12 CHAPTER 3. PRIOR WORK

the receiver is moved more than 10 degrees off the beam’s path, reception becomes impossible”. [12]

Flight Transfer

Kuger et al. design a communication system with sound through AUX-cables for use between Android devices in an in-flight scenario [23].

They provide good insights on how good data transfer rates over sound can be achieved. However, this is outside the scope of this degree project. Fur-thermore, many of the modulation and demodulation techniques assume the full use of the audio spectrum, a luxury not present in the scope of the thesis.

Secure Communication

Zhang et al. describe a way to use near ultrasonic sound waves with jamming for key-less secure communication. The principle is simple — a sender sends some data while the receiver jams. The receiver, knowing what they are jamming with, can then decipher the message. [22]

Since the focus is on cryptography, it falls outside the scope of this project.

3.2

Services

Several services that utilize sound as medium for communication exist. The applications vary, but non are used for communication with the same limited ranges as for instance NFC. Since these technologies are proprietary, they mostly demonstrate the feasibility of using sound (and more specifically, near ultrasonic frequencies) as a medium for communication.

Chirp

A British company called Chirp sells a technology to businesses that allows data transfer between devices using sound. They offer API’s for both au-dible and inauau-dible communication. The technology is for instance used by Activision Blizzard for offline data transfer in a couple of their games. [4], [5]

(24)

3.2. SERVICES 13

Google Tone

Google have created a Chrome extension which allows users to share links with each other via both audible and near ultrasonic sound [3]. There is no public documentation as to how they do this, but by analyzing the sound they produce it is clear that they use a combination of audible and near-ultrasonic frequencies to transmit the data (see fig 3.1).

Figure 3.1: Spectrogram showing the frequencies used by Google Tone. The Y-axis represents the frequency in Hz, the X-axis time in seconds. The intensity is color-coded from blue to white. Note the clear use of frequencies in the 19 kHz range.

(25)
(26)

Chapter 4

Method

The implementation was done on Android and iOS. These platforms were targeted since they are ubiquitous and the overwhelming majority of smart mobile devices run on either of those two platforms [9]. Developing imple-mentations for other platforms should be possible, but was simply not feasible in the scope of this work.

Similar considerations were taken when choosing which versions of the op-erating systems to target, since a newer API could exclude large segments of the user base. The iOS implementation targets version 10 of the oper-ating system since 79%1 of mobile Apple devices are running that version [24]. Conversely, the Android implementation targets version 5.1 and later since they represent roughly 60% 2 of Android devices [25]. Targeting

ear-lier legacy devices leads to diminishing returns in terms of market share and increased code complexity, and was therefore avoided.

1As meassured by Apple on February 20, 2017 2As meassured by Google on April 3, 2017

(27)

16 CHAPTER 4. METHOD

4.1

Materials

The following hardware and software were used: Target Devices

• iPhone 6s with iOS 10 • Huawei Y6 with Android 5.1 • HTC One M9 with Android 6 Development Environments

• Targeting Android:

– SDK & IDE: Java on Android Studio 2.3 – Platform: Ubuntu 16.10

• Targeting iOS:

– SDK & IDE: Swift on Xcode 8 – Platform: macOS 10.12

Software for sound analysis • Audacity

• Decibel meter app made by the Swedish Work Environment Authority Testing materials

• Play-Doh • Laser pointer • Try square

(28)

4.2. PRESTUDY 17

4.2

Prestudy

The ability of various devices to receive and transmit near ultrasonic frequen-cies was tested by implementing simple frequency generators. The capabili-ties were evaluated by recording the generated tones on the same device and analyzing the recording with a spectrogram in audio editing software. The capacity of the receivers 3 was evaluated with a decibel meter app made by

the Swedish Work Environment Authority. Since the app reproduces data using A-weighting, the measurement is done by generating a tone at 1KHz where the weighting is 0 [26].

4.3

Communication scheme

Devices that wish to communicate are positioned with their screens facing each other (similar to NFC, which requires devices to be placed back-to-back). By using the receiver to send data, the sound is directed at the other device (see figure 4.1).

Previous endeavours in the field have utilized the main speakers to transmit near ultrasonic data between devices.[12] This results in a relatively large range, much larger then the few cm we are aiming for. Using the receiver should therefore result in a much smaller range. The main speakers are additionally typically positioned in the bottom of a smartphone. Given that near-ultrasonic frequencies have a high degree of directional sensitivity[12], this would require communicating devices to be positioned in a very specific angle. Using the receiver allows for alignment with the microphone of the opposing device when positioned front-to-front and should facilitate duplex data transfer.

(29)

18 CHAPTER 4. METHOD

Figure 4.1: Communication scheme

4.4

Experiment design

Experiments were designed to test the range and fault tolerance of the com-munication scheme. Three factors were identified as error-inducing: in-terference from communication nearby, noise from the surrounding en-vironment and the orientation of the communicating devices facing each other.

The scheme assumes positioning the devices front-to-front with the receiver of the sending device aligned with the microphone of the other device, referred to as non-aligned (a dis-alignment of the microphones). However, it is also possible to align the devices front-to-front but with the receiver aligned with the receiver, termed an aligned orientation. The latter could potentially render communication impossible, and it was deemed meaningful to test if so was the case.

All of the tests consisted of one device transmitting a predetermined message to another device. If the second device was able to successfully decode the

(30)

4.4. EXPERIMENT DESIGN 19

transmission into the same message the test was classified a success, otherwise it was classified as a failure. This was then repeated 100 times in order to ensure that we had a sufficient sample size. Play-Doh was used to construct stands that position the devices.

The noise levels of the environments were monitored with a dB(A)-meter app on a Nexus 5. The accuracy of the measurements were deemed plausible after comparing the readings to known dB values [11]. Since the same device was used for all measurements the results should be internally consistent.

4.4.1

Device to device communication

The range and accuracy of communication was tested between an Android (Huawei) and iPhone device. Each trial was conducted 100 times and per-mutated across the following variables:

• Distance between phones – 1 cm

– 5 cm – 10 cm – 15 cm • Orientation

– Screens facing, devices rotated 180 degrees relative each other (bottom aligned with top) - Non aligned

– Screens facing, bottom aligned with bottom - Aligned • Environment

– Quiet room – Busy caf´e

The choice of distances was done in regards to time, as having a larger resolution (e.g. testing every centimeter) would greatly increase the time required to conduct the trials. The final distance was based on short, informal tests on what distances data could no longer be transmitted.

(31)

20 CHAPTER 4. METHOD

4.4.2

Communication interference

The goal of this test was to determine at what proximity concurrent commu-nications start interfering with each other. In order to do this, a worst case scenario was simulated with a third device interfering the communication of two devices from various fixed distances. The two communicating devices (Huawei and iPhone) were positioned according to the scheme (see figure 4.1) at a fixed distance of 1 cm, taking turns attempting to send 100 4 byte long messages to one another in a quiet room. The test was not repeated in a noisy environment, since this was not deemed relevant in determining the interference free range.

The interfering device (HTC) was positioned so that its receiver (the small speaker on phones) was aimed at the microphone of the receiving device. Since near ultrasonic frequencies are very narrow [12], the accuracy of the po-sitioning was measured with the help of a try square and a laser pointer. The distance of the interfering device was then altered until the rate of error in the transmission from the communicating devices was statistically insignif-icant compared to the results from the previous test in the same quiet envi-ronment where the distance between the devices was 1 cm. The statistical analysis was done with a χ2 test with p = 0.05.

(32)

Chapter 5

Implementation

In order to evaluate the proposed scheme (see section 4.3) we developed a test app for iOS and Android. The app allowed us to easily vary the frequency we wanted to send at, change the threshold for what constituted data and also gave us visual output in the form of a graph on the input received on a given frequency. The app had the option to both send and receive a string indicated by a text field. If receiving, the test app would compare the received string with the input string and log the result.

5.1

Data transfer overview

Data was transmitted at frequency ftone close to 20 kHz, in order to be

inaudible. In order to be able to detect ftone we needed a sample rate that

was at least double ftone (the Nyqvist Rate), and so the commonly available

44.1 kHz (used in CD’s) was chosen.

When sending, data was processed according to figure 5.1. Data was encoded in a very basic frame made of three parts:

1. A header with only a byte-long size parameter indicating the payload size in bits

(33)

22 CHAPTER 5. IMPLEMENTATION

2. UTF-8 encoded payload

3. Parity bit for the header and payload

The data frame is appended to a simple synchronization sequence and sent to the modulator.

Figure 5.1: Flow chart for the sending device

Figure 5.2 depicts the steps implemented to receive the signal. The bandpass filter is implemented using Goertzel’s Algorithm, and the filtered data is passed on to the demodulator. The synchronization sequence is used by the demodulator to identify a frame and distinguish it from random noise. The decoder retrieves the payload from the frame.

Figure 5.2: Flow chart for the receiving device

5.2

Modulation technique

Modulation was done by varying the amplitude and duration on a specific frequency, similar to long and short signals in Morse code. It is the same modulation scheme as the one used by Arentz and Bandara [12]. The choice of modulation technique was made with regards to robustness and ease of implementation. If one were to combine multiple modulation techniques, it would be possible to achieve a higher transfer rate, at the cost of an increase in the difficulty to implement the technique. It is due to this reason that we have chosen to not look at more complex modulation techniques, such as QAM [27], which has a much higher theoretical data-rate at the expense of being a lot harder to implement correctly and robustly.

(34)

5.3. WAVE GENERATION 23

A period t is defined as a time unit the signal has to be above the threshold in order for it to count as data. The time is measured from the rise above the threshold until the drop below it. A duration of t/2 is coded as a 0, while a duration of t is coded as a 1. The duration of the signal will be rounded towards the nearest valid coding if it is within 50% of a period. A pause is defined as t/4 and should be sent between each bit. A timeout period of t is used for separating bit-streams.

5.3

Wave generation

The modulator generates a pulse at the target frequency ftone using equation

5.1, where 0 ≤ x ≤ l, and l is the length of the pulse. l is t or t/2 if the bit being sent is 1 or 0.

f (x) = sin(2πxftone fs

) (5.1)

Going abruptly from a high amplitude to a low one produces audible artifacts. In order to a avoid that, a smoother g(x) (equation 5.2) is multiplied to the wave f (x) in order to fade the pulse in and out.

g(x) = 1 − (2x l − 1)

4

(5.2)

5.4

Demodulation

An amplitude threshold is hard coded at a level above the background noise in order to identify data. In order for the demodulator to acknowledge a packet, three pulses of approximately the same length with a pause no longer than t/4 must proceed it. This is done because background noise may occasion-ally pass the threshold, so in order to correctly identify a packet a simple predefined synchronization sequence (of three zeros) is used.

(35)
(36)

Chapter 6

Results

In this chapter, the scheme evaluation results are presented.

6.1

Preliminary results

The power of the receivers was tested using a decibel meter app made by the Swedish Work Environment Authority on a Nexus 5 device, and they where found to have a comparable output at 87.5 to 88 dB.

All devices where deemed capable of sending and detecting near ultrasonic frequencies. During this test it was discovered that certain artifacts occurred on the iPhone if the sound was played back at high volumes. This results in sound that is being played at near ultrasonic frequencies which should be inaudible to humans to instead also produce sound at frequencies within the audible spectrum. The referenced behavior is visualized in figure 6.1. Here a sine wave was produced at 20kHz at a low volume level. The volume was thereafter increased throughout the test. At a certain break point, lower, audible frequencies started to appear.

These results were only able to be replicated on Apple hardware1 and were

1iPhone 6s and late 2013 MacBook Pro

(37)

26 CHAPTER 6. RESULTS

Figure 6.1: Spectrogram showing the recorded frequencies when playing a sine tone at 20kHz while increasing the volume of the device. The Y-axis represents the frequency in Hertz, the X-axis time in seconds. The intensity is color-coded from blue to white. Grey denotes an absence of sound at that specific frequency.

replicable across all frequencies.

6.2

Main results

The recorded sound level for the tests run in the quiet room were consistently around 23 dB(A). The sound levels for the food court were slightly more variable. Levels from 61 dB(A) to 70 dB(A) were recorded, but they were generally around 65 dB(A).

6.2.1

Device to device communication

The ability of the devices to correctly send data at varying distances and environments was tested in the two orientations where the devices face each other - ”Aligned” (receiver against receiver) and ”Non aligned” (receiver against microphone). The payload was a four byte long string of UTF-8 encoded characters which the receiver then compared.

At ranges below 5 cm using the ”Non-aligned” orientation in an optimal environment communication was successful with only minor issues for the Android device. At 10 cm the ability to transmit data correctly dropped off on all platforms, yet the success rate was still rather high. Transmissions

(38)

6.2. MAIN RESULTS 27

Figure 6.2: Bar graph showing the number of correctly received messages in a quiet room

using the ”Aligned” orientation were poor even at close ranges, especially for the tested Android device. See figure 6.2.

In a noisy environment, transmission worked well for the 1 cm range. At 5 cm, the successful transfer rate for the Android device was dramatically reduced. At 10 cm, no data was successfully received and the aligned variations where not capable of transmitting data at any range. See figure 6.3.

6.2.2

Communication interference

This test looked at the prototypes’ resistance to interference during commu-nication. An interfering signal was directed towards the microphone of the receiving device and the test was run at increasing distances until deemed successful. The findings (see figure 6.4) show that a distance of 110 cm was required before communication could be conducted without statistically significant interference.

(39)

28 CHAPTER 6. RESULTS

Figure 6.3: Bar graph showing the number of correctly received messages in a noisy environment

Figure 6.4: Bar graph showing the number of correctly received messages in the interference test

(40)

Chapter 7

Conclusions

Our findings show that ultrasonic communication is plausible as a close range communication (CRC) technology. At very close ranges (1 cm) our scheme worked well independent of environment. At slightly longer ranges (5 cm) it did not provide satisfactory results in noisy environments. Therefore we suggest that an error correcting code (ECC) be used. This would result in a larger packet size, but should also allow more packages to be sent cor-rectly.

For silent environments, it is possible for a device a meter away to interfere with an ongoing transfer between two devices close to each other. For the presented communication scheme to be viable and robust in a scenario with multiple simultaneous connections over a small space, a collision avoidance protocol could be used.

Another approach to solving the issue with failed transmissions in noisy en-vironments would be to apply a modulation technique not centered around amplitude. The reason is that AM is sensitive to random noise, which was present in the noisy environment we tested in. Depending on the technique used this could also lead to an improvement in data rate.

(41)

30 CHAPTER 7. CONCLUSIONS

7.1

Sources of error

Due to limitations in access to Android phones, we have not been able to run our tests across the entire range of devices, and our results should not be seen as representative for the entire Android ecosystem. A potentially large source of error is the difference in dimensions of the various phones, as well as the layout of the receiver and microphone on them. A mismatch between devices could potentially lead to reduced transmission capabilities. Furthermore, devices could have hardware incapable of reproducing and/or detecting near ultrasonic frequencies.

Although the receivers were found to be equivalent in output capability, the microphones were not tested. A difference in microphone capability might explain the superior performance of the iPhone device in the noisy environ-ment.

Threshold calibration

For each environment, the threshold was manually set to be above the back-ground level. This could lead to potentially flawed results, especially com-pared to a scheme where the threshold is dynamically set. Especially in the interference tests, the lack of a dynamic threshold could result in interfer-ence from devices further away than if a dynamic threshold adoption was employed.

Randomness of noise

A source of error could exist with our tests run in the noisy environment. Due to the randomness of the sounds present in the environment, it was impossible to ensure identical conditions for near ultrasonic communications across the tests. The readings from the dB(A) measurements were similar, which should mean that the sounds present were similar. This error source probably had a lower impact on the results, due to the duration as well as the number of tests run.

Multipath interference

By bouncing on various objects, the generated sound wave could interfere with itself, potentially ruining the results. For instance, during the interfer-ence testing the interfering signal could be subject to destructive interferinterfer-ence

(42)

7.2. FUTURE WORK 31

by taking multiple paths, and thus the results might have appeared more promising then they actually were.

7.2

Future Work

We propose employing these tests on a wider array of devices. As mentioned in the delimitation, this thesis has not focused on the transfer speed, and it is something which definitely can be increased. The implementation itself should be able to be fine tuned to allow for an increase in data rate. Optimiz-ing the size of the block which is processed by Goertzel’s Algorithm could allow for a reduced period time t, and therefore faster transmission. The choice of modulation technique is sub-optimal in regards to the transfer rate, since we are modulating the duration of the signal. A different technique is basically guaranteed to result in a faster rate, is something that should be analyzed if utilizing the proposed scheme.

The work this thesis describes is not a complete protocol. It could however function as a the physical layer in an already existing one. Adapting the NFC protocol to use our scheme instead of utilizing RF could provide interesting and potentially useful results.

For a secure application, our scheme combined with the jamming technique described by Zhang et al. [22] could be useful.

(43)
(44)

Bibliography

[1] J. Fischer, “Nfc in cell phones: The new paradigm for an interactive world [near-field communications]”, IEEE communications Magazine, vol. 47, no. 6, pp. 22–28, 2009.

[2] Google. (2017). Guest mode, [Online]. Available: https://developers. google.com/cast/docs/guest_mode (visited on 05/19/2017).

[3] ——, Google tone. [Online]. Available: https://chrome.google.com/ webstore/detail/google-tone/nnckehldicaciogcbchegobnafnjkcne? hl=en (visited on 05/02/2017).

[4] J. Vincent. (Jan. 2017). Chirp lets computers talk to each other with electronic birdsong, The Verge, [Online]. Available: http : / / www . theverge . com / 2017 / 1 / 26 / 14398250 / audio over data chirp -iot-internet-of-things (visited on 04/27/2017).

[5] A. Orlowski. (Nov. 2016). Chirp! let’s hear it for data over audio, British low tech finds the places high tech can’t reach, The Register, [Online]. Available: http://www.theregister.co.uk/2016/11/10/chirp_ lets_hear_it_for_data_over_audio/ (visited on 04/27/2017).

(45)

34 BIBLIOGRAPHY

[6] D. Purves, G. J. Augustine, D. Fitzpatrick, L. C. Katz, A.-S. LaMan-tia, J. O. McNamara, and S. M. Williams, Neuroscience, 2nd. Sinauer Associates, 2001, The Audible Spectrum. [Online]. Available: https: //www.ncbi.nlm.nih.gov/books/NBK10924/.

[7] G. M. Strain. (Apr. 2017). How well do dogs and other animals hear?, Louisiana State University, [Online]. Available: http://www.lsu.edu/ deafness/HearingRange.html (visited on 05/28/2017).

[8] N. Brikci and J. Green, A guide to using qualitative research method-ology, Medicins Sans Frontieres, Feb. 2007. [Online]. Available: https: / / cloudfront . ualberta . ca/ /media / science / research and -teaching/teaching/qualitative-research-methodology.pdf (vis-ited on 06/01/2017).

[9] L. Goasduff and A. A. Forni. (Feb. 2017). Gartner says worldwide sales of smartphones grew 7 percent in the fourth quarter of 2016, Gartner, [Online]. Available: http://www.gartner.com/newsroom/id/3609817 (visited on 05/02/2017).

[10] K. Ashihara, “Hearing thresholds for pure tones above 16 khz”, The Journal of the Acoustical Society of America, vol. 122, no. 3, EL52– EL57, 2007.

[11] IAC Acoustics. (2017). Comparitive examples of noise levels, [Online]. Available: http://www.industrialnoisecontrol.com/comparative-noise-examples.htm.

[12] W. A. Arentz and U. Bandara, “Near ultrasonic directional data trans-fer for modern smartphones”, in Proceedings of the 13th International

(46)

BIBLIOGRAPHY 35

Conference on Ubiquitous Computing, ser. UbiComp ’11, Beijing, China: ACM, 2011, pp. 481–482, isbn: 978-1-4503-0630-0. doi: 10 . 1145 / 2030112.2030181. [Online]. Available: http://doi.acm.org.focus. lib.kth.se/10.1145/2030112.2030181.

[13] A. S. Tanenbaum, Computer networks. Prentice-Hall International, 1981. [14] A. Ambardar, Analog and digital signal processing. Brooks/Cole

Pub-lishing Company, 1999.

[15] F. Xiong, Digital modulation techniques, 2nd. Artech House, 2006. [16] (Apr. 2000). Problems limitations am waves, University of St.

An-drews, [Online]. Available: https://www.st-andrews.ac.uk/~jcgl/ Scots_Guide/RadCom/part9/page4.html (visited on 06/11/2017). [17] I. T. Union. (Oct. 2009). International morse code, [Online]. Available:

http://www.itu.int/rec/R-REC-M.1677-1-200910-I/ (visited on 05/31/2017).

[18] S. Engelberg, “The goertzel algorithm”, Digital Signal Processing: An Experimental Approach, pp. 203–206, 2008.

[19] K. Zhang, X. Yu, and W. Wan, “A digital tone decoder based on a modified goertzel algorithm”, in Audio, Language and Image Process-ing, 2008. ICALIP 2008. International Conference on, IEEE, 2008, pp. 779–783.

[20] S. Gay, J. Hartung, and G. Smith, “Algorithms for multi-channel dtmf detection for the we dsp32 family”, in Acoustics, Speech, and Sig-nal Processing, 1989. ICASSP-89., 1989 InternatioSig-nal Conference on, IEEE, 1989, pp. 1134–1137.

(47)

36 BIBLIOGRAPHY

[21] D. Kedmey. (May 2015). Why dial-up internet isn’t dead yet, Time, [Online]. Available: http://time.com/3856066/aol-verizon-deal-dial-up-internet/ (visited on 05/27/2017).

[22] B. Zhang, Q. Zhan, S. Chen, M. Li, K. Ren, C. Wang, and D. Ma, “Pri-whisper: Enabling keyless secure acoustic communication for smart-phones”, IEEE Internet of Things Journal, vol. 1, no. 1, pp. 33–45, Feb. 2014, issn: 2327-4662. doi: 10.1109/JIOT.2014.2297998. [23] L. Kuger, L. Liu, Y. Gong, T. Pettersson, F. ¨Arlemalm, and G. Gupta,

“In-flight file transfer, Project in wireless communication”, KTH Royal institute of Technology, Apr. 2016.

[24] Apple, Support, App store. [Online]. Available: https://developer. apple.com/support/app-store/ (visited on 05/02/2017).

[25] Google, Platform versions. [Online]. Available: https://developer. android.com/about/dashboards/index.html#Platform (visited on 05/02/2017).

[26] S. Bech and N. Zacharov, Perceptual audio evaluation, Theory, method and application. John Wiley & Sons, 2006.

[27] L. Hanzo, S. X. Ng, T. Keller, and W. Webb, Quadrature amplitude modulation, From basics to adaptive trellis-coded, turbo-equalised and space-time, coded ofdm, cdma and mc-cdma systems. Wiley-IEEE Press, 2004.

(48)

Appendix A

Tables

Device Receiver output (dB)

iPhone 87.7

HTC 87.5

Huawei 88.0

Table A.1: Measured dB output from the device receivers Orientation

Non aligned Aligned

Gap Correct Android iPhone 1cm 99 99 5cm 93 100 10cm 84 86 15cm 0 0 Gap Correct Android iPhone 1cm 64 96 5cm 0 0 10cm 0 0 15cm 0 0

Table A.2: Successfully received frames out of 100 during the communication test in a quiet environment

(49)

38 APPENDIX A. TABLES

Orientation

Non aligned Aligned

Gap Correct Android iPhone 1cm 92 97 5cm 37 96 10cm 0 0 15cm 0 0 Gap Correct Android iPhone 1 cm 0 0 5 cm 0 0

Table A.3: Successfully received frames out of 100 during the communication test in a noisy environment

Gap Correct Android iPhone

100 cm 1 2

105 cm 6 6

110 cm 99 100

Table A.4: Successfully received frames out of 100 during the interference test in a quiet environment.

(50)

TRITA TRITA-ICT-EX-2017:81

References

Related documents

In view of the above, the global features of wave-induced stress and its correlated parameters will be analyzed and presented based on the synchronously matched monthly mean

In the present paper we have improved the limiting results for three wave interactions in a cold plasma and pointed out that the explicit expressions for the coupling coefficients

– Same order of magnitude as measurement noise (for integration time 10  atmospheric) – Statistical error, i.e., goes down when data.

In fact our study showed that managers within Alpha News could be interpreted as unable to keep up with the pace of change in technological development, thus

It was found that sampling with around 2000 points was typically sufficient to see convergence with Monte Carlo sampling to an accuracy comparable to the accuracy of the

Many of these methods such as high order local NRBCs and the perfectly matched layer (PML) which we will discuss in Chapter 2 and Chap- ter 3 respectively, are efficient for

We construct a multiscale scheme based on the heterogeneous multiscale method, which can compute the correct coarse behavior of wave pulses traveling in the medium, at a

Furthermore, the project will provide insight on the values expressed by minority groups both in their use of social services (do they have different demands on welfare systems?),