You are on page 1of 5

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 PG Student, Dept of ECE
Mepco Schlenk Engineering College Mepco Schlenk Engineering College
Sivakasi, Tamil Nadu, India Sivakasi, Tamil Nadu, India
rshantha@mepcoeng.ac.in csgkgayumay27@gmail.com

Abstract - I2C abbreviation is Inter Integrated Circuit. It is a passed from the slave to the master. Noisy data from the sensor
serial bus protocol found by Philips Semiconductor. I2C bus is is removed by using haar wavelet transform technique.
popular because it is simple to use. I2C protocol is used for
communicating low speed devices to processors. It is used to
enable the faster device to communicate with slower devices II.I2C SPECIFICATION
without any data loss. I2C bus controller interfaces the master
and slave devices. FPGA acts as a master and MEMS motion
I2C is a serial data transfer bus, it is 8 bit oriented . By using
sensor (1TG MPU 6050) acts as a slave. MEMS motion sensor two signal lines data transmission is done. The two signal lines
data is passed to the FPGA using I2C protocol. MEMS motion are SCL and SDA. SCL is the Serial clock line, it is
sensor has 16-bit ADCs for digitizing the accelerometer outputs. unidirectional line and SDA is a Serial data line, it is
I2C bus on FPGA gives more simplicity because it requires only bidirectional line , both lines are used to transfer the data
two wires and less number of pin connections. Hence in this between Master and Slave. There are lots of slave devices are
paper we are going to design an I2C bus protocol using Verilog connected onto the I2C bus, Slave devices are identified by its
code which interfaces FPGA board with MEMS motion sensor. unique 7 bit address. After each data transfer there is
Noisy data from the MEMS motion sensor is denoised by using acknowledgment bit sent by slave to master or vice versa, to
haar wavelet coefficients.
ensure the data is received.
Index Terms— FPGA, MEMS, I2C
III.DATA TRANSFER
I.INTRODUCTION I2C bus has three conditions namely, idle, start and stop
conditions. Three conditions are indicated by using two lines
Nowadays, more number of serial data transfer protocols namely, SDA and SCL. When I2C bus is an idle mode, both
is used for interfacing high speed and low speed peripherals. the lines are high. Master gives the begin condition, which is
The serial data communication protocols require more number SDA line makes a move from high to low while SCL line is
of pin connections in the IC (Integrated Circuit). In this smart high is appeared in Fig. 1(a). After the start condition I2C bus
world, in order to reduce the size of the device , physical size is busy. The transmitting device continuously sends the data,
of IC have to be decreased, so we require less number of pin after getting proper acknowledgement from the receiving
connection for serial data transfer. Most of the serial data device. After sending all the data, master provides the stop
transmissions are all just ‘one point to one point’ data transfer condition which is SDA line makes a transition from low to
bus systems. They use multiplexing of the data path and high while SCL line is high is shown in Fig. 1(b)
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 SDA SDA
introduced by Phillips [8]. I2C protocol requires only two lines
for communication with two or more devices and it can control SCL
a network of device chips with just a two general purpose I/O
SCL
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 Fig. 1(a) START condition Fig. 1(b) STOP condition
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

‹,(((
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.

I2C Master SDA MEMS C.Master receiver mode


controller motion In master receiver mode, MEMS motion sensor serially
bus in sensor (1TG transmits the data on the SDA line, while the serial clock is
FPGA MPU 6050) input on SCL line. This serial data transfer, beginning and end
(Virtex 5) SCL
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.
.
Master 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 Fig. 4 Master receiver mode
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 The slave address denoted by 7-bit (1000100), which is
SDA lines are used to provide connection between Master and followed by the direction bit (R/ w).The direction bit 0 is for
Slave. These lines are connected to power supply using pull up read operation and 1 is for write operation. After receiving
resistor and these resistor values depends on number of slave and decoding the address byte, the MEMS motion sensor
devices connected to master, so if the number of slave device sends the acknowledgement on the SDA line. The MEMS
increase the resistor value decreases. 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 V1.I2C ALGORITHM STEPS
protocol, which are master transmitter mode and master
receiver mode. The Master transmitter and receiver mode is Finite State Machine (FSM) concept is used to implement a
shown in Fig. 3 and Fig. 4. The FPGA controller starts the data I2C master controller [7] in FPGA using Verilog HDL. The
transmission and can drive both SDA and SCL lines, MEMS states of the FSM is given below.
motion sensor is addressed by the FPGA. Master and slave State 1: It is an idle condition, so I2C bus is not performed
send the data only on the SDA line. any operation. (SCL and SDA remains high).
State 2: I2C Protocol data transmission is started by the
A. Master transmitter mode 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
Fig. 3 Master transmitter mode slave by pulling SDA line is low.
State 6: For performing read operation, write operation is
In master transmission mode , the master have to start the performed first and then read operation is done.
data transmission, so it generate the start sequence to State 7: For performing read operation, Master transmits a
initiate the data transmission. Master needs to get the data slave address to the slave. Slave address for read is
from the slave so; it sends the slave address to the SDA line 100010001
followed by the direction bit (0 or 1). If the slave address State 8: Master receives the data from the slave and
matches, address which is sent by the master, slave gives an acknowledges the slave.
acknowledgement to the master. After getting State 9: Master sends a STOP bit to terminate the connection
acknowledgement from the slave, master send the register (SCL is high and SDA is from Low to high).
address, it is used to set the register pointer on the slave. Then
the master continuously transmit the data after getting
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)

VII .MEMS MOTION SENSOR (1TG MPU 6050) Digital data from the MEMS motion sensor [4] is given to the
The three axes accelerometer [2] acts as a MEMS motion both low pass and high pass filter. The low pass and high pass
sensor. MEMS motion sensor is shown in Fig. 5 and pin filter architecture is shown in Fig. 7(a) and Fig. 7(b). The low
description in shown in table 1 pass filter and high pass filters produce the approximation
Features coefficients and detailed coefficients respectively.
• Three-axis MEMS accelerometer[3] sensor
with 16-bit ADCs and signal conditioning
• I2C bus LPF 2 X1(n)
• MEMS technology Packaging size :4x4x0.9mm
• Operating current:500ȝA X (n)
• 400kHz Fast ModeI2C
HPF 2
X2(n)

Fig. 6 Wavelet transform


A. Low pass filter Architecture

X (n)
ܼെͳ

X X
b0=0.7071 b1=0.7071 Y (n)
Fig. 5 MEMS motion sensor
TABLE.1 PIN DESCRIPTION OF 1TG MPU +
Fig. 7(a) Low pass filter architecture
PIN DESCRIPTION
B.High pass filter architecture
VCC SupplyVoltage (2.375 v – 3.46v)

X (n) ܼെͳ
GND Ground

SCL Serial Clock Line


X X
SDA Serial Data Line b0= -0.7071 b1=0.7071 Y (n)

XDA Auxiliary Data Line +


Fig. 7(b) High pass filter Architecture
XCL Auxiliary Clock Line

AD0 Selects between I2C address 0x68 and 0x69 C.Thresholding

INT Interrupt Thresholding is applied to the detailed coefficients by


using donoho thresholding formula is find in equation(1)
VIII.WAVELET TRANSFORM Threshold=variance*¥2log (݊) ----------- (1)
Data from the MEMS motion sensor is read out by using I2C D.Inverse wavelet transform
protocol, which contains noise, is denoised by using haar
wavelet transform technique [5]. The architecture for the After thresholding, by applying inverse wavelet
wavelet transform is shown in Fig. 6. 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)

MEMS motion sensor output contains noise; it is removed


X1(n)
by using haar filter coefficients. Low pass filter output is
2 LPF
shown in Fig. 11
X(n)

+
X2(n)
2 HPF output

Input
Fig. 8 Inverse wavelets transform

IX. RESULTS AND DISCUSSION


I2C protocol works with 400 KHZ, in order to synchronize Fig.11 Low pass filter output
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. The simulation output for High pass filter (with haar filter
Modelsim simulation result for I2C protocol is shown in Fig. coefficients) is shown in Fig. 12
9.

output

Input

Fig.12 High pass filter output


Fig. 9 I2C protocol output
MEMS motion sensor data is denoised by using haar
MEMS motion sensor provide I2C and SPI type of serial
wavelet coefficients. Denoised data output is shown in Fig.
communication. Due to advantage of I2C protocol , it is used
to read the MEMS motion sensor data. By using I2C 13.
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. 13 Denoised data output


Fig. 10 MEMS motion sensor data with noise
2017 International Conference on Innovations in Information Embedded and Communication Systems (ICIIECS)

A. Device utilization summary of I2C protocol X.CONCLUSION


Inter Integrated circuit protocol (I2C) has been The FPGA is interfaced with MEMS motion sensor using
implemented in FPGA Virtex5. The number of resources I2C communication protocol. I2C specifications are flexible,
required to implement a Inter Integrated circuit protocol (I2C) can communicate with slow devices and can also use high
is shown in table.2 speed mode to transfer large amount of data. Because of
many advantages, I2C bus will remain as one of the most
TABLE. 2 DEVICE UTILIZATION SUMMARY OF I2C PROTOCOL 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

[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 low-
power 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
B.RTL Schematic of I2C Protocol controller on FPGA using VHDL,”IJET, Vol 4 No 4 Aug-
Sep2012.
RTL Schematic diagram of Inter Integrated Circuit (I2C)
[8] Philips Semiconductor “I2C Bus Specification” version2.1,
protocol is shown in Fig. 14 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

Fig. 14 RTL Schematic Diagram

You might also like