WIFI를 이용한

실내 장소 인식하기

구자형

로플랫
contents
1. Indoor Location Technology

2. WIFI를 이용한 실내 위치 인식 기술

3. WIFI로 실내 장소 인식하기 실전

4. 여기 누가 있나요?
1.

Indoor

Location Technology
1.1Smartphone Sensors
1. Sound

2. Bluetooth

3. WiFi

4. Magnetic

5. Accelerometer

6. Light
1.2 Sound (20 kHz)
1.3 iBeacon (2.4 GHz)
1.4 WIFI (2.4GHz, 5GHz)
1.5 MagneticFigure 2: Magnetically ‘Fingerprinting’ a Building
SOURCE: IND
1.6 Which one?
성능, 구축비용, 확장성
2.

WIFI를 이용한

실내 위치 인식 기술
2.1 Why WiFi?
In 2014, over 2.4 billionWi-Fi enabled devices were shipped

10 billionWi-Fi enabled devices shipped cumulatively in early 2015

161 millionConsumer Wi-Fi Access Points Shipped in 2013
2.2 WIFI Access Point (AP)
BSSID AP MAC Address 0a:30:0d:88:dd:f2
SSID Network Name olleh_startbucks
RSS
Received Signal
Strength
-48 dBm
frequency 2462
2.3 WIFI Signal Propagation
distance
rss
15~20 dBm
Previous studies show that the indoor
law: σXldnPri +−= )(log10 0100
, w
strength at the distance l0 from tran
represents the shadow noise and is mo
standard deviation σ dB [Rappa96].
depends on the surrounding environm
measurement position, the distance idˆ
(2.1)
ous studies show that the indoor pathloss model follows the distance power
σXldnPri +−= )(log10 0100
, where ri is the RSS in dB, P0 the signal
th at the distance l0 from transmitter, and n the pathloss exponent. Xσ
ents the shadow noise and is modeled as a normal random variable with the
ard deviation σ dB [Rappa96]. Typically, l0 is set to 1 m. The value of n
ds on the surrounding environments. Given the measurement ri at the ith
urement position, the distance idˆ from AP can be estimated as:
(2.2)
2.3 WIFI Signal Propagation
(a) HTC Hero
(b) Motorola DroidX
2.4 WIFI APs
-40
-65
-85
AP1
AP3
AP2
2.5 삼변측량/삼각측량 법
(x1, y1)
(x2, y2)
(x3, y3)
(x’, y’)
5m
10m
15m
2.6 Fingerprinting
2.6 Fingerprinting
?
?
?
(x1, y1)
-40
-65
-85
(x2, y2)(x3, y3)
3.

WIFI로 장소 인식하기

실전
3.1 Mute.ly
periodic wifi scan
3.2 WIFI Scan
3.3 Android WIFI Scan
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

<receiver android:name=“.WifiReceiver" >

<intent-filter>

<action android:name="android.net.wifi.SCAN_RESULTS" />

</intent-filter>

</receiver>

3.3 Android WIFI Scan
final WifiManager wifi =
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);

wifi.startScan();
public class WifiReceiver extends BroadcastReceiver {
…
public void onReceive(Context context, Intent intent) {

String action = intent.getAction();

if(action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
WifiManager wifi = (WifiManager)
context.getSystemService(Context.WIFI_SERVICE);

List<ScanResult> scanResults = wifi.getScanResults();

}
}
}
3.4 WIFI Scan Allowed?
3.4 WIFI Scan Allowed?
final WifiManager wifi =
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);


boolean wifiEnabled = wifi.isWifiEnabled();

boolean wifiScanEnabled=false;



int currentapiVersion = android.os.Build.VERSION.SDK_INT;

if (currentapiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2) { // 18

wifiScanEnabled = wifi.isScanAlwaysAvailable();

}
3.5 Android WIFI OFF
final WifiManager wifi =
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);


wifi.setWifiEnabled(true);
wifi.startScan();
wifi.setWifiEnabled(false);
==> WIFI ON 이 되지 않는 현상 발생

==> LG G2의 경우 2.4GHz 대역만 scan 되는 현상 발생

==> 생각보다 큰 power 소모가 발생한다
3.6 Android Background Service
장소를 monitoring하고 있는 서비스는

계속 죽었다 살아났다 함

—―> 모든 status 변수는 non-volatile 메모리로 관리
3.7 Similarity Measure (Tanimoto)
AB

|| A ||2 + || B ||2 - AB
T(A, B) =
3.7 Similarity Measure (Tanimoto)
scan1 scan2 scan1’ scan2’
AP1 -50 -45 40 45
AP2 -69 -75 21 15
AP3 -85 5 0
||S1||^2 = 40*40 + 21*21 + 5*5 = 2066

||S2||^2 = 45*45 + 15*15 + 0*0 = 2250

S1*S2 = 40*45 + 21*15 + 5*0 = 2115
2115

2066 + 2250 - 2115
= 0.96
3.7 Similarity Measure (Cosine)
2115

sqrt(2066) * sqrt(2250)
= 0.98
A B

|| A || || B ||
cos(A, B) =
So Easy?
3.8 So Easy?
time —―>
signal strength
-30
-90
3.8 So Easy?
‘android’

‘iphone’

‘ollehegg’

…
3.8 So Easy?
02:e0:83:54:70:9X
3.8 So Easy?
WIFI AP 4개

vs.

WIFI AP 40개
3.8 So Easy?
wifi no similarity
3 0.81
2 0.24
3 0.76
3 0.58
3 0.63
3 0.41
3 0.66
3 0.29
3 0.67
4 0.39
4 0.65
0
0.25
0.5
0.75
1
0
2
4
3.8 So Easy?
30 (Galaxy S3) vs. 50 (Galaxy S5)

10명 vs. 100명

…
3.9 실제 deploy 해서 검증해 보기
Mute.ly 를 통해서 오류보고하기 넣기

그래서.. 오류 받기...
3.9 실제 deploy 해서 검증해 보기
로그를 분석해서

오류사항 개선하기
4.

여기 누가 있나요?
4.1 구조
4.1 To the Cloud
스캔

그리고 Cloud로
4.2 Similarity Measure in Cloud
모든 스캔을 다 비교?
Q&A
johnkoo@loplat.com
Thank You
Scalable & Cost-effective

Indoor Location Platform

[242] wifi를 이용한 실내 장소 인식하기

  • 1.
    WIFI를 이용한 실내 장소인식하기 구자형 로플랫
  • 3.
    contents 1. Indoor LocationTechnology 2. WIFI를 이용한 실내 위치 인식 기술 3. WIFI로 실내 장소 인식하기 실전 4. 여기 누가 있나요?
  • 4.
  • 5.
    1.1Smartphone Sensors 1. Sound 2.Bluetooth 3. WiFi 4. Magnetic 5. Accelerometer 6. Light
  • 6.
  • 7.
  • 8.
  • 9.
    1.5 MagneticFigure 2:Magnetically ‘Fingerprinting’ a Building SOURCE: IND
  • 10.
    1.6 Which one? 성능,구축비용, 확장성
  • 11.
  • 13.
    2.1 Why WiFi? In2014, over 2.4 billionWi-Fi enabled devices were shipped 10 billionWi-Fi enabled devices shipped cumulatively in early 2015 161 millionConsumer Wi-Fi Access Points Shipped in 2013
  • 15.
    2.2 WIFI AccessPoint (AP) BSSID AP MAC Address 0a:30:0d:88:dd:f2 SSID Network Name olleh_startbucks RSS Received Signal Strength -48 dBm frequency 2462
  • 16.
    2.3 WIFI SignalPropagation distance rss 15~20 dBm Previous studies show that the indoor law: σXldnPri +−= )(log10 0100 , w strength at the distance l0 from tran represents the shadow noise and is mo standard deviation σ dB [Rappa96]. depends on the surrounding environm measurement position, the distance idˆ (2.1) ous studies show that the indoor pathloss model follows the distance power σXldnPri +−= )(log10 0100 , where ri is the RSS in dB, P0 the signal th at the distance l0 from transmitter, and n the pathloss exponent. Xσ ents the shadow noise and is modeled as a normal random variable with the ard deviation σ dB [Rappa96]. Typically, l0 is set to 1 m. The value of n ds on the surrounding environments. Given the measurement ri at the ith urement position, the distance idˆ from AP can be estimated as: (2.2)
  • 17.
    2.3 WIFI SignalPropagation (a) HTC Hero (b) Motorola DroidX
  • 18.
  • 19.
    2.5 삼변측량/삼각측량 법 (x1,y1) (x2, y2) (x3, y3) (x’, y’) 5m 10m 15m
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
    3.3 Android WIFIScan <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
 <receiver android:name=“.WifiReceiver" >
 <intent-filter>
 <action android:name="android.net.wifi.SCAN_RESULTS" />
 </intent-filter>
 </receiver>

  • 26.
    3.3 Android WIFIScan final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
 wifi.startScan(); public class WifiReceiver extends BroadcastReceiver { … public void onReceive(Context context, Intent intent) {
 String action = intent.getAction();
 if(action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
 List<ScanResult> scanResults = wifi.getScanResults();
 } } }
  • 27.
    3.4 WIFI ScanAllowed?
  • 28.
    3.4 WIFI ScanAllowed? final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); 
 boolean wifiEnabled = wifi.isWifiEnabled();
 boolean wifiScanEnabled=false;
 
 int currentapiVersion = android.os.Build.VERSION.SDK_INT;
 if (currentapiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2) { // 18
 wifiScanEnabled = wifi.isScanAlwaysAvailable();
 }
  • 29.
    3.5 Android WIFIOFF final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); 
 wifi.setWifiEnabled(true); wifi.startScan(); wifi.setWifiEnabled(false); ==> WIFI ON 이 되지 않는 현상 발생 ==> LG G2의 경우 2.4GHz 대역만 scan 되는 현상 발생 ==> 생각보다 큰 power 소모가 발생한다
  • 30.
    3.6 Android BackgroundService 장소를 monitoring하고 있는 서비스는 계속 죽었다 살아났다 함 —―> 모든 status 변수는 non-volatile 메모리로 관리
  • 31.
    3.7 Similarity Measure(Tanimoto) AB || A ||2 + || B ||2 - AB T(A, B) =
  • 32.
    3.7 Similarity Measure(Tanimoto) scan1 scan2 scan1’ scan2’ AP1 -50 -45 40 45 AP2 -69 -75 21 15 AP3 -85 5 0 ||S1||^2 = 40*40 + 21*21 + 5*5 = 2066 ||S2||^2 = 45*45 + 15*15 + 0*0 = 2250 S1*S2 = 40*45 + 21*15 + 5*0 = 2115 2115 2066 + 2250 - 2115 = 0.96
  • 33.
    3.7 Similarity Measure(Cosine) 2115 sqrt(2066) * sqrt(2250) = 0.98 A B || A || || B || cos(A, B) =
  • 34.
  • 35.
    3.8 So Easy? time—―> signal strength -30 -90
  • 36.
  • 37.
  • 38.
    3.8 So Easy? WIFIAP 4개 vs. WIFI AP 40개
  • 39.
    3.8 So Easy? wifino similarity 3 0.81 2 0.24 3 0.76 3 0.58 3 0.63 3 0.41 3 0.66 3 0.29 3 0.67 4 0.39 4 0.65 0 0.25 0.5 0.75 1 0 2 4
  • 40.
    3.8 So Easy? 30(Galaxy S3) vs. 50 (Galaxy S5) 10명 vs. 100명 …
  • 41.
    3.9 실제 deploy해서 검증해 보기 Mute.ly 를 통해서 오류보고하기 넣기 그래서.. 오류 받기...
  • 42.
    3.9 실제 deploy해서 검증해 보기 로그를 분석해서 오류사항 개선하기
  • 43.
  • 44.
  • 45.
    4.1 To theCloud 스캔 그리고 Cloud로
  • 46.
    4.2 Similarity Measurein Cloud 모든 스캔을 다 비교?
  • 47.
  • 48.
    Thank You Scalable &Cost-effective Indoor Location Platform