440 likes | 455 Views
Smart Poniting & Tracking Algorithms Using Accelerometer & Gyroscope. Chapter 1. System Summary. System Summary. X,Y Or Button Click. Smart Phone (Client). PC (Server). Android Application for MEMS sensing MEMS-sensor based pointing & compensation algorithm ☞ Pointing algorithms
E N D
Smart Poniting & Tracking Algorithms Using Accelerometer & Gyroscope Chapter 1 System Summary
System Summary X,Y Or Button Click Smart Phone(Client) PC(Server) • Android Application for MEMS sensing • MEMS-sensor based pointing & compensation algorithm ☞ Pointing algorithms • Quaternion • Rodrigues ☞ Compensation algorithms • Kalman filter • Tilt compensation • Implementation of Window application for controlling mouse cursor • Implementation of Bluetooth socket communication algorithm ☞ Mouse cursor control using WinAPI function ☞Bluetooth SPP(Serial Port Profile)-based socket program
Chapter 2 Pointing algorithm (Quaternion, Rodrigues)
HID(Human Interface Device) Control channel Interrupt channel
HID – Search & Analysis • HID PROFILE with Bluetooth wireless communications • Android open source & Android platform data • http://www.hackchina.com/en/cont/16692 • HID-Mouse C++ source code • AndroMouse Desktop 2.4 • Bluetooth / Wifi HID Application • Keyboard, Mouse only touch use • http://www.youtube.com/watch?v=X0ixrshL708&feature=player_embedded
Pointing algorithm– Quaternion (1/2) Quaternion rotation – Axis conversion If above pandq are multiplied - Quaternion multiply formula
Pointing algorithm– Quaternion (2/2) User-frame : Axis that a user look ata target Body-frame : Basic axis of a device Z-axis is toward the direction to the display of a device, the above equation is basedon z-axis. If the equation is rewritten, Assume rotation occurs around z-axis. Then the followings are driven. Once we apply Quaternion the axis-conversion equation tothe above equation, we can obtain
Rotation matrix from axis and angle y p’(a’,b’) p(a,b) Trigonometrical function: Addition theorem x
Pointing algorithm– Rodrigues (1/3) 1번 식의 유도 과정을 살펴보면 아래와 같다.
Pointing algoritms– Rodrigues (2/3) Once we solve the above equation, we can obtain
Pointing algorithm– Rodrigues (3/3) Since the Rodrigues rotation-conversion matrix is for x, y, z axis, removing the part of z-axis in thematrixcan be simplified to the following2x2 matrix. Using line acceleration values taken from anaccelerometer, the following x, y axis vector can be obtained. Using values for x, y axis vectors, the following can be obtained. The variations of x and y corresponding to in displaycan be driven as a following equation using the Euler’s equation.
Comparison in processing sped(Quaternion / Rodrigues) • Comparison in required computing time ⇒ Quaternionis twice faster thanRodrigues rotation in average. • x, y variation after mapping ⇒ Quaternion provides more stable in x, y variation in case of no movement of a smart phone.
Chapter 3 Compensation algorithm (Kalman filter, Tilt compensation)
Kalman Filter Kalman filter predicts variations in states and estimates current state formeasured current noise. It can also estimate the state values similar to real states by updating covariance. Effects of Kalman filter • Minimize noise in data from accelerometer • Compensation in noise caused by hand shaking or vibration
Kalman Filter 1. Minimize noise in sensor data • Smart phone⇒ No movement • Smart phone⇒ moved Before application After application
Kalman Filter 2. Noise compensation caused by hand shaking or vibration ☞ generated when you touch the touch pad of a phone • Before and after inx axis • Before and after in y axis
Tilt compensation No compensation information inQuaternion mapping • Key point: Calculating unit vector based on periodic characteristic according to tilt of a device 9.8 Accel_Value[0] 0 - 9.8 Accel_Value[1] 0 9.8 Accel_Value[2] 0 90’ 90’ 0’ 45’ -45’
Chapter 4 Wireless Mouse for remote TV control Using Smart Phone
Project Steps STEP. 2 X,Y Or Button Click Application development and implementation < Tray Icon >
Development Details(1) Bluetooth Based Algorithm Development Enviroment • Overall structure Sender Receiver Screen Accel, Gyro Sensor User’s Input Pointing Algorithm Calibration Algorithm Bluetooth • Test Environment: AndroidOSBase smart devices with Bluetooth support • APP base algorithm processing and data display • User convenience enhancement by developing APP-type
Development Details(2) Development Enviromment Based on Bluetooth *GUI for Transmitter * GUI for Receiver Bluetooth switching - Main display Search for Bluetooth devices Bluetooth switching Display switching for test After Bluetooth connection Sensor data trans- mission/Motion recog. command Increase sensitivity Waiting for connection - Test display Decrease sensitivity Display after algorithm Processing on input data Algorithm selection
Application of tilt variation with Euler formula ACC Data ACC Data GYRO Data GYRO Data Integration Integration Mapping Mapping Matrix multiply Matrix multiply Tilt compensation Display Display
Solution of the tilt problem in right rotation • In case of right rotation, y output data is in the opposite direction.
3. Results & Experiments • Algorithm flow of the proposed pointing algorithm using sensor fusion ACC Data GYRO Data Integration Mapping < Mapping process 연산 속도 비교 > Matrix multiply Tilt compensation Display < Mapping 처리 후 x, y 변화량 비교 >
3. Results & Experiments • Tilt compensation & Hand tremor Begin Prediction on state variation Current state estimation on current input noise Continuous update on two uncertainty Estimation similar to real measured data False True End < Tilt compensation algorithm> < Algorithm flow when Kalman filters are applied>
3. Results & Experiments • Bluetooth based App-form algorithm development environment Device(Client) Android Application Host(Server) Windows Application X,Y Or Button Click <Transmission part> <Bluetooth Socket Communication>
3. Results & Experiments • Mouse cursor control in PC using Smast < Demonstration> < Simulation of Windows application>
Chapter 5 Bluetooth Socket Program
Bluetooth SPP (Serial Port Profile) • SPPis a profile to connectapplicationsto serial port. • LMP, L2CAP, SDP, RFCOMMimplementedon Baseband layer • Connect application through serial port with loadingSerial Port Emulation(or otherAPI) on firmware layer. • Bluetooth SPP UUID : 00001101-0000-1000-8000-00805F9B34FB • Max. 30-port generation possible in RFCOMM protocol.
Bluetooth socket programming • send, recv / sendto, recvfrom function for data transmission/receiving in socket communication (1) Function resources send(int sockfd, const void *buf, size_t len, int flags) recv(int sockfd, const void *buf, size_t len, int flags) sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) (2) TCP data transmission/receiving send() / recv()함수는 address를 지정할 수 없기 때문에, 연결지향 방식인 TCP 통신에서 사용된다. (물론 sendto / recvfrom도 사용 가능) ○ send(int sockfd, const void *buf, size_t len, int flags) - sockfd : 목적지의 주소 정보를 갖는 파일 디스크립터 - buf : 전송하기 위한 데이터의 포인터 - len : 데이터의 길이 - flags : 함수의 호출이 어떤 일을 할지 나타내는 플래그 - return value : 전송 성공 시 전송한 바이트 수 반환, 실패 시 –1 반환 ○ recv(int sockfd, const void *buf, size_t len, int flags) - sockfd : 접속된 소켓의 파일 디스크립터 - buf : 수신 데이터를 저장할 버퍼의 포인터 - len : 수신할 데이터의 길이 - flags : 함수의 호출이 어떤 일을 할지 나타내는 플래그 - return value : 전송 성공 시 전송한 바이트 수 반환, 실패 시 –1 반환 → 서버 측에서는 accept하여 생성된 소켓을, 클라이언트 측에서는 connect에 사용한 소켓을 이용하여 데이터를 송수신 한다.
Bluetooth socket programming (3) UDP data transm/receiving : sendto() / recvfrom()함수는 address를 지정할 수 있기 때문에, 연결지향 방식인 UDP 통신에서 사용된다. ○ sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) - sockfd : 소켓의 파일 디스크립터 - buf : 전송될 데이터를 가지고 있는 버퍼 - len : 버퍼의 데이터의 길이 - flags : 함수의 호출이 어떤 일을 할지 나타내는 플래그 - dest_addr : 데이터가 전송될 원격 호스트의 주소 - len : 주소정보 구조체의 길이(구조체의 길이를 입력 받으므로 포인터형) ○ recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t addrlen) - sockfd : 바인드된 소켓의 파일 디스크립터 - buf : 수신되는 데이터를 저장할 버퍼의 포인터 - len : 버퍼의 길이 - flags : 함수의 호출이 어떤 일을 할지 나타내는 플래그 - src_addr : 수신받은 데이터를 송신한 단말의 주소를 리턴받기 위한 버퍼 포인터 - addrlen : 주소정보 구조체의 길이(구조체의 길이를 입력 받으므로 포인터형)
Bluetooth socket programming (4) System call for data transm./receiver - write : Data transmission through stream socket - read : Data receiving through stream socket - send : data transmission(stream socket) with option - recv : data receiving(Stream 소켓) with option - sendto : data transmission through datagram socket - recvfrom : data receiving through datagram socket socket: Software medium for connecting remote two hosts ○ Socket generation int socket(int domain, int type, iont protocol) ○ Address and port assignment int bind(int sockfd, struct sockaddr *myaddr, int addrlen) ○ Waiting for connection request int listen(int sockfd, int backlog) ○ Accept for connection int accept(int sockfd, struct sockaddr *addr, int *addrlen)