Over-The-Air-Activation (OTAA)- the most secure activation method for end devices. Devices perform a join procedure with the network, during which a dynamic device address is assigned and security keys are negotiated with the device.
Activation By Personalization (ABP)- requires hardcoding the device address as well as the security keys in the device. ABP isless securethan OTAA and also has the downside that devices can not switch network providers without manually changing keys in the device.
OTAA와 ABP의 차이는 인증방식이다.
ABP는 사전에 Application_Key, Network_Key를 가지고, 하나의 채널을 Default로 고정하여 사용한다. 그러므로 Join_Request, Join_Accept 과정이 필요하지 않는다.
반면 OTAA는 ABP와 달리 네트워크 첫 진입 시 Join_Request, Join_Accept 를 주고 받으며, 인증을 받는다. 아래 그림은 OTAA 메세지 흐름을 설명한다.
End_Device가 Join_Request 메세지를 업링크(Up_Link)한다. Application_Server가 Join_Request에 대한 세션 키를 생성하면 Join_Accept 메세지를 End_Device로 다운링크(Down_Link)한다. (이는 기본적으로 Class_A로, End_Device 주도방식이다.)
여기서 Join_Accept 메세지 안의 CFList가 중요하다.
CFList(16bytes)– contains the optional list of channel frequencies to be used for the end device
Join_Accept 메세지 안에는 End_Device가 Channel_Frequency를 사용할 CFList가 들어 있다. 여기서 ABP와 큰 차이점을 가진다. ABP는 하나의 Channel_Frequency를 사용한다면, OTAA는 CFList를 통해 Channel_Frequency가 바뀐다.
( 위 CodeVision Evaluation을 설치하시면 드라이버가 자동으로 설치됩니다. )
블루투스 모듈 블루투스4.0 BLE 모듈 (DIP) [SZH-BTBA-002]를 사용했습니다.
스마트폰 어플은 nRF Connect for Mobile을 사용했습니다. (Android)
Kut-128_comm_board
CodeVision Evaulation
블루투스 4.0 BLE 모듈 (DIP) [SZH-BTBA-002]
nRF Connect for Mobile
보드는 위 매뉴얼(. pdf)을 참고하면 됩니다.
첫 번째 글은 블루투스 모듈의 동작에 대해 설명하겠습니다.
블루투스의 무선 통신은 4핀만 있으면 됩니다. 하지만 연결 해제 등 다양한 동작을 위해 STATE 단자와 EN 단자도 같이 사용하겠습니다.
통신을 위한 RX(Receive : 수신), TX(Transport : 송신)
전원을 위한 VCC(5V), GND
블루투스의 연결 상태를 확인하기 위한 출력부 STATE
블루투스가 다른 기기와 연결되어 있을 때, 강제로 끊기 위한 입력부 EN
VCC: input power supply 3.3~6V, Prohibit more than 7V GND: Ground TX: transport RX: receive State: when bluetooth is connected , output "High level", "no conntected" output "low level" en:when module is connected, give a high level to "EN",the module will disconnected
이 포스팅은 두 편을 걸쳐 진행됩니다. ( 1편 : 오픈소스 데이터셋 전처리, 2편 : 논문 기반 네트워크를 통해 학습 )
Doctor Klemen Bregar providingthe UWB NLOS/LOS open source data를 딥러닝을 위해 전처리 과정이 필요합니다.
오픈소스는 csv, 데이터를 불러오는 모듈로 구성되어 있습니다.
4년 전 데이터이므로 pandas 버전 오류 해결을 위해 uwb_dataset.py를 약간 변경했습니다.
uwb_dataset.py
"""
Created on Feb 6, 2017
@author: Klemen Bregar
"""
import os
import pandas as pd
from numpy import vstack
def import_from_files():
"""
Read .csv files and store data into an array
format: |LOS|NLOS|data...|
"""
rootdir = '../dataset/'
output_arr = []
first = 1
for dirpath, dirnames, filenames in os.walk(rootdir):
for file in filenames:
filename = os.path.join(dirpath, file)
print(filename)
output_data = []
# read data from file
df = pd.read_csv(filename, sep=',', header=0)
# ------------------------ update Mar 3, 2021 ----------------------------- #
columns_name = df.columns.values
# ------------------------ update Mar 3, 2021 ----------------------------- #
# ------------------------ update Mar 3, 2021 ----------------------------- #
# input_data = df.as_matrix()
# df.as_matrix() was depriciated after the version 0.23.0 use df.values()
input_data = df.values
# ------------------------ update Mar 3, 2021 ----------------------------- #
# append to array
if first > 0:
first = 0
output_arr = input_data
else:
output_arr = vstack((output_arr, input_data))
return columns_name, output_arr
if __name__ == '__main__':
# import raw data from folder with dataset
print("Importing dataset to numpy array")
print("-------------------------------")
data = import_from_files()
print("-------------------------------")
# print dimensions and data
print("Number of samples in dataset: %d" % len(data))
print("Length of one sample: %d" % len(data[0]))
print("-------------------------------")
print("Dataset:")
print(data)
1. Load UWB data
import numpy as np
import pandas as pd
import uwb_dataset
# import raw data
data = uwb_dataset.import_from_files()
# divide CIR by RX preable count (get CIR of single preamble pulse)
# item[2] represents number of acquired preamble symbols
for item in data:
item[15:] = item[15:]/float(item[2])
print("\nColumns :", columns.shape, sep=" ")
print("Data :", data.shape, sep=" ")
print(type(data))
# LOS/NLOS Count
los_count = df_uwb.query("NLOS == 0")["NLOS"].count()
nlos_count = df_uwb.query("NLOS == 1")["NLOS"].count()
print("Line of Sight Count :", los_count)
print("Non Line of Sight Count :", nlos_count)
# Columns CIR Extract
df_uwb_data = df_uwb[["CIR"+str(i) for i in range(cir_n)]]
print("UWB DataFrame X for Trainndarray shape : ",df_uwb_data.values.shape)
df_uwb_data.head(5)
Columns : Sampling 1016 CIR
LOS : 21000, NLOS : 21000 Pandas Dataframe
다음 글은 생선된 위 데이터 프레임을 이용해 논문에 제시된 CNN+LSTM 모델을 Pytorch로 구현하겠습니다.