2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)
INTERFACING OF MEMS MOTION SENSOR WITH FPGA USING I2C PROTOCOL Dr.R.Shantha Selva Kumari
C.Gayathri
Senior Professor and Head, Dept of ECE Mepco Schlenk Engineering College Sivakasi, Tamil Nadu, India
[email protected]
Abstract - I 2C abbr eviation is I nter Integr ated Cir cuit. I t is a ser ial bus pr otocol found by Philips Semiconductor . I 2C bus is popular because it is simple to use. I 2C pr otocol is used for communicating low speed devices to pr ocessor s. I t is used to enable the faster device to communicate with slower devices without any data loss. I 2C bus contr oller inter faces the master and slave devices. FPGA acts as a master and M EM S motion sensor (1TG MPU 6050) acts as a slave. MEMS motion sensor data is passed to the FPGA using I 2C pr otocol. M EM S motion sensor has 16-bit ADCs for digitizing the acceler ometer outputs. I 2C bus on FPGA gives mor e simplicity because it r equir es only two wires and less number of pin connections. Hence in this paper we ar e going to design an I 2C bus pr otocol using Ver ilog code which inter faces FPGA boar d with MEMS motion sensor . Noisy data fr om the M EMS motion sensor is denoised by using haar wavelet coefficients.
PG Student, Dept of ECE Mepco Schlenk Engineering College Sivakasi, Tamil Nadu, India
[email protected]
passed from the slave to the master. Noisy data from the sensor is removed by using haar wavelet transform technique. II. I2C SPECIFICATION I2C is a serial data transfer bus, it is 8 bit oriented . By using two signal lines data transmission is done. The two signal lines are SCL and SDA. SCL is the Serial clock line, it is unidirectional line and SDA is a Serial data line, it is bidirectional line , both lines are used to transfer the data between Master and Slave. There are lots of slave devices are connected onto the I2C bus, Slave devices are identified by its unique 7 bit address. After each data transfer there is acknowledgment bit sent by slave to master or vice versa, to ensure the data is received.
I ndex Terms— FPGA, MEMS, I 2C
I. INTRODUCTION Nowadays, more number of serial data transfer protocols is used for interfacing high speed and low speed peripherals. The serial data communication protocols require more number of pin connections in the IC (Integrated Circuit). In this smart world, in order to reduce the size of the device , physical size of IC have to be decreased, so we require less number of pin connection for serial data transfer. Most of the serial data transmissions are all just ‘ one point to one point’ data transfer bus systems. They use multiplexing of the data path and forwarding of messages to service multiple devices, so connection become more complex. In order to reduce the more number of pin connections, the I2C protocol was introduced by Phillips [8]. I2C protocol requires only two lines for communication with two or more devices and it can control a network of device chips with just a two general purpose I/O pins whereas, other bus protocols require more pins to connect devices. In this proposed system, we are using I2C bus protocol for interfacing low speed peripheral [10] (MEMS motion sensor) devices on FPGA. I2C protocol is the best bus for the control applications, where devices may have to be added or removed from the system. In the proposed system FPGA acting as a Master controller and the MEMS muscle motion sensor (1TG MPU 6050 accelerometer) acting as the slave. Data is
III. DATA TRANSFER I2C bus has three conditions namely, idle, start and stop conditions. Three conditions are indicated by using two lines namely, SDA and SCL. When I2C bus is an idle mode, both the lines are high. Master gives the begin condition, which is SDA line makes a move from high to low while SCL line is high is appeared in Fig. 1(a). After the start condition I2C bus is busy. The transmitting device continuously sends the data, after getting proper acknowledgement from the receiving device. After sending all the data, master provides the stop condition which is SDA line makes a transition from low to high while SCL line is high is shown in Fig. 1(b)
SDA
SDA SCL
SCL Fig. 1(a) START condition Fig. 1(b) STOP condition
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)
IV. PROPOSED ARCHITECTURE
acknowledgement from the slave for each byte received. In order to stop the data transmission master generate the stop condition.
SDA
C.Master receiver mode In master receiver mode, MEMS motion sensor serially transmits the data on the SDA line, while the serial clock is input on SCL line. This serial data transfer, beginning and end are identified by using START and STOP conditions. When the start condition is generated by the FPGA, address byte is said to be the first byte received by the MEMS motion sensor. .
I2C Master controller bus in FPGA (Virtex 5)
M aster
MEMS motion sensor (1TG MPU 6050)
SCL
Slave
Fig. 2 Interfacing of FPGA with MEMS motion sensor I Fig. 2 shown consists of FPGA board and MEMS motion sensor [9]. MEMS sensor sense the vibration [1] and the value will be read by the master by using I2C protocol, it contains noise and it is processed [6] to remove the noise. The SCL and SDA lines are used to provide connection between Master and Slave. These lines are connected to power supply using pull up resistor and these resistor values depends on number of slave devices connected to master, so if the number of slave device increase the resistor value decreases.
Fig. 4 Master receiver mode The slave address denoted by 7-bit (1000100), which is followed by the direction bit (R/ w).The direction bit 0 is for read operation and 1 is for write operation. After receiving and decoding the address byte, the MEMS motion sensor sends the acknowledgement on the SDA line. The MEMS motion sensor then begins to transmit data to the FPGA starting with the register address pointed by the register pointer.
V. I2C MODES OF OPERATION There are two modes of operation are present in the I2C protocol, which are master transmitter mode and master receiver mode. The Master transmitter and receiver mode is shown in Fig. 3 and Fig. 4. The FPGA controller starts the data transmission and can drive both SDA and SCL lines, MEMS motion sensor is addressed by the FPGA. Master and slave send the data only on the SDA line. A. Master transmitter mode
Fig. 3 Master transmitter mode In master transmission mode , the master have to start the data transmission, so it generate the start sequence to initiate the data transmission. Master needs to get the data from the slave so; it sends the slave address to the SDA line followed by the direction bit (0 or 1). If the slave address matches, address which is sent by the master, slave gives an acknowledgement to the master. After getting acknowledgement from the slave, master send the register address, it is used to set the register pointer on the slave. Then the master continuously transmit the data after getting
V1.I2C ALGORITHM STEPS Finite State Machine (FSM) concept is used to implement a I2C master controller [7] in FPGA using Verilog HDL. The states of the FSM is given below. State 1: It is an idle condition, so I2C bus is not performed any operation. (SCL and SDA remains high). State 2: I2C Protocol data transmission is started by the master by providing START condition (SCL is high and SDA is from high to low). State 3: Master sends the Slave address (1000100) to the slave on the SDA line. State 4: If the address of the master and the slave matches, slave sends an acknowledgement to the master as a response. State 5: Master sends the 8 bit Register Address to the slave on the SDA line. Again acknowledges the master by the slave by pulling SDA line is low. State 6: For performing read operation, write operation is performed first and then read operation is done. State 7: For performing read operation, Master transmits a slave address to the slave. Slave address for read is 100010001 State 8: Master receives the data from the slave and acknowledges the slave. State 9: Master sends a STOP bit to terminate the connection (SCL is high and SDA is from Low to high).
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)
VII .MEMS MOTION SENSOR (1TG MPU 6050) The three axes accelerometer [2] acts as a MEMS motion sensor. MEMS motion sensor is shown in Fig. 5 and pin description in shown in table 1 Features Three-axis MEMS accelerometer[3] sensor with 16-bit ADCs and signal conditioning I2C bus MEMS technology Packaging size :4x4x0.9mm Operating current:500 A 400kHz Fast ModeI2C
• • • • •
Digital data from the MEMS motion sensor [4] is given to the both low pass and high pass filter. The low pass and high pass filter architecture is shown in Fig. 7(a) and Fig. 7(b). The low pass filter and high pass filters produce the approximation coefficients and detailed coefficients respectively.
2
LPF
X1(n)
X (n)
HPF
2
X2(n)
Fig. 6 Wavelet transform A. Low pass filter Architecture X (n)
X b0=0.7071
Fig. 5 MEMS motion sensor
X b1=0.7071
Y (n)
+
TABLE.1 PIN DESCRIPTION OF 1TG MPU
Fig. 7(a) Low pass filter architecture PIN
DESCRIPTI ON
VCC
SupplyVoltage
GND
Ground
SCL
Serial Clock Line
SDA
Serial Data Line
XDA
Auxiliary Data Line
XCL
Auxiliary Clock Line
AD0
Selects between I2C address 0x68 and 0x69
INT
Interrupt
B.High pass filter architecture
(2.375 v – 3.46v)
VIII.WAVELET TRANSFORM Data from the MEMS motion sensor is read out by using I2C protocol, which contains noise, is denoised by using haar wavelet transform technique [5]. The architecture for the wavelet transform is shown in Fig. 6.
X (n)
X
X b0= -0.7071
b1=0.7071
Y (n)
+ Fig. 7(b) High pass filter Architecture C.Thresholding Thresholding is applied to the detailed coefficients by using donoho thresholding formula is find in equation(1) Threshold=variance* 2log ( ) ----------- (1) D.Inverse wavelet transform After thresholding, by applying inverse wavelet transform noiseless data is obtained. Inverse wavelet transform architecture is shown in Fig. 8.
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)
X 1(n)
2
LPF X(n)
MEMS motion sensor output contains noise; it is removed by using haar filter coefficients. Low pass filter output is shown in Fig. 11
+ X 2(n)
2
output
HPF
Input
Fig. 8 Inverse wavelets transform IX. RESULTS AND DISCUSSION I2C protocol works with 400 KHZ, in order to synchronize MEMS motion sensor with FPGA. I2C Master Controller clock is generated with 400KHZ. Digitalized data from the MEMS motion sensor is read out by using I2C protocol. Modelsim simulation result for I2C protocol is shown in Fig. 9.
Fig.11 Low pass filter output The simulation output for High pass filter (with haar filter coefficients) is shown in Fig. 12
output
Input
Fig.12 High pass filter output Fig. 9 I2C protocol output MEMS motion sensor provide I2C and SPI type of serial communication. Due to advantage of I2C protocol , it is used to read the MEMS motion sensor data. By using I2C protocol, FPGA read the sensor data which contains noise. Modelsim simulation result of noisy data of MEMS motion sensor is shown in Fig. 10.
Fig. 10 MEMS motion sensor data with noise
MEMS motion sensor data is denoised by using haar wavelet coefficients. Denoised data output is shown in Fig. 13.
Fig. 13 Denoised data output
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)
A. Device utilization summary of I2C protocol Inter Integrated circuit protocol (I2C) has been implemented in FPGA Virtex5. The number of resources required to implement a Inter Integrated circuit protocol (I2C) is shown in table.2 TABLE. 2 DEVICE UTILIZATION SUMMARY OF I2C PROTOCOL
X.CONCLUSION The FPGA is interfaced with MEMS motion sensor using I2C communication protocol. I2C specifications are flexible, can communicate with slow devices and can also use high speed mode to transfer large amount of data. Because of many advantages, I2C bus will remain as one of the most popular serial interfaces to connect integrated circuits on board. The data read out from the MEMS motion sensor is very noisy is removed by using haar wavelet transform technique. In future, the data from the MEMS motion sensor is consider as a symbol by using Morse code technique and it is display on the LCD. REFERENCES
B.RTL Schematic of I2C Protocol RTL Schematic diagram of Inter Integrated Circuit (I2C) protocol is shown in Fig. 14
Fig. 14 RTL Schematic Diagram
[1] M.Dadafshar, Accelerometer and gyroscopes sensors: operation, sensing, and applications, EDN Netw. (2014) 1– 11 (March). [2] A. Vervuurt, MEMS accelerometers target healthcare applications, Murata Electron. (2015) (last accessed: 2Nov) [3] ST, LIS331HH MEMS digital output motion sensor ultra lowpower high full-scale 3-axes nano accelerometer, Preliminary data, Oct. (2009) 1–37. [4] A.E. Badri, J.K. Sinha, A. Albarbar, A typical filter design to improve the measured signals from MEMS accelerometer, Measurement 43 (2010) 1425–1430. [5] X. Shen, M. Yao, P. Zhao, Wavelet thresholding method for accelerometers denoising under vibration, Energy Procedia 13 (2011) 6556–6561 [6] U. Meyer-Baese, Digital Signal Processing with Field Programmable Gate Arrays, Springer Berlin, Heidelberg, 2007. [7] Prof. Jai Karan Singh “Design and Implementation of I2c master controller on FPGA using VHDL,” IJET, Vol 4 No 4 AugSep2012. [8] Philips Semiconductor “ I2C Bus Specification” version2.1, January2000. [9] Pankaj Kumar Mehto, Pragya Mishra Sonu Lal, “Design and Implementation for Interfacing Two Integrated Device Using I2C Bus,” International Journal of Innovative Research in Computer and Communication Engineering, Vol. 2, Issue 3, March2013. [10] J. J Patel, B. H. Soni, “ Design and Implementation of I2c Bus Controller Using Verilog,” Journal of Information, Knowledge and Research in Electronics and Communication Engineering Nov 12 To Oct 13, Vol. 02, Issue – 02, page no. 520-52