0% found this document useful (0 votes)
14 views41 pages

REPORT

The Summer Internship Report by P. Prashanth Reddy outlines his experiences and learning outcomes during an internship at Microchip Technology, focusing on embedded systems and related technologies. The report includes an overview of embedded systems, objectives of the internship, and detailed discussions on microcontrollers, programming, and development tools like MPLAB X IDE. It emphasizes hands-on experience in embedded systems development, IoT applications, and collaboration in a professional environment.
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)
14 views41 pages

REPORT

The Summer Internship Report by P. Prashanth Reddy outlines his experiences and learning outcomes during an internship at Microchip Technology, focusing on embedded systems and related technologies. The report includes an overview of embedded systems, objectives of the internship, and detailed discussions on microcontrollers, programming, and development tools like MPLAB X IDE. It emphasizes hands-on experience in embedded systems development, IoT applications, and collaboration in a professional environment.
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
You are on page 1/ 41

SUMMER INTERNSHIP REPORT

A REPORT SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENTS FOR THE AWARD OF DEGREE OF

BACHELOR OF ENGINEERING

IN

ELECTRONICS & COMMUNICATION ENGINEERING

BY

P.PRASHANTH REDDY(1608-21-735-302)

Under the Supervision of


Mr. K.Praveen
M.Tech, (Ph. D)
Assistant Professor

Department of Electronics and Communication Engineering


(NBA Accredited)
MATRUSRI ENGINEERING COLLEGE
(Sponsored by Matrusri Education socitey, Estd1980)
(Approved by AICTE, Affiliated to Osmania University)
#16-1-486,Saidabad, Hyderabad, Telangana-500 059
www.matrusri.edu.in

2024-25

i
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Date:

Certificate

This is to certify that the “SUMMER INTERNSHIP REPORT” submitted by

Mr./Ms.P.Prashanth Reddy Roll No. 1608-21-735-302 is work done by him/her and submitted

during 2024-25 Academic year, in partial fulfillment of the requirements for the award of the

degree of Bachelor of Engineering in Electronics and Communication Engineering of the

Osmania University, Hyderabad.

Internship Coordinator Head of the Department


Mr.P.Ravi Kumar Reddy Dr.N.Srinivasa Rao
Mr.K.Shravan Kumar

ii
Certificate

iii
ACKNOWLEDGEMENT
I would like to extend my sincere appreciation to all the individuals who collaborated with me
during this internship. Their patience and cooperation created an enjoyable and enriching
working environment. With the immense pleasure, I acknowledge the support and the facilities
provided by Dr. D. Hanumantha Rao, the Principal of Matrusri Engineering College, whose
guidance enabled me to successfully accomplish this internship. I am deeply grateful to Dr. N.
Srinivasa Rao, Head of the Department, for his constructive feedback and valuable insights
throughout my internship, which greatly contributed to my professional growth. Special thanks
to Mr. P. Ravikumar Reddy and Mr. K. Shravan Kumar the Department Internship Coordinator,
for his continuous support and advice in securing and successfully completing my internship
at Microchip Technology with collaboration of EduSkills Foundation

Name of the student


P Prashanth Reddy

iv
ABSTRACT
Embedded systems consist of interacting components that are required to deliver a specific
functionality under constraints on execution rates and relative time separation of the
components. In this article, we model an embedded system using concurrent processes
interacting through synchronization.

We assume that there are rate constraints on the execution rates of processes imposed by the
designer or the environment of the system, where the execution rate of a process is the number
of its executions per unit time. We address the problem of computing bounds on the execution
rates of processes constituting an embedded system, and propose an interactive rate analysis
framework.

v
INDEX

Page no
Certificate iii
Acknowledgment iv
Abstract v
Chapter-1. Industry/Organization Profile 1
Chapter-2. Internship Objectives/Learning Objectives 2
Chapter-3. Introduction 3-5
3.1Characteristics of an Embedded Systems
3.2 Application areas of Embedded System
3.3 Block Diagram of Embedded System
3.4 Advantages of Embedded System
3.5Disadvantages of Embedded System
Chapter-4. Internship Discussion
4.1 8 Bit Microcontrollers:Architecture of the PICI6 5
4.2 Introduction to MPLAB x IDE 6-8
4.3 Getting Started with PIC161xxxMCUs USIng MCC and 8-9
State Machines
4.4 Syntax And Structure of C 10-11
4.5 Advanced C Programming 11-12
4.6 C Programming Linked List data Structures 12-15
4.7 C programming Callbacks 15-17
4.8 Advanced Embedded C Tips,Tricks and Cautions 17-18
4.9 Design Considerations for Your IoT Project 18-21
4.10 Exploring BLE from First Steps To Final Application 21-26
4.11 Creating Sensor Node for Azure IoT Central 26-28
4.12 Motor Control Workshop using dsPIC Digital Signal 28-30
(DSC) Dual Core Devices

vi
Chapter-5 Conclusion 31
Chapter-6 Weekly Overview of Internship Activities 32
Chapter 7 Bibliography 33

vii
LIST OF FIGURES

Fig. No Title Page no


3.1 Block Diagram of Embedded System 4
3.2 Embedded System chips 5
4.2 Block Diagram of MPLAB X 6
4 .3 State Diagram 6
4.4 C language 11
4.5 Customize Embedded Software Development 12
4.6 Linked List in Data Structure 15
4.7 C Programming Callbacks 16
4.8 Embedded C Proograming Tips and Best Practices 18
4.9 Sensors and controllers 21

4.10.1 Output 25
4.10.2 Output 26
4.10.3 BLE 26
4.11 IoT App Platform 28

4.12 Ds PIC Board 30

viii
1 Industry/organization profile

Microchip Technologyis a leading provider of microcontroller, mixed-signal, analog, and


Flash-IP integrated circuits. The organization supports innovation in embedded systems by
offering industry-leading tools, resources, and training. Known for its user-centric approach,
Microchip empowers developers, engineers, and organizations to create efficient, reliable, and
scalable designs across industries such as automotive, IoT, consumer electronics, and industrial
automation. The company's ecosystem includes hardware solutions, software platforms like
MPLAB X IDE, and extensive training programs to advance technology development
worldwide.

1
2 Internship Objectives/Learning Objectives
The main objective of this internship is to offer participants exposure to the intricate world of
embedded systems to organize quality of training, workshops, short term courses, summer and
winter schools, conferences, seminars, and symposiums for teachers, scientists, students,
research scholars and Industry persons for updating their knowledge and skills in the current
field of activities.
 Hands-on Embedded Systems Development
 IoT Architecture and Protocols
 Programming for Embedded Systems
 Sensor Integration and Data Acquisition
 IoT Connectivity and Networking
 Embedded System Security
 IoT Application Development
 Real-world Project Implementation
 Collaboration and Teamwork
 Professional Deve

2
3 INTRODUCTION

An embedded System is an integrated system that is formed as a combination of


computer hardware and software for a specific function. It can be said that a dedicated
computer system has been developed for some particular reason. But it is not our
traditional computer system or general-purpose computers, these are the Embedded
systems that may work independently or attached to a larger system to work on a few
specific functions. These embedded systems can work without human intervention or
with little human intervention.

Three main components of Embedded systems are:


1. Hardware
2. Software
3. Firmware
3.1 Characteristics of an Embedded System:
1. Performs specific task: Embedded systems perform some specific function
2. Low Cost: The price of an embedded system is not so expensive.
3. Time Specific: It performs the tasks within a certain time frame.
4. Low Power: Embedded Systems don’t require much power to operate.
5. High Efficiency: The efficiency level of embedded systems is very high.
3.2 Application areas of Embedded System: Mostly Embedded systems are present
everywhere. We use it in our everyday life unknowingly as in most cases it is integrated
into the larger systems. So, here are some of the application areas of Embedded systems:
• Home appliances
• Transportation
• Health care
• Business sector & offices
• Defense sector
• Aerospace Down

3.3 Block Structure Diagram of Embedded System

3
Fig 3.1
3.4 Advantages of Embedded System:
• Small size.
• Enhanced real-time performance.
• Easily customizable for a specific application.
3.5 Disadvantages of Embedded System:
• High development cost.
• Time-consuming design process.
• As it is application-specific less market available.

Fig 3.2

4
4.INTERNSHIP DISCUSSION
4.1-Bit Microcontrollers: Architecture of the PIC16
Microchip's first 8-bit microcontroller (MCU), was the PIC1650. Over time, 8-bit PIC
expanded from 12-bit instruction words to 14 and 16. Non-volatile program and data
memory was introduced along with more package options and many new digital and
analog peripherals. Improvements to power consumption, performance, and cost also
became available. 4.1 The PIC10, PIC12, PIC16 and PIC18 product families feature:
• Easy migration - scale your designs up or down.
• Performance to meet your application needs ranging from lowest power up to
100 Dhrystone Million Instructions Per Second (DMIPS)
• Complete your portfolio from 384B to 512 KB of program memory as your code
requirements grow.
• Upward compatible architectures to preserve investment in code development.
• Pin compatibility in multiple packages facilitates drop-in replacement from six
to 144 pins.
4.2 The 8-bit family has four categories:
• Baseline (12-bit wide program memory)
• Mid-Range (14-bit wide program memory)
• Enhanced Mid-Range (enhanced 14-bit wide program memory)
• High-End (16-bit wide program memory)
The 8-bit PIC microcontroller uses a Reduced Instruction Set Computer (RISC)
architecture that has a separate address and data bus. This means they can be separate
in size as well. All 8-bit PIC microcontrollers have an 8-bit wide data bus but the
program bus will vary in size depending on the family. This can also confuse the
memory structure of an 8-bit PIC microcontroller will be reported in words of a size
equal to the program bus, not the data bus. A larger program bus allows the device to
place more information in one instruction line and thus, more efficient execution.
Therefore, memory for each device is reported in words and then a byte reference.

4.2.INTRODUCTION TO MPLAB® X IDE


The MPLAB® X Integrated Development Environment (IDE) is a computer software
that may be used to create applications for Microchip PIC® microcontrollers and
dsPIC® digital signal controllers (DSCs). It can be run on Windows®, macOS®, or

5
Linux® platforms. For the purpose of creating and debugging applications on any
device from the PIC microcontroller product family, the MPLAB X IDE offers a wide
range of functionality. But like any feature-rich program, it might be difficult to figure
out how to use all of its features or even to know what they are. This Developer Help
site part aims to assist you in finding and using the numerous features that are available
to simplify and improve your development efforts.. INTRODUCTION TO MPLAB®
X IDE

Fig 4.2
Features and Components
1.Integrated Development Environment (IDE):
Editor: MPLAB® X IDE includes a source code editor with features like syntax
highlighting, code completion, and indentation. Project Manager: Organizes your
source files, libraries, and configuration settings into a project. Build System: Manages
the compilation and linking of your code, generating executable files for the target
microcontroller.

2.Device Configuration and Selection:


Device Support: MPLAB® X IDE supports a wide range of Microchip
microcontrollers and DSCs. You can select your target device and configure its settings
6
within the IDE. Peripheral Configuration: Configure the peripherals of the
microcontroller using graphical tools for setting up GPIO, timers, communication
modules, etc. Debugger: Real-Time Debugging: MPLAB® X IDE integrates a
powerful debugger that allows you to set breakpoints, watch variables, and step through
code in real-time. Simulation: You can simulate your code execution without a physical
target, which is helpful for debugging and testing without the actual hardware.
3.Compiler and Toolchain Integration:
XC Compiler: MPLAB® X IDE uses the Microchip XC Compiler toolchain for
compiling C, C++, and assembly code for Microchip devices.
Third-Party Compiler Support: It also supports third-party compilers, allowing
flexibility in choosing the compiler that fits your needs.
4.Plugin Support:
MPLAB® Harmony: A framework and set of peripheral libraries for Microchip
microcontrollers.
MPLAB® Code Configurator (MCC): A graphical tool for setting up and configuring
peripherals without manually writing initialization code.
5.Version Control Integration:
MPLAB® X IDE can integrate with version control systems like Git, facilitating
collaborative development.
Workflow:
1.Creating a Project: Start by creating a new project, selecting your target
microcontroller, and configuring project settings.
2.Writing Code: Use the built-in editor to write your C, C++, or assembly code.
3.Configuring Peripherals: MPLAB® X IDE provides tools such as MCC for
configuring and initializing peripherals.
4.Building the Project: Compile and build your project to generate the binary file for
programming onto the microcontroller.
5.Debugging: Utilize the integrated debugger for real-time debugging and simulation.
6.Programming the Microcontroller: Once your code is ready, program the
microcontroller using MPLAB® X IDE.
7.Version Control: Optionally, integrate with version control systems for collaborative
development.
4.3. GETTING STARTED WITH PC16F1XXXMCUS USING MCS AND STATE
MACHINES
7
Prerequisites:
Before we start, make sure you have the following:
- MPLABX IDE installed on your computer.
- MPLAB Code Configurator (MCC) installed as a plugin in MPLABX.
- A PIC16F1619 microcontroller.
- Curiosity Demo Board.
To get started with the PIC16F1XXX microcontroller using MCs (Microcontrollers)
and state machines for embedded systems, follow these steps:
1. Setup Development Environment:
- Install MPLAB X IDE and XC8 compiler, which are commonly used for PIC
microcontroller development.
- Familiarize yourself with the development tools and their basic usage.
2. Select a PIC16F1XXX Device:
- Choose a specific PIC16F1XXX microcontroller variant based on your project
requirements.
3. Understand the Datasheet:
- Refer to the datasheet of the selected PIC16F1XXX device to understand its
features, pinouts, and functionalities.
4. Create a Project:
- Create a new project in MPLAB X IDE and configure the project settings for
your chosen microcontroller.
5. Peripheral Configuration:
- Configure the necessary peripherals (e.g., GPIO, Timer, UART) using the
MPLAB Code Configurator (MCC) or by directly writing register-level code.
6. Implement State Machines:
- Define the states and transitions of your system using a state machine approach.
- Use switch-case or if-else statements to implement the logic for each state.
7. Interrupt Handling:
- Implement interrupt service routines (ISRs) to handle asynchronous events.
- Configure interrupts for timers, external events, or other relevant sources.
8. Testing and Debugging:
- Use MPLAB X IDE's debugging tools to test and debug your code.
- Use breakpoints, watch variables, and step through the code to identify and fix
issues.
8
9. Optimization:
- Optimize your code for performance and resource usage.
- Consider power consumption, especially in battery-powered embedded system.
10. Documentation:
- Document your code, especially the state machine logic, to make it easier for
others (or yourself) to understand and maintain.
11. Iterative Development:
- Develop and test your code incrementally. Start with a simple implementation
and gradually add complexity.
12. External Communication:
- If your application involves communication with external devices or sensors,
implement the necessary protocols (e.g., I2C, SPI, UART).

Fig 4.3
4.4 Syntax And Structure of c
4.Syntax and structure of c An expansion of the standard C programming language for
usage in embedded systems is the embedded C programming language. The syntax and
semantics of the C programming language are also used by the embedded C
programming language. The only features that are added to the standard C
programming language in the Embedded C language are address space access, fixed-
point arithmetic operations, and I/O hardware addressing

Basic Structure of Embedded C Program:


The embedded C program has a structure similar to C programming.
The five layers are:
1. Comments
2. Pre-processor directives
3. Global declaration
9
4. Local declaration
5. Main function ()
Comment Section: Comments are simple readable text, written in code to make it more
understandable to the reader. Usually comments are written in // or /* */. Example:
//Test program
Let’s look into Preprocessor Directives Section.
Preprocessor Directives Section:
The Pre-Processor directives tell the compiler which files to look in to find the symbols
that are not present in the program.
Global Declaration Section:
This part of the code is the part where the global variables are declared. Also, the user-
defined functions are declared in this part of the code. They can be accessed from
anywhere.
Local Declaration Section:
These variables are declared in the respective functions and cannot be used outside the
main function.
Main Function Section:
Every C programs need to have the main function. So does an embedded C program.
Each main function contains 2 parts. A declaration part and an Execution part. The
declaration part is the part where all the variables are declared. The execution part
begins with the curly brackets and ends with the curly close bracket. Both the
declaration and execution part are inside the curly braces.

10
Fig 4.4

4.5 ADVANCED C PROGRAMMING


Microcontroller embedded C programming is a crucial skill for professionals in the
field of embedded systems. It is a programming language that is widely used in the
development of microcontroller-based systems, and it offers a wide range of features
that allow developers to create efficient and effective code. In this blog, we will explore
some advanced microcontroller embedded techniques that professionals can use to take
their skills to the next level.
• Use of Pointers: Pointers are variables that store the memory address of another
variable. In microcontroller-embedded C programming, pointers are used to
access and manipulate memory locations directly. This technique can be used
to optimize code and improve performance.
• Use of Interrupts: Interrupts are signals that are generated by hardware devices
to interrupt the normal flow of program execution. In microcontroller-
embedded C programming, interrupts can be used to respond to external events
in real-time. • Use of DMA: DMA (Direct Memory Access) is a technique that
allows data to be transferred from one memory location to another without the
need for CPU intervention. In microcontroller-embedded C programming,
DMA can be used to optimize code and improve performance.

11
• Use of Timers: Timers are hardware devices that can be used to measure time
intervals in microcontroller-embedded systems. In microcontroller-embedded C
programming, timers can be used to perform time-critical operations.

Advanced C programming for embedded systems demands a comprehensive


understanding of both software and hardware aspects. Developers need to navigate the
intricate landscape of memory management, optimization, real-time considerations,
power management, and peripheral interaction.

Fig 4.5

4.6. C PROGRAMMING: LINKED LIST DATA STRUCTURE

Linked lists in embedded systems, where resource constraints and efficiency are
paramount, pose both challenges and opportunities. In the realm of C programming for
embedded systems, the use of linked lists must be carefully considered to ensure
optimal performance with limited resources. One of the primary advantages of linked
lists in embedded systems is their dynamic nature, enabling efficient memory
utilization. Unlike static arrays whose size is fixed at compile-time, linked lists allow
for dynamic allocation and deallocation of memory during runtime. This flexibility is
especially valuable in embedded systems where memory resources are typically scarce
and need to be managed judiciously.

12
Another consideration is the overhead associated with traversing linked lists. In
embedded systems, where computational resources are often limited, the linear
traversal required to access or manipulate elements in a linked list may introduce
inefficiencies. This contrasts with static arrays, which allow for constant-time access
using index-based addressing.
Despite these challenges, linked lists remain a valuable tool in embedded systems
programming. They provide a flexible and adaptive means of managing data structures
in situations where the size of the dataset is not known at compile time. By
understanding the tradeoffs and implementing optimization techniques, developers can
harness the power of linked lists while ensuring the efficient operation of embedded
systems.
Embedded systems, characterized by constrained resources and specialized
applications, demand a nuanced approach to data structures in C programming. The
selection and implementation of data structures in embedded systems play a pivotal role
in achieving optimal performance, reliability, and efficient memory utilization.
• Limited Resources: Embedded systems often operate with restricted resources,
including limited memory, processing power, and energy. This necessitates a
careful choice of data structures to ensure efficient use of available resources.
Traditional data structures like arrays and linked lists must be scrutinized in
terms of their memory footprint and processing overhead.
• Arrays for Deterministic Access: Arrays, with their contiguous memory
allocation and direct access through indexing, are frequently employed in
embedded systems. They offer constant-time access to elements, making them
suitable for situations where deterministic access is crucial. However, their
drawback lies in fixed size, which may not accommodate dynamic data
requirements.
• Linked Lists for Dynamic Adaptability: Linked lists, while introducing potential
memory fragmentation and traversal overhead, provide dynamic adaptability in
situations where the size of the data set is unpredictable. Memory allocation
strategies, such as memory pools and careful node management, can be
implemented to mitigate these concerns and leverage the flexibility of linked
lists.
• Trees for Hierarchical Structures: In embedded systems handling hierarchical
data, tree structures become invaluable. Binary trees, AVL trees, or other
13
variations can efficiently organize and search hierarchical data, optimizing both
memory and processing resources. However, the choice of a specific tree
structure depends on the specific application requirements and resource
constraints.
• Stack and Queue for Real-Time Processing: Embedded systems often require
realtime processing, and data structures like stacks and queues can play a crucial
role. These structures facilitate efficient last-in, first-out (LIFO) or first-in, first-
out (FIFO) operations, aiding tasks such as task scheduling, event handling, and
buffer management.
In conclusion, the choice and implementation of data structures in C programming for
embedded systems involve a delicate balance between resource constraints and
application requirements. Developers must carefully analyze the trade-offs, leverage
optimized versions of traditional structures, and, when necessary, create custom
solutions to ensure that the data structures employed align seamlessly with the unique
demands of embedded systems.

Fig 4.6

4.7.C programming callbacks


Callback functionality is an important concept in embedded programming. Callbacks
allow you to create more flexible and modular functions and enable you to separate
hardware and software operations. They also allow for multiple programmers to work
on a project and provide code to be combined with the main application program. You

14
can use different callback implementations to reduce your code execution bandwidth
and enable faster and more flexible response to any microcontroller pin or peripheral
condition. In this course, you will be able to explain the components of a callback. You
will be able to use callbacks in both polled and interrupt environments. You will learn
how to create library and object files that can be incorporated into your application
program with the use of callbacks. You will be able to construct very flexible callback
structures. Callbacks are a powerful application of pointers that access functions, so
you do need to have a good understanding of function pointers and the C programming
language.

Fig 4.7
Callbacks in C programming, especially in embedded systems, are a powerful and
common technique for handling events and asynchronous operations. A callback is
essentially a function that is registered to be called at a later point in time, often in
response to a specific event. In embedded systems, callbacks are frequently used for
handling interrupts, timers, and other asynchronous events.
Function Pointers:
In C, function pointers are used to store the address of a function. They allow you to
pass functions as arguments to other functions. This feature is essential for
implementing callbacks.

15
Example Usage:Assume you have an embedded system where an interrupt occurs, and
you want to execute a specific function when the interrupt occurs. You can use a
callback for this purpose.
Context Data: Callbacks can also carry additional context data by defining a structure
that holds both the function pointer and the associated data. Considerations for
Embedded Systems:
Function Size: Keep the callback functions small and efficient, as they may be called
in time-sensitive situations.
Global vs. Local: Be mindful of the scope of your function pointers. In some cases,
global function pointers may be used, but local ones may be more suitable to avoid
unintended side effects.
Remember that the specifics may vary based on the architecture and toolchain of your
embedded system. Always refer to the documentation of your embedded platform and
compiler for any specific considerations
4.8. ADVANCEDEMBEDEED CTIPS, TRICKS, AND CAUTIONS
Embedded systems, the silent workhorses powering an array of devices from medical
equipment to automotive control units, demand a nuanced approach as complexity and
performance requirements escalate. Here, we delve into advanced tips, tricks, and
precautions that can elevate your embedded systems development prowess. Certainly!
Here are some advanced embedded systems tips, tricks, and precautions:

Tips and Tricks:


• Power Optimization: Utilize low-power modes when possible. Optimize
voltage and clock frequency for specific tasks.
• Memory Management: Implement efficient memory allocation and
deallocation. Optimize data structures to minimize memory usage.
• Real-Time Operating Systems (RTOS): Consider using an RTOS for better task
management. Optimize task priorities for time-critical functions.
• Interrupt Handling: Minimize interrupt service routine (ISR) execution time.
Prioritize interrupts based on criticality.
• Peripheral Management: Utilize DMA (Direct Memory Access) for efficient
data transfer. Optimize usage of timers and counters.
• Code Optimization: Use inline assembly for critical sections. Employ compiler
optimization flags.
16
• Debugging and Profiling: Use hardware and software debugging tools. Profile
code to identify performance bottlenecks.

Cautions:
• Interrupt Safety: Be cautious when accessing shared resources in ISRs.
Minimize the use of floating-point operations in ISRs.
• Real-Time Constraints: Ensure critical real-time tasks meet deadlines. Be aware
of the worst-case execution time for tasks.
• Concurrency Issues: Implement proper synchronization mechanisms. Avoid
race conditions and deadlocks. • Power Failures: Implement mechanisms to
handle unexpected power loss. Use non volatile memory for critical data.
• Peripheral Configuration: Double-check configuration registers for
peripherals.Be cautious with changes to the clock and power settings.
• Security Concerns: Implement secure coding practices to prevent
vulnerabilities. Regularly update and patch any external libraries or
components.
• Watchdog Timers: Use watchdog timers carefully to avoid unintended resets.
Ensure the watchdog timer period is appropriate for the application.
Remember, embedded systems often have resource constraints, so balance optimization
with maintainability. Regularly test and validate your code, especially in real-world
conditions, to ensure reliability.

In conclusion, navigating the realm of advanced embedded systems necessitates a


holistic approach, blending technical expertise with meticulous attention to detail.
Document your design decisions, stay abreast of industry best practices, and embrace
continuous learning to master the ever-evolving landscape of embedded systems
development.

17
Fig 4.8

4.9 Design Consideration for Your IoT Project


Designing an IoT project involves careful consideration of various technical,
functional, and practical aspects to ensure the solution is reliable, scalable, and secure.
Here’s a comprehensive breakdown of design considerations for an IoT project:

1. Hardware Design
a. Device Selection
Microcontroller (MCU) or Microprocessor (MPU): Choose based on processing power,
memory, and connectivity needs (e.g., ESP32, STM32, Raspberry Pi).
Sensors/Actuators: Select sensors for data acquisition (e.g., temperature, humidity,
motion) and actuators for control (e.g., relays, motors).
Connectivity Module: Include BLE, Wi-Fi, Zigbee, LoRa, or NB-IoT based on the
range and bandwidth requirements.
b. Power Management
Power Source: Consider batteries, solar panels, or power over Ethernet (PoE).
Low-Power Modes: Use sleep modes and duty cycling to conserve energy.
Battery Life: Optimize for longer life by balancing processing and communication
frequency.

18
c. PCB Design
Form Factor: Compact and efficient layout for embedded systems.
EMI/EMC Compliance: Ensure compliance with regulatory standards for wireless
communication.
2. Connectivity and Communication
a. Protocol Selection
Short-Range Protocols: BLE, Zigbee, or Wi-Fi for local communication.
Long-Range Protocols: LoRa, NB-IoT, or cellular (4G/5G) for remote communication.
IoT Protocols: Use MQTT, CoAP, or HTTP/HTTPS for efficient data transfer.
b. Network Reliability
Redundancy: Implement fallback mechanisms if one network fails.
Latency: Optimize data packet size and frequency to reduce delays.
Bandwidth: Ensure sufficient bandwidth for data-intensive applications.
3. Data Management
a. Data Collection
Define the sampling rate for sensors based on the application.
Use edge processing to pre-filter and compress raw data.
b. Data Transmission
Minimize transmission size to conserve bandwidth.
Implement acknowledgment mechanisms for critical data.
c. Cloud/Edge Computing
Decide between cloud-based or edge-based processing depending on latency and
scalability needs.
Use scalable cloud services like AWS IoT, Microsoft Azure, or Google Cloud IoT.
d. Data Storage
Local Storage: Use SD cards or embedded memory for local logging.
Cloud Storage: Store data for long-term analysis and machine learning.
4. Security
a. Device Security
Use hardware secure elements or TPM (Trusted Platform Modules).
Encrypt all firmware to prevent unauthorized access.
b. Data Security
Implement end-to-end encryption (e.g., TLS/SSL).
Use secure authentication mechanisms like OAuth 2.0 or JWT.
19
c. Network Security
Secure communication protocols (e.g., HTTPS, MQTT with TLS).
Use firewalls and intrusion detection systems for gateways.
5. Scalability
Ensure the system can support a growing number of devices and users.
Use modular designs to add features or upgrade components easily.
6. Usability
a. User Interface
Provide intuitive mobile or web applications for control and monitoring.
Use dashboards to visualize data trends effectively.
b. Device Interfacing
Allow OTA (Over-the-Air) updates for firmware.
Support easy device pairing and configuration.
7. Environmental Considerations
Choose components rated for the operating environment (e.g., temperature, humidity,
dust, water).
Use IP-rated enclosures for outdoor applications.
8. Compliance and Certifications
Ensure the device complies with regional regulations (FCC, CE, RoHS).
Follow BLE, Zigbee, or other relevant protocol standards.
9. Cost Optimization
Use cost-effective components without compromising quality.
Optimize PCB design to reduce manufacturing costs.
Example IoT Project: Smart Home Temperature Monitoring
Hardware: ESP32, DHT22 temperature sensor, BLE module, Li-ion battery.
Connectivity: BLE for local communication and Wi-Fi for cloud integration.
Cloud Service: Data stored and visualized using AWS IoT Core.
Security: TLS encryption and secure firmware updates.
Usability: Mobile app for monitoring and setting temperature alerts.
Let me know if you need help tailoring this to a specific IoT use case or project

20
Fig 4.9

4.10 EXPLORING BLUETOOTH LOW ENERGY(BLE) FROM FIRST STEPS


TO FINAL APPLICATION

Certainly! Exploring Bluetooth Low Energy (BLE) in an embedded system involves a


series of steps tailored for the constraints and requirements of embedded environments:
1. Selecting Embedded Hardware:
- capabilities. Choose an embedded platform that supports Bluetooth Low
Energy, such as microcontrollers or system-on-chip (SoC) devices with
integrated BLE
2. Development Environment Setup:
- Set up a development environment suitable for embedded programming (e.g.,
Keil, IAR Embedded Workbench).
- Install the necessary SDKs and tools provided by the hardware manufacturer
for BLE development.
3. Understanding BLE Stack:
- Familiarize yourself with the BLE protocol stack and how it operates in
embedded systems.
- Understand the roles of the Controller and Host in BLE communication.
4. Peripheral Configuration:
- Configure your embedded device as a BLE peripheral, defining services and
characteristics relevant to your application.

21
- Implement the necessary callbacks for handling BLE events.
5. Central Configuration:
- Configure your embedded device as a central if it needs to communicate with
other peripherals.
- Implement scanning and connection logic in the embedded system.
6. Memory Optimization:
- Optimize code and data structures for memory-constrained environments
typical in embedded systems.
- Minimize the use of dynamic memory allocation if resources are limited.
7. Power Management:
- Implement power-saving features to extend battery life or reduce power
consumption in the embedded system.
- Utilize low-power modes and consider dynamic power adjustment based on
communication requirements
8. Integration with Sensors and Actuators:
- Integrate BLE communication with sensors and actuators relevant to your
application.
- Ensure proper data formatting and handling within the embedded system.
9. Real-time Considerations:
- Address real-time requirements if your application demands timely responses.
- Implement mechanisms to handle time-sensitive tasks efficiently.
10. Security Implementation:
- Implement security features provided by the BLE stack, such as encryption and
authentication.
- Adapt security measures to meet the specific needs of your embedded system.
11. Testing in Embedded Environment:
- Test the BLE functionality in the embedded system, considering hardware
limitations and environmental constraints.
- Use debugging tools specific to your embedded platform to identify and resolve
issues.
12. Final Application Integration:
- Integrate the embedded BLE functionality into the overall embedded system
application.
- Ensure seamless interaction with other components of the system.
22
13. Documentation and Version Control:
- Document the embedded BLE implementation, considering constraints and
challenges.
- Use version control for maintaining and tracking changes in the embedded
system code.
14. Compliance and Certification:
- Ensure your embedded BLE implementation complies with Bluetooth
standards.
- If applicable, pursue certification for your embedded system.

Program:
#include <xc.h>
#include <stdint.h>
#include <stdio.h>
#include "mcc_generated_files/mcc.h"

// Function prototypes
void BLE_Init(void);
void BLE_StartAdvertising(void);
void BLE_SendTemperature(float temperature);
float ReadTemperature(void);

void main(void) {
// Initialize the microcontroller and peripherals
SYSTEM_Initialize();

// Initialize BLE module


BLE_Init();

// Start advertising
BLE_StartAdvertising();

23
while (1) {
// Read temperature from the sensor
float temperature = ReadTemperature();

// Send temperature over BLE


BLE_SendTemperature(temperature);

// Small delay to prevent spamming BLE


__delay_ms(1000);
}
}

// Initialize BLE module


void BLE_Init(void) {
// Reset BLE module
LATAbits.LATA0 = 0; // Reset pin LOW
__delay_ms(100);
LATAbits.LATA0 = 1; // Reset pin HIGH
__delay_ms(500);

// Initialize UART for BLE communication


EUSART1_WriteString("SF,1\r"); // Factory reset
__delay_ms(100);
EUSART1_WriteString("SR,20000000\r"); // Set as Peripheral
__delay_ms(100);
EUSART1_WriteString("R,1\r"); // Reboot module
__delay_ms(500);
}

// Start BLE advertising


void BLE_StartAdvertising(void) {
EUSART1_WriteString("A\r"); // Start advertising
}

24
// Send temperature data over BLE
void BLE_SendTemperature(float temperature) {
char buffer[20];
sprintf(buffer, "Temperature: %.2fC\r", temperature);
EUSART1_WriteString("SHW,Temperature\r"); // Set as characteristic
__delay_ms(100);
EUSART1_WriteString(buffer); // Send temperature value
}

// Read temperature from sensor


float ReadTemperature(void) {
uint16_t adcValue = ADC_GetConversion(channel_AN0); // Read ADC value
float voltage = (adcValue / 1024.0) * 5.0; // Convert ADC to voltage
float temperature = voltage * 100.0; // Convert voltage to °C
return temperature;
}

Result:

Fig 4.10.1

25
Fig 4.10.2

Fig 4.10.3

4.11. CREATING A SENSOR NODE FOR AZURE IoT CENTRAL


The Internet of Things (IoT) has revolutionized data collection and automation across
various industries. Embedded systems, often serving as the backbone of these
connected devices, play a crucial role in sensor data acquisition and communication.
To effectively manage and utilize this data, platforms like Azure IoT Central offer a
streamlined solution. This essay provides a comprehensive guide on creating a sensor
node for Azure IoT Central, specifically for embedded systems.
To create a sensor node for Azure IoT Central, you can follow these general steps:
• Set Up Azure IoT Central:

26
- Create an Azure IoT Central application.
- Define a device template in IoT Central that represents your
sensor node.
• Choose Hardware:
- Select a microcontroller or single-board computer compatible
with Azure IoT. Common choices include Raspberry Pi,
Arduino, or devices with supported IoT SDKs.
• Programming Language and SDK:
- Choose a programming language for your sensor node (e.g., C,
Python) and use the Azure IoT SDK for that language. Azure
provides SDKs for various languages.
• Device Registration:
- Register your device in Azure IoT Central. Obtain the device
connection string or credentials needed for your device to
communicate with Azure.
• Connectivity:
- Implement the necessary code to establish a secure connection
from your sensor node to Azure IoT Central using the obtained
credentials.
• Sensor Integration:
- Interface your sensor(s) with the chosen hardware and write code
to read sensor data.
• Data Formatting:
- Format the sensor data according to the requirements of your
device template in Azure IoT Central
• Data Transmission:
- Send the formatted sensor data to Azure IoT Central using the
established connection.
• Security Measures:
- Implement security measures such as using secure connections
(HTTPS), device authentication, and encryption to protect your
IoT communication.
• Testing:

27
- Test your sensor node by sending data to Azure IoT Central.
Verify that the data is received and displayed correctly in your
IoT Central application.
• Monitoring and Maintenance:
- Implement mechanisms for monitoring the health of your sensor
node and handle maintenance tasks as needed.

Fig 4.11

4.12 . MOTOR CONTROL WORKSHOP USING dsPIC DIGITAL SIGNAL


CONTROLLERS (DSC) DUAL CORE DEVICES
This workshop explores the world of motor control using dsPIC® Digital Signal
Controllers (DSC) with a focus on dual-core devices. Participants will gain a
comprehensive understanding of BLDC (Brushless DC) and PMSM (Permanent
Magnet Synchronous Motor) designs, along with the classic control algorithms
employed for each. The workshop delves into the dsPIC33xx architecture and its
motor control peripherals, providing an in-depth look at the Microchip demo board,

28
MCLV-2. Hands-on labs utilizing the dsPIC33CH128MP508 will equip participants
with practical experience in sensored and sensorless BLDC control, as well as
sensorless PMSM (Field Oriented Control).
Certainly! To conduct a motor control workshop using dsPIC digital signal controllers
with dualcore devices for embedded systems, you may want to consider the following
key steps:
1. Introduction to Motor Control:
- Provide a brief overview of motor control concepts.
- Discuss different types of motors and their applications.
2. dsPIC Dual-Core Basics:
- Introduce participants to dsPIC digital signal controllers and dual-core architecture.
- Explain the advantages of using dual cores for real-time control.
3. Software and Development Environment:
- Guide participants in setting up the development environment for dsPIC controllers.
- Introduce programming tools and software, such as MPLAB X IDE.
4. Motor Control Algorithms:
- Cover basic motor control algorithms like PI control and field-oriented control
(FOC).
- Explain how dual-core processing can enhance the performance of these algorithms.
5. Hardware Interface:
- Discuss hardware interfaces for motor control, including PWM (Pulse Width
Modulation) signals.
- Provide hands-on experience with connecting dsPIC controllers to motor drivers and
sensors.
6. Dual-Core Coordination:
- Illustrate how to distribute tasks between the two cores for efficient processing.
- Explore examples of tasks suitable for each core in a motor control application.
7. Sensor Integration:
- Demonstrate how to interface sensors like encoders or Hall effect sensors for
feedback.
- Discuss the role of feedback in closed-loop motor control systems.
8. Real-time Debugging and Simulation:
- Showcase real-time debugging features available in the development environment. -
Discuss simulation tools to test motor control algorithms before deploying them.
29
9. Communication Protocols:
- Introduce communication protocols (e.g., UART, SPI, I2C) for external control or
monitoring.
- Explore ways to integrate the motor control system into larger embedded systems.
10. Practical Projects:
- Break the workshop into practical projects to reinforce learning.
- Provide participants with motor control challenges to solve using dsPIC dual-core
devices.
11. Q&A and Troubleshooting:
- Allocate time for questions and troubleshooting common issues.
- Encourage participants to share their experiences and challenges.

Fig 4.12

CHALLENGES EXPERIENCED
When working on BLE, Azure IoT sensor nodes, and motor control with dsPIC devices,
the main challenges often overlap. First, understanding the technology can take time,
especially if you're new to BLE, cloud platforms, or advanced motor controllers. Next,
hardware selection and setup is critical—choosing the right sensors, microcontrollers,
or BLE modules can feel overwhelming.
For BLE and Azure IoT, connectivity issues can arise, whether it’s pairing devices,
maintaining a stable BLE connection, or ensuring the sensor node sends data to Azure
correctly. Additionally, optimizing performance—like reducing BLE power usage,
keeping IoT data secure, or fine-tuning motor control—requires a lot of attention to
detail

30
CONCLUSION
In conclusion, the Embedded Developer Virtual Internship, facilitated by the All India
Council for Technical Education (AICTE) in collaboration with Microchip, has been a
transformative and enriching experience for participants. This initiative has
successfully bridged the gap between theoretical knowledge and practical application,
providing aspiring embedded developers with a platform to hone their skills in a virtual
environment.
Throughout the internship, participants had the invaluable opportunity to work on real-
world projects, gaining hands-on experience with Microchip's cutting-edge
technologies. The collaboration with Microchip has not only enhanced the quality of
the program but has also ensured that participants are exposed to industry-relevant tools
and practices.The virtual format of the internship allowed for a diverse pool of
participants from across the country to engage in collaborative learning and knowledge
exchange. This inclusivity has contributed to a vibrant and dynamic learning
community, fostering a sense of camaraderie among the aspiring embedded developers.
The support and guidance provided by industry experts and mentors from Microchip
have played a pivotal role in the success of this virtual internship. The participants have
benefited immensely from the wealth of knowledge shared by these experts, gaining
insights into the latest trends, best practices, and real-world challenges in the field of
embedded development. As we reflect on the achievements of the Embedded Developer
Virtual Internship, it is evident that the collaboration between AICTE and Microchip
has not only addressed the demand for skilled professionals in the embedded systems
domain but has also set a benchmark for future initiatives in virtual education and
industry-academia partnerships.
In conclusion, this virtual internship has empowered a new generation of embedded
developers, equipping them with the skills and confidence needed to excel in the fast-
evolving landscape of embedded systems. The success of this program underscores the
importance of continued collaboration between academia and industry in shaping the
future of technical education and nurturing the talent pool for the digital era.

31
Weekly Overview of Internship Activities

Date Day Name of the topic/Module Competed


06-05-2024 Monday Introduction to Embedded System
1st 07-05-2024 Tuesday Architecture of the PIC16
w 08-05-2024 Wednesday Introduction to MPLAB X IDE
e 09-05-2024 Thursday Code development and Debugging
e 10-05-2024 Friday State Machines
k 11-05-2024 Saturday Interfaces

Date Day Name of the topic/Module Competed


13-05-2024 Monday Basics of c
2nd 14-05-2024 Tuesday Loops,pointers in C
w 15-05-2024 Wednesday Advance in C programming
e 16-05-2024 Thursday Structures, Unions,State machines in C
e 17-05-2024 Friday Linked List Data Structure
k 18-05-2024 Saturday Dynamically Allocating Memory For Linkes
List

Date Day Name of the topic/Module Competed


20-05-2024 Monday C Programming Callbacks
3rd 21-05-2024 Tuesday Callbacks with Interrupt,Flexible Callbacks
w 22-05-2024 Wednesday Advanced Embedded C Tips Tricks
e 23-05-2024 Thursday Programming Cautions
e 24-05-2024 Friday Design Considerations IoT Project
k 25-05-2024 Saturday Network model,IoT Security

Date Day Name of the topic/Module Competed


28-05-2024 Monday Explooring Bluetooth Low Energy
4th 29-05-2024 Tuesday Temperature Sensor,Data Logger
w 30-05-2024 Wednesday Creating a Sensor Node For Azure IoT
e Central
e 30-05-2024 Thursday Sensor Node ,Connecting to Azure
k 01-06-2024 Friday Instruction to dsPIC DSC
02-06-2024 Saturday Tools Used,Sensorless

32
Bibliography

[1] Herbert Schildt, The Complete Reference Java2 Fifth Edition, Tata McGraw-Hill
Edition 2002.
[2] White,.E.(2011). Making Embedded System: Design Pattern for Great Software
O’Reilly Media
[3]Valvano,J.W.(2017).Embedded System:Introduction to ARM Cortex-M
Microcontroller (5th ed.) Johnathan Valvano Publishings.
[4] Grady Booch, James Rumbaugh, Ivar Jacobson. The Unified Modeling Language
User Guide. Addison-Wesley, Reading, Mass., 1999.
[5] Buttazzo, G. C. "Hard Real-Time Computing Systems." Springer, 2011.
Discusses scheduling and timing challenges in real-time embedded systems.
[6] Kim, W., et al. "Embedded System Development for the Internet of Things." IEEE
IoTJournal.

33

You might also like