0% found this document useful (0 votes)
3 views14 pages

Sensor Interfacing

The document outlines a course on Embedded Programming for Telecommunication at Vivekanand Education Society’s Institute of Technology, focusing on hands-on experience with Raspberry Pi and Xilinx FPGA boards. It details course objectives, outcomes, and lab projects aimed at developing real-world applications and teamwork skills. Key components include sensor interfacing, communication protocols, and a capstone project demonstrating embedded system design and development.

Uploaded by

sohammayekar635
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views14 pages

Sensor Interfacing

The document outlines a course on Embedded Programming for Telecommunication at Vivekanand Education Society’s Institute of Technology, focusing on hands-on experience with Raspberry Pi and Xilinx FPGA boards. It details course objectives, outcomes, and lab projects aimed at developing real-world applications and teamwork skills. Key components include sensor interfacing, communication protocols, and a capstone project demonstrating embedded system design and development.

Uploaded by

sohammayekar635
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Vivekanand Education Society’s

Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

LAB -II : EMBEDDED PROGRAMMING FOR


TELECOMMUNICATION

Skill Lab -II : Embedded Programming for Telecommunication Report + LAB

Course Prerequisite: Microprocessor and Microcontrollers, Digital VLSI, Skill Lab -1:
Telecommunication software Tools lab
Course Objectives:
1 Provide hands-on experience with Raspberry Pi and Xilinx FPGA boards.
2 Teach embedded programming, FPGA design, and sensor interfacing.
3 Enable students to develop real-world applications using embedded systems.
4 Foster teamwork and problem-solving skills through a capstone project.

Course Outcomes:
After successful completion of the course students will be able :
1 Design and implement embedded systems using Raspberry Pi and Xilinx SDK with FPGA
boards.
2 Interface sensors and peripherals using communication protocols like I2C, SPI, and UART.
3 Develop FPGA-based systems using the MicroBlaze soft-core processor.
4 Build real-time embedded applications integrating hardware and software.
5 Complete a capstone project demonstrating end-to-end embedded system design and
development.
6 Design and implement embedded systems using Raspberry Pi and Xilinx SDK kit with FPGA
boards.
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Skill Lab -II : Embedded Programming for Telecommunication Project + LAB

LAB NO. LAB + Project development Ma


rks

1 Introduction to Embedded Systems and Tools: 5


Objective: Project Name

Specification :
I. Introduction to Raspberry Pi and Xilinx SDK with Boolean FPGA boards.
a. Setting up development environments
b. Raspberry Pi: Raspbian OS, Python, and C programming.
c. Xilinx SDK: Vivado IDE, FPGA programming flow.
d. GPIO interfacing required on boards.
e. Protocol Required: UART and I2C

2 Embedded Programming with Raspberry Pi 5


Objective Sensor Interfacing sensors/ actuators using Raspberry Pi.

Specification:
I. Programming Language: Python
II. Interfacing of UART for data reception from FPGA.
III. Virtual environment setup

3 FPGA MicroBlaze Interfacing with I2C Protocols 5


Objective: Design FPGA based vibration data acquisition and preprocessing system.

Specification :
I. Selection of SoC : Microblaze
II. Selection of interface protocol : I2C
III. Sensors to be interfaced : MPU6050
IV. Data Processing : Through IP configuration

4 Communication Protocols and Interfacing for Raspberry-pi 3


Objective: Explore communication protocols and their implementation in embedded
systems.

Specification :
Protocol: Deep dive into UART or I2C or SPI protocols.
I. Peripheral and sensor integration with protocol
II. Implementing custom communication protocols on Boolean FPGA boards.
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

1. Introduction to Embedded Systems and Tools:


Objective: Real-Time Structural Health and Vibration Anomaly Detection usig
FPGA and Raspberry Pi

System Overview:
The system consists of three major components:

• MPU6050 Sensor
o Provides acceleration (Ax, Ay, Az) and data
o Communicates with FPGA using I2C protocol

• FPGA (Boolean Board)


o Acts as real-time processing unit
o Performs filtering and feature extraction
o Executes anomaly detection algorithm
o Sends processed data to Raspberry Pi via UART

• Raspberry Pi 3b+
o Acts as monitoring and visualization unit
o Receives processed data via UART
o Displays anomaly status
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Introduction to Raspberry Pi and Xilinx SDK with Boolean FPGA boards

A. Setting up Development Environments

B. Raspberry Pi: Raspbian OS, Python Programming

• Installing fresh Raspbian OS


• Installing python
• Installing libraries such as pyserial, pandas, matplotlib and other required
libraries
• Creation of virtual environment

Commands used: -

sudo apt install python3-venv -y

python3 -m venv uart_env

source uart_env/bin/activate

pip install pyserial pandas matplotlib

C. Xilinx SDK: Vivado IDE, FPGA Programming Flow

• Installation of Xilinx Vivado


• Understanding workflow of the tool
• Implementation of required logic
• initalizing I2C for sensor instantiation

D. GPIO Interfacing Required on Boards


The system involves 2 communication paths:
• I2C between MPU6050 and Boolean board
• UART between FPGA and Raspberry Pi
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Connections:-
MPU6050 FPGA
SDA i2c_sda
SCL i2c_scl
VCC 3.3V
GND GND
AD0 GND

FPGA Raspberry Pi
UART_TX GPIO15 (RX)
UART_RX GPIO14 (TX)
GND GND
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Visualization of pin connection

E. Protocol Required: I2C and UART

I2C provides:
• Simple two-wire communication using SDA and SCL lines
• Efficient sensor interfacing
• Support for multiple devices on the same bus
• Low hardware complexity

UART provides:
• Asynchronous serial communication
• Simple hardware implementation
• Reliable data transmission between FPGA and Raspberry Pi
• Easy integration with Python-based monitoring on Raspberry Pi
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

System Flow Chart


Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

2. Embedded Programming with Raspberry Pi:

Objective:
To implement UART-based data reception, processing using Python on Raspberry
Pi.

Implementation:
• UART communication established using PySerial
• Data received from FPGA in real time
• Data parsed into meaningful parameters (RMS, Peak, Status)

Python Functionalities:
• Serial communication handling
• Data parsing and formatting
• Real-time monitoring display

Output:
• Displays system status:
o Normal
o Warning
o Critical
Receiver code:

import serial
import math

ser = [Link]('/dev/serial0', 115200, timeout=1)

print("UART TEST")

while True:
data = [Link]().decode().strip()

if data:
try:
ax, ay, az = map(float, [Link](','))
mag = [Link](ax**2 + ay**2 + az**2)
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

if mag < 1.0:


status = "NORMAL"
elif mag < 2.0:
status = "WARNING"
else:
status = "CRITICAL"

print(f"{ax:.2f}, {ay:.2f}, {az:.2f} | {mag:.2f} | {status}")

except:
print("INVALID:", data)

flowchart:-
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Sender code:-
import serial
import time

ser = [Link]('/dev/serial0', 115200)

while True:
[Link](b"0.2,0.2,0.2\n")
[Link](2)

[Link](b"0.8,0.8,0.8\n")
[Link](2)

[Link](b"2.0,2.0,2.0\n")
[Link](2)
flowchart:-
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

Output:-
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

3. FPGA MicroBlaze Interfacing with I2C Protocol:


Objective: To design and implement real-time vibration data processing and
anomaly detection using FPGA.

Sensor Interfacing:

• MPU6050 connected via I2C


• FPGA reads acceleration data
Processing Steps:
1. Noise Filtering (Moving Average)
2. Magnitude Calculation:
A = sqrt(Ax^2 + Ay^2 + Az^2)

3. Feature Extraction:
o RMS
Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

o Peak Value
o Variance

4. Decision Logic:
o If RMS < Threshold1 → Normal
o If Threshold1 ≤ RMS < Threshold2 → Warning
o If RMS ≥ Threshold2 → Critical

Block Designed generated on Xilinx Vivado


Vivekanand Education Society’s
Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai, Approved by AICTE)

4. Communication Protocols and Interfacing for Raspberry Pi


Objective:
To implement and analyze communication between system components using
UART protocols.
Protocols Used:
UART (FPGA to Raspberry Pi)

• Used for serial data transmission


• Simple and efficient communication
System Communication Flow:
1. MPU6050 sends data to FPGA via I2C
2. FPGA processes data and detects anomalies
3. FPGA sends results to Raspberry Pi via UART
4. Raspberry Pi displays resultsp

You might also like