Report 459
Report 459
This internship report submitted in partial fulfillment of the requirement for the award of degree
of
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by
M. PRADEEP SRI VARMA (VU21EECE0100459)
Guide name
Sri S.S.S Srikanth
Assistant Professor
VISAKHAPATNAM-530045
(2021-2025)
DEPARTMENT OF ELECTRICAL, ELECTRONICS AND COMMUNICATION
ENGINEERING
CERTIFICATE
DECLARATION
Page
Chapter No. Description
No.
1 Abstract
1
List of Figures
1
Chapter 1: Course Objectives for the Embedded Systems Developer Virtual
Internship:
1.1 Gain Practical Experience: The primary objective of the virtual internship is to provide
participants with hands-on experience in embedded systems development. Through real-world
projects, interns will have the opportunity to apply theoretical knowledge to practical scenarios,
enhancing their understanding of embedded systems concepts.
1.2. Learn Programming Microcontrollers: One of the key objectives of the internship is to
develop proficiency in programming microcontrollers. Interns will work with popular
microcontroller platforms such as Arduino or Raspberry Pi, learning how to write and debug
code, interface with peripherals, and implement various functionalities.
1.4. Develop Problem-Solving Skills: Throughout the internship, interns will encounter various
challenges and problems that require them to think critically and develop effective solutions. The
objective is to enhance problem-solving skills, enabling participants to approach complex
embedded systems issues with confidence and creativity.
1.5. Gain Project Management Experience: The internship also focuses on providing interns
with practical experience in project management. Participants will be exposed to the entire
project lifecycle, from requirements gathering to final implementation. They will learn how to
manage tasks, meet deadlines, and collaborate effectively with team members.
1.7. Build a Professional Portfolio: By the end of the internship, participants will have
completed several projects and assignments. The objective is to help interns build a professional
portfolio that showcases their skills and experience in embedded systems development, which
can be valuable for future job applications or further education.
2
Chapter 2 : What is embedded systems and why is this need to learn?
Embedded systems are computer systems designed to perform specific tasks within larger
systems or devices. They are found in various domains, including consumer electronics,
automotive, healthcare, industrial automation, and more. Here are some reasons why learning
embedded systems can be beneficial for career growth:
2.1. High Demand: Embedded systems are widely used in various industries, and there is a high
demand for professionals with expertise in designing, developing, and maintaining embedded
systems. This demand is expected to grow as more industries adopt smart devices and Internet of
Things (IoT) technologies.
2.2. Diverse Applications: Embedded systems are used in a wide range of applications, from
simple household appliances to complex automotive systems. Learning embedded systems opens
up opportunities to work on diverse projects and industries, allowing for career versatility and
exploration.
2.4. Innovation and Problem Solving: Embedded systems are at the forefront of technological
advancements. By learning embedded systems, you become part of a field that constantly pushes
the boundaries of innovation. You will work on solving complex problems, optimizing
performance, and developing efficient and reliable systems
2.5. Career Growth Opportunities: As you gain experience and expertise in embedded
systems, you can progress in your career to roles such as embedded systems engineer, firmware
engineer, embedded software developer, IoT engineer, or even move into leadership positions.
With the rapid growth of IoT and smart devices, there area boundant opportunities for career
advancement.
2.6. Competitive Advantage: In today's competitive job market, having specialized skills in
embedded systems can set you apart from other candidates. It demonstrates your ability to work
on complex systems, understand hardware-software interactions, and tackle challenging
technical problems. This can increase your employability and open doors to exciting career
opportunities.
2.7. Industry Relevance: Embedded systems are a critical component of emerging technologies
such as IoT, autonomous vehicles, robotics, and smart devices. By learning embedded systems,
you align yourself with the future of technology and position yourself as a valuable asset to
industries driving these advancements.
3
Chapter 3: Modules in the Course:
The Embedded Systems Developer Virtual Internship consists of a total of 12modules, which are
classified as follows:
Module 8: Exploring Bluetooth® Low Energy (BLE) From First Steps To Final Application
Module 9: Getting Started with PIC16F1xxx MCUs using MCC and State Machines
Module 11: Motor Control Workshop using dsPIC® Digital Signal Controllers (DSC) Dual Core
Devices
4
Chapter 4: 8 Bit Microcontrollers: Architecture of the PIC16
Overview: This class will focus on one of our PIC16F1x devices and we will cover its
architecture, memory map, instruction set, interrupt structure and special features. In going
through this class, you will gain a basic understanding of the capabilities of this device family
and how to best utilize a PIC16 in your own application.
The central processing unit (CPU) is the heart of the PIC16 microcontroller and executes
instructions. It includes an instruction set architecture (ISA) with a wide range of instructions,
including arithmetic, logic, and control instructions. The microcontroller has various registers,
including general-purpose registers (GPRs) for general data storage, special-purpose registers
(SPRs) for specific functions like I/O port control and timers, and file registers.
The program memory stores the instructions that the CPU executes. It is typically non-volatile
and can be Flash or ROM memory, with sizes ranging from 1K to 14K words. The data memory
includes RAM for temporary data storage and EEPROM for non-volatile data storage.
The microcontroller has multiple I/O ports that enable communication with external devices.
These ports can be configured as inputs or outputs and are used for tasks such as reading sensor
data, controlling actuators, and interfacing with peripherals.
There are built-in timers and counters for timing and counting operations, allowing tasks such as
generating delays, measuring time intervals, and generating PWM signals. Interrupts are
supported, allowing for efficient handling of real-time tasks triggered by internal or external
events.
The PIC16 microcontrollers offer a range of on-chip peripherals, including ADCs, DACs,
USARTs, SPI modules, and I2C modules. These peripherals provide additional functionality and
enhance the capabilities of the microcontroller
The PIC16 microcontrollers have a simple and efficient architecture, making them suitable for a
wide range of embedded systems applications.
5
Here is a simplified block diagram of the PIC16 architecture:
1. Harvard Architecture
Separate Memory Spaces: The PIC16 microcontrollers use a Harvard architecture,
which means they have separate program and data memory spaces. This allows simultaneous
access to both instruction and data, enhancing performance.
2. CPU and Instruction Set
Central Processing Unit (CPU): The CPU executes instructions and includes an
Instruction Set Architecture (ISA) that supports various operations, such as arithmetic, logic,
control, and bit-manipulation instructions.
RISC Architecture: The PIC16 series employs a Reduced Instruction Set Computing
(RISC) architecture, simplifying the instruction set for faster execution.
6
3. Memory Organization
Program Memory: Typically, non-volatile memory (Flash or ROM) used to store the
program code. Sizes range from 1K to 14K words.
Data Memory: Comprises RAM for temporary data storage and EEPROM for nonvolatile
data storage.
4. Registers
General-Purpose Registers (GPRs): Used for general data storage.
Special-Purpose Registers (SPRs): Used for specific functions like I/O port control,
timers, and status flags.
File Registers: A part of the data memory used for specific purposes, including GPRs and
SPRs.
5. I/O Ports
Multiple I/O Ports: These ports allow communication with external devices and can be
configured as inputs or outputs. They are used for reading sensor data, controlling actuators,
and interfacing with peripherals.
6. Timers and Counters
Built-in Timers and Counters: Used for timing and counting operations, generating
delays, measuring time intervals, and producing PWM signals.
7. Interrupts
Interrupt Handling: The PIC16 microcontrollers support interrupts, which enable
efficient handling of real-time tasks triggered by internal or external events.
8. On-Chip Peripherals
Analog-to-Digital Converters (ADCs)
Digital-to-Analog Converters (DACs)
Universal Synchronous Asynchronous Receiver Transmitters (USARTs)
Serial Peripheral Interface (SPI) Modules
Inter-Integrated Circuit (I2C) Modules These peripherals enhance the microcontroller's
functionality, making it suitable for various applications.
9. Power Management
Low Power Consumption: Designed for applications requiring efficient power usage, the
PIC16 microcontrollers often feature multiple power-saving modes.
10. Development Tools
MPLAB® X IDE: An Integrated Development Environment (IDE) provided by
Microchip for developing applications on PIC microcontrollers.
MPLAB Code Configurator (MCC): A graphical programming tool that simplifies
peripheral setup and code generation.
7
Chapter 5 : Advanced in C Programming
Overview: Take your C programming skills to new heights! The objective of this class is to
enable you to use advanced C programming language constructs and techniques to create
more structured and portable code. You will be able to create structures, unions, and bit
fields. You will use advanced pointer concepts to allow very flexible data access and create
arrays of pointers, arrays of structures and unions, and pointers to arrays of structures and
unions. You will create nested structures and unions along with flexible „typedef‟ methods
to set up data structures and variables. Function pointers are an important concept of the C
programming language and you will use arrays and structures of function pointers to create
portable and flexible state machines. Dereferenced double pointers are discussed in detail.
This class includes 7 instructor-led hands-on labs that clearly demonstrate each concept. You
will use MPLABX® with the powerful built-in simulator and Microchip's XC32 compiler to
analyze the actual effect of coding implementations on variables and to see the interaction of
program and data memory values. You will learn these C language topics from a non-
hardware framework so that you can focus on learning the C language instead of the
microcontroller architecture. The techniques taught in this class are universal ANSI-C
concepts of the C programming language. Before attending this class, attendees should be
proficient with the fundamentals of C programming and have experience writing embedded
C firmware.
This module aims to enhance your skills in writing efficient and optimized code for
microcontrollers. The module covers several key topics, including:
Memory Management: Understanding memory organization in embedded systems, including
the use of stack and heap memory, and techniques for efficient memory allocation and
deallocation.
Pointers and Data Structures: Exploring advanced pointer concepts and their applications in
data structures like linked lists, queues, and stacks. You will learn how to implement and
manipulate these data structures efficiently in embedded systems.
Interrupt Handling: Understanding the concept of interrupts, their importance in real- time
systems, and how to handle them effectively. You will learn how to write interrupt service
routines (ISRs) and handle nested interrupts.
8
Low-Level I/O Programming: Exploring low-level I/O techniques for reading from and
writing to hardware peripherals, such as GPIO (General Purpose Input/Output) ports, timers,
and UART (Universal Asynchronous Receiver-Transmitter) interfaces.
Throughout the module, you will have hands-on coding exercises and projects to reinforce
your learning. These exercises will involve implementing various algorithms and techniques
using the C programming language, specifically focused on embedded systems. By the end
of the module, you will have gained proficiency in advanced C programming techniques
essential for embedded systems development. You will be able to write optimized code,
efficiently manage memory, manipulate bits, handle interrupts, and interface with hardware
peripherals effectively.
9
5. Bitwise Operations
Efficient Bit Manipulation: Using bitwise operators for efficient data processing,
such as setting, clearing, toggling, and checking specific bits in a variable. This is
especially useful in embedded systems for register manipulation and flag management.
Bit Fields in Structures: Defining and using bit fields within structures to compactly
represent data that spans multiple bits, saving memory and simplifying code.
6. Inline Assembly
Embedding Assembly Code: Integrating assembly code within C programs for
performance-critical sections, allowing for fine-grained control over hardware and
optimized execution.
7. Code Optimization Techniques
Compiler Optimizations: Leveraging compiler optimization flags and pragmas to
improve the performance and efficiency of the generated machine code.
Algorithmic Optimizations: Applying algorithmic improvements and best practices to
reduce time complexity (e.g., using more efficient sorting algorithms or data structures).
8. Portability and Standardization
Writing Portable Code: Ensuring code can be compiled and run on different
platforms by adhering to ANSI C standards and avoiding platform-specific features.
Conditional Compilation: Using preprocessor directives (#ifdef, #ifndef, #if, #else,
#endif) to include or exclude code segments based on compilation conditions, enhancing
portability and configurability.
9. Debugging and Profiling
Advanced Debugging Techniques: Using advanced features of debuggers (like GDB)
for setting watchpoints, examining memory, and debugging multi-threaded applications.
Profiling Tools: Employing profiling tools (such as gprof or perf) to analyze the
performance of your code, identify bottlenecks, and optimize resource usage.
10. Design Patterns in C
Creational Patterns: Implementing singleton, factory, and builder patterns to manage
object creation and initialization.
Structural Patterns: Utilizing adapter, bridge, and composite patterns to create
flexible and maintainable code structures.
Behavioural Patterns: Applying strategy, observer, and state patterns to manage
algorithms, communication, and state transitions within your programs.
Practical Applications and Examples
Embedded Systems: Applying these advanced techniques to develop efficient and
reliable firmware for microcontrollers and embedded devices.
System Programming: Writing low-level system software, such as operating system
kernels, device drivers, and system utilities.
10
Chapter 6: C Programming with Linked List Data Structures
Overview: When you complete this class you will be able to create a PIC16F1xxx
application from scratch using State Machines, MPLAB® X and MPLAB Code
Configurator (MCC). You will be able to configure GPIO, Timer, USART and ADC using
MCC.
Using a State Machine format, we will create our PIC16F1619 Application on a Curiosity
Demo Board using MPLABX IDE. We will use MPLAB Code Configurator (MCC) to
Initialize our System and Interface Hardware. The Application will involve step-by-step
creation of our code.
C Programming with Linked List Data Structures module focuses on teaching participants
about linked list data structures and their implementation in the C programming language.
Let's break down each topic within this module:
11
implementation and manipulation of doubly linked lists, including node insertion, deletion,
and traversal.
Implementation Tips: While implementing doubly linked lists, care must be taken to
update both the previous and next pointers during insertion and deletion operations to
maintain the integrity of the list.
Use Cases: Doubly linked lists are particularly useful in applications where bidirectional
traversal is required, such as in the implementation of LRU (Least Recently Used) cache and
in many undo-redo functionalities in software applications.
12
6.7 Advantages and Disadvantages of Linked Lists
Linked lists have their own advantages and disadvantages compared to other data
structures. Participants will learn about the pros and cons of linked lists, including their
efficient insertion and deletion operations but slower random access time.
Advanced Considerations: While linked lists offer flexibility and ease of insertion and
deletion, their poor cache performance due to non-contiguous memory access can be a
significant disadvantage in high-performance applications. Optimizations like array-based
linked lists or hybrid structures can sometimes provide a middle ground.
Real-World Applications: Linked lists are extensively used in various real world
applications such as dynamic memory allocators, managing free memory blocks (free lists),
and in operating systems for managing processes and tasks in scheduling algorithms.
13
Chapter 7: Syntax and Structures of C
Overview: This class will enable you to begin writing embedded C language firmware for
microcontrollers. Most major C language constructs will be covered, including variables,
constants, operators, expressions and statements, decision functionality, loops, functions,
arrays, multi-file projects, and data pointers. You will learn all of these C language topics
from a non-hardware framework so that you can focus on learning the C language instead of
the microcontroller architecture.
The presentation will be accompanied by instructor-led code demonstrations that will be
conducted with the powerful MPLAB® simulator. Skills learned in this class will be
applicable to any ANSI C compiler. At the end of the class, you will have the opportunity to
apply your knowledge to program a microcontroller to perform basic input and output
functionality and control. You will also use the MPLAB X IDE to perform actual debugging
on a microcontroller and execute some basic debugging techniques. While not required,
previous experience with any programming language or experience with microcontrollers
would be helpful.
14
return values. Additionally, the topic covers pointers, which are variables that store memory
addresses. Participants will learn how to declare, initialize, and use pointers in their code.
Function Pointers: These allow you to store the address of a function in a variable,
enabling dynamic function calls and creating function tables for state machines.
Pointer Arithmetic: Understanding how to perform arithmetic operations on pointers to
navigate through arrays and data structures efficiently.
Memory Management: Deep dive into dynamic memory management, including
implementing custom memory allocators for better control over memory usage.
15
Packed Structures: Creating packed structures to ensure data is stored with minimal
padding, which is crucial in memory-constrained environments.
Type Safety: Advanced techniques to maintain type safety while using unions and
structures.
16
Chapter 8: Getting Started with PIC16F1xxx MCUs using MCC
and State Machines
Overview: When you complete this class, you will be able to create a PIC16F1xxx
application from scratch using State Machines, MPLAB® X and MPLAB Code
Configurator (MCC). You will be able to configure GPIO, Timer, USART and ADC using
MCC.
Using a State Machine format, we will create our PIC16F1619 Application on a Curiosity
Demo Board using MPLABX IDE. We will use MPLAB Code Configurator (MCC) to
Initialize our System and Interface Hardware.
Getting started with PIC16F1xxx MCUs (Microcontrollers) using the MPLAB Code
Configurator (MCC) and state machines can simplify the development process. Here is a
step-by-step guide to help you get started:
17
Version Control: Employ version control systems (VCS) like Git for tracking changes
and collaboration. Implement branching strategies (e.g., Git Flow) to manage development,
testing, and production branches.
Automated Builds: Use Continuous Integration (CI) tools like Jenkins or GitHub Actions
to automate builds and run tests. This ensures early detection of integration issues.
18
Code Metrics: Use tools like SonarQube to analyse code quality metrics such as
cyclomatic complexity, code duplication, and potential bugs. Regularly refactor code to
address issues identified by these tools.
Coding Standards: Adhere to coding standards such as MISRA C for safety-critical
systems. This reduces the likelihood of introducing bugs and ensures consistent coding
practices across the team.
19
Refactor the code to improve readability, maintainability, and modularity.
Compiler Optimizations: Use compiler optimization flags to improve code performance.
Understand the trade-offs between different optimization levels (e.g., - O2 for balanced
optimization and -O3 for maximum speed).
Energy Efficiency: Apply techniques such as dynamic voltage and frequency scaling
(DVFS) to reduce power consumption. Use power profiling tools to measure and optimize
energy usage.
20
Chapter 9: Advanced Embedded C Tips, Tricks, and Cautions
Overview: Even if you have a good base knowledge of more advanced C programming
concepts, this class will challenge you on some things you may not know about
programming in C and help to take your programming skills to new levels! There are so
many things you can do with your C programming projects that will reduce your code size,
improve execution time, and keep you out of trouble! We will look at some common
mistakes that are made by even the best programmers, including comparison and value
setting confusion, neglecting implicit conversions and sequence points, mixing variable
types, misusing macros, and ignoring side effects. This course will also show you some nice
concepts to help reduce your code size and make your projects easier to read. These
concepts include header file inclusion, using typedefs for function pointers and structures,
performing floating point math without hardware floating point units or firmware libraries,
and initializing and clearing structures and unions. This material is presented with the
assumption that you are already familiar with advanced C programming concepts.
When working with embedded systems and writing code in C, it's important to keep
in mind some advanced tips, tricks, and cautions to ensure efficient code execution,
maintainability, and reliability. Here are some key points to consider:
21
9.3. Use Volatile Keyword
Use the `volatile` keyword for variables that can be modified by hardware interrupts or
other threads. This ensures that the compiler doesn't optimize away reads or writes to these
variables, guaranteeing their correctness.
Memory-Mapped Registers: Ensure volatile is used for memory-mapped peripheral
registers to prevent the compiler from optimizing out necessary reads/writes.
Concurrency: Use volatile in conjunction with proper synchronization mechanisms in
multi-threaded or interrupt-driven code to maintain data integrity.
22
9.7. Handle Interrupts Properly
Handle interrupts carefully to ensure the proper execution of critical code. Keep interrupt
service routines (ISRs) short and avoid time-consuming operations within ISRs. Use proper
interrupt prioritization and nesting if supported by the hardware.
Nested Interrupts: Understand the microcontroller’s support for nested interrupts and
configure priorities correctly to avoid deadlocks or missed interrupts.
Context Saving: Ensure that the interrupt service routines (ISRs) save and restore the
necessary context to prevent corruption of the main program flow.
23
Chapter 10: C Programming Callbacks
Real-Time Operating Systems (RTOS): Learn about various RTOS like Free RTOS,
VxWorks, and RTEMS. Understand their architectures, task scheduling algorithms, and how
they handle real-time constraints.
Types of Real-Time Systems: Differentiate between hard real-time and soft real-time
systems. Hard real-time systems have strict timing constraints (e.g., automotive systems),
while soft real-time systems can tolerate some delays (e.g., multimedia systems).
24
10.2. Scheduling Algorithms
You would learn about function pointers in C, which are essential for implementing
callbacks. You would understand how function pointers work and how to declare and use
them in your code.
Rate Monotonic Scheduling (RMS): RMS is a fixed-priority algorithm where tasks with
shorter periods are given higher priority. It’s suitable for periodic tasks.
Earliest Deadline First (EDF): EDF dynamically assigns priorities based on the closest
deadline. This algorithm is optimal for both periodic and aperiodic tasks.
Least Laxity First (LLF): LLF schedules tasks based on their laxity (the difference
between the deadline and remaining computation time). This approach is useful in handling
dynamic task priorities.
Semaphores: Use semaphores for signaling and mutual exclusion. Binary semaphores
(mutexes) are for locking resources, while counting semaphores manage access to a pool of
resources.
Event Flags: Event flags allow tasks to wait for specific conditions to be met before
proceeding. This mechanism is useful for synchronizing tasks based on complex events.
25
Deferred Interrupt Processing: Use deferred interrupt processing techniques like bottom
halves or task lets to handle non-critical tasks outside of the ISR context, reducing ISR
execution time.
Interrupt Priorities: Configure interrupt priorities based on the criticality of tasks. Ensure
that high-priority interrupts are not blocked by lower-priority ones.
Task Management: RTOS services for creating, deleting, suspending, and resuming tasks.
Understand task states (running, ready, blocked) and context switching.
Time Management: Use RTOS time management services for implementing delays,
timeouts, and periodic task execution. Understand the tick rate and its impact on system
performance.
Profiling and Benchmarking: Use profiling tools to measure task execution times,
context switch times, and interrupt latencies. Benchmark the system under different load
conditions to identify performance bottlenecks.
Power Management: Implement power management strategies like dynamic voltage and
frequency scaling (DVFS) to reduce power consumption. Use sleep modes and wake-up
sources to manage energy efficiently.
26
Chapter 11: Design Considerations for Your First IoT Project
Overview: In the Internet of Things, the Things must conform to the Internet, not the other
way around. If you’re just dipping your toes into the IoT, this class is for you. Adding
network connectivity to an embedded product is complex. This class will explore the
foundations of Internet communication. Routers, switches, IP and hardware addressing,
DHCP, NAT, TCP and UDP transport layers, ports, sockets, and DNS will be explained.
The MQTT eco-system will be described, including the pub/sub model, brokers, topics, and
the JSON data structure. Lastly, tools for analyzing these packets and data structures will be
demonstrated (e.g. Wireshark). This class is meant for the engineer who has no problem
setting up their own home network, but has not necessarily explored the detailed
requirements for an IoT device to exchange data with an internet resource.
Designing an IoT project requires careful consideration of various factors to ensure its
successful implementation. Here are some key design considerations for your first IoT
project module in an Embedded Systems Developer Virtual Internship:
Stakeholder Analysis: Identify all stakeholders and their requirements early in the project.
Understand their expectations, and define clear objectives and success criteria.
Use Case Scenarios: Develop detailed use case scenarios that describe how users will
interact with the IoT system. This helps in understanding the user journey and identifying
potential challenges.
27
Sensor Selection: Select sensors based on accuracy, range, and power requirements.
Consider environmental conditions (e.g., temperature, humidity) and sensor calibration
needs.
29
Encryption: Use strong encryption (e.g., AES-256) for data at rest and in transit to prevent
unauthorized access. Implement SSL/TLS for secure communication over the internet.
Authentication and Authorization: Implement secure authentication mechanisms (e.g.,
OAuth, JWT) and enforce strict access controls. Use multi-factor authentication for added
security.
30
Chapter 12: Exploring Bluetooth® Low Energy (BLE) From
First Steps To Final Application
Overview: Struggling to understand how Bluetooth Low Energy (BLE) works? Looking to
start a BLE design? This class is for engineers who want to learn BLE with little to no
background at all. Concepts covered include BLE Specification, connectivity and data
transfer as relates to typical applications. If you need to replace cables in your application
with BLE in the hands-on portion, you will learn how to create a serial port replacement
application in 15 minutes. The hands-on labs will use the PIC/AVR-BLE board and will also
cover sensor acquisition to phone communication using Punch Through's Light blue
Explorer mobile app.
The "Exploring Bluetooth Low Energy from First Steps to Final Application" module
in an Embedded Systems Developer Virtual Internship focuses on understanding and
implementing Bluetooth Low Energy (BLE) technology in IoT applications. Here's an
overview of what this module covers:
31
12.1. Introduction to Bluetooth Low Energy (BLE)
Understand the basics of BLE technology, its advantages, and its use cases in IoT
applications. Learn about the differences between traditional Bluetooth and BLE.
Use Cases: Explore various use cases of BLE in different domains like healthcare (e.g.,
fitness trackers), smart home (e.g., smart locks), automotive (e.g., keyless entry systems),
and retail (e.g., beacons for customer engagement).
History and Evolution: Understand the history of BLE, which was introduced in
Bluetooth 4.0 to cater to low-power applications, differentiating it from the classic Bluetooth
aimed at high data rate transmissions.
Core Specifications: Dive into the core specifications of BLE, which include profiles,
roles, security features, and the Generic Access Profile (GAP) and Generic Attribute Profile
(GATT).
32
12.4. BLE Profiles and Services
Dive deeper into the GATT protocol, which is used for data exchange between BLE
devices. Understand GATT attributes, services, characteristics, and descriptors.
Interoperability: Ensure interoperability with other BLE devices by adhering to standard
profiles. Use tools like the Bluetooth SIG's Profile Tuning Suite (PTS) to test compliance.
Standard Profiles: Familiarize yourself with standard BLE profiles such as Heart Rate,
Battery Service, and Environmental Sensing. These profiles define how specific applications
should communicate.
Custom Profiles: Learn to create custom profiles for your specific application needs,
including defining custom services and characteristics.
33
Throughput Optimization: Optimize data throughput by adjusting the Maximum
Transmission Unit (MTU) size and using Data Length Extension (DLE) features of
Bluetooth 5.
Read/Write Operations: Perform read and write operations on characteristics,
understanding the differences between read, write, write without response, and long write.
Notifications and Indications: Use notifications and indications to enable real-time data
updates from the peripheral to the central device.
34
Production Testing: Develop and execute a comprehensive production testing plan to
validate BLE functionality, performance, and reliability in the final product.
Prototyping and Testing: Develop prototypes and test them rigorously to ensure
reliability and performance. Use tools like nRF Connect, Light-blue Explorer, and others for
testing.
Certification and Compliance: Understand the certification process for BLE devices,
including compliance with Bluetooth SIG standards and regulatory requirements for
different regions.
Ecosystem Integration
Cloud Services: Integrate BLE devices with cloud services to enable remote monitoring
and control. Platforms like AWS IoT, Azure IoT Hub, and Google Cloud IoT offer robust
services for BLE devices.
Mobile App Development: Develop companion mobile applications for iOS and Android
to interact with BLE devices. Use platform-specific libraries like Core Bluetooth for iOS and
Bluetooth Low Energy API for Android.
35
Chapter 13: Creating a Sensor Node for Azure IoT Central
Overview: Most embedded developers are not expected to create professional cloud
applications but may need a simple application to test and demonstrate their custom sensor
data being reported to the cloud. This class will help you create a proof-of concept IoT
sensor node which connects to the Microsoft Azure Cloud.
You will learn how to use Microchip’s MPLAB X IDE to modify a baseline IoT
sensor project to incorporate your own telemetry and then use Microsoft Azure’s IoT Central
builder to create a dashboard to visualize the sensor values.
This class will use the Microchip SAM-IoT WG development board, combined with
a Microelectronic Weather Click sensor board to emulate an outdoor environmental sensor
node communicating periodic temperature, humidity, and pressure data to an IoT Central
cloud application. The hands-on lab exercises will step through the procedures needed to
provision the SAM-IoT board to connect and authenticate with Azure Cloud Services, as
well as creating the IoT Central application and then extending the cloud application further
to create queries, run jobs, and set rules.
The "Creating a Sensor Node for Azure IoT Central" module in an Embedded Systems
Developer Virtual Internship focuses on building a sensor node that can connect to Azure
IoT Central platform. Here's an overview of what this module covers:
36
13.1. Selecting the Right Hardware
Understand the basics of Azure IoT Central, a cloud-based platform for managing and
monitoring IoT devices. Learn about its features, benefits, and how it can be used for IoT
applications.
MCU Selection: Choose a microcontroller that supports connectivity and has sufficient
processing power. Consider options like the ESP32, STM32, or Texas Instruments' CC3200.
Sensors: Select sensors based on the application needs. Common sensors include
temperature (e.g., DHT22), humidity, pressure (e.g., BMP280), light (e.g., BH1750), and
motion (e.g., MPU6050).
37
13.5. Data Acquisition and Processing
Understand how to connect the sensor node to Azure IoT Central using the appropriate
communication protocol, such as MQTT or HTTP. Learn how to create a device template in
Azure IoT Central to define the capabilities and properties of the sensor node.
Sensor Data Acquisition: Implement efficient sensor data acquisition routines, using
appropriate libraries and drivers for your sensors.
Data Filtering and Aggregation: Apply data filtering techniques (e.g., moving average,
Kalman filter) to improve data quality. Aggregate data if needed to reduce the amount of
data sent to the cloud.
38
13.9. Data Analytics and Visualization
Perform testing and debugging to ensure the proper functioning of the sensor node and its
integration with Azure IoT Central. Learn how to diagnose and resolve common issues that
may arise during the development process.
Telemetry Data: Use Azure IoT Central's telemetry capabilities to visualize sensor data in
real-time. Create dashboards and charts to monitor device health and performance.
Rules and Alerts: Set up rules and alerts in Azure IoT Central to trigger actions based on
specific conditions, such as temperature thresholds or device connectivity issues.
Edge Computing
Edge Processing: Implement edge processing capabilities to perform data analytics and
decision-making locally on the device, reducing latency and bandwidth usage.
Azure IoT Edge: Consider using Azure IoT Edge for deploying cloud intelligence on
edge devices. This allows for more complex processing and integration with Azure services.
39
Real-World Applications
Industrial IoT: Implement sensor nodes in industrial environments for monitoring
machinery, predictive maintenance, and optimizing operations.
Smart Agriculture: Deploy sensor nodes in agricultural fields to monitor soil moisture,
temperature, and crop health, enabling precision farming.
40
Chapter 14: Motor Control Workshop Using dsPIC Digital
Signal Controllers (DSC) Dual Core Devices
Overview: This workshop class is for those aiming for a clear understanding of 3- phase
brushless permanent magnet motors and their control at the fundamental level. BLDC
(Brushless DC) and permanent magnet synchronous motor (PMSM) designs are reviewed
along with the classic control algorithms used for each. The material covers the dsPIC33xx
architecture and motor control peripherals, along with an in- depth look at the Microchip
demo board, MCLV-2. The workshop will also provide two hands-on labs using a
dsPIC33CH128MP508, which will cover sensored BLDC (six step) control, sensor less
BLDC (six step) control and sensor less PMSM (Field Oriented) control. An additional
introduction will be presented for using and debugging a Dual Core device. These labs will
also use a new highspeed "X2CScope" virtual oscilloscope for tuning and control purposes.
This class provides a foundation from which further motor control refinements and control
techniques can be explored with confidence.
The "Motor Control Workshop Using dsPIC Digital Signal Controllers (DSC) Dual Core
Devices" module in an Embedded Systems Developer Virtual Internship focuses on building
motor control applications using dsPIC Digital Signal Controllers (DSC) Dual Core devices.
Here's a breakdown of what this module covers:
41
14.1. Introduction to Motor Control with dsPIC DSCs
Understand the basics of dsPIC DSCs, which are specialized microcontrollers designed for
digital signal processing and motor control applications. Learn about their features,
architecture, and advantages in motor control systems.
Overview: dsPIC DSCs are specialized microcontrollers designed for high performance
motor control applications. They combine the features of microcontrollers with digital signal
processing (DSP) capabilities.
Advantages: These devices offer advantages such as precise control, real-time
performance, and efficient handling of complex algorithms, making them ideal for various
motor control applications.
42
14.5. Motor Control Basics
Develop firmware using C or assembly language to control the motor using the dsPIC
DSC. Understand how to configure and utilize the features of the dsPIC DSC, such as PWM
generation, ADC conversion, and communication interfaces.
Types of Motors: Understand the types of motors commonly used in motor control
applications, including Brushed DC motors, Brushless DC (BLDC) motors, Permanent
Magnet Synchronous Motors (PMSM), and Stepper motors.
Control Techniques: Familiarize yourself with basic control techniques such as openloop
control, closed-loop control, and various control algorithms like PID control, Field-Oriented
Control (FOC), and Direct Torque Control (DTC).
43
Encoder Integration: Integrate quadrature encoders for precise position and speed
feedback. QEI modules in dsPIC DSCs decode the encoder signals and provide real time
position and velocity information.
Implementation: Configure the QEI module to read encoder signals, handle index pulses,
and implement position/speed calculation algorithms.
44
Safety and Protection Mechanisms
Overcurrent Protection: Implement overcurrent protection mechanisms to prevent
damage to the motor and drive circuitry. Use current sensing techniques and shutdown
PWM outputs in case of overcurrent conditions.
Overtemperature Protection: Monitor temperature sensors to prevent overheating of the
motor and drive components. Implement thermal shutdown or derating strategies.
Communication Protocols
CAN Communication: Utilize the Controller Area Network (CAN) interface for robust
communication in industrial motor control applications. Implement CANopen or other
higher-layer protocols as needed.
Wireless Communication: Integrate wireless communication modules (e.g., Bluetooth,
Wi-Fi) for remote monitoring and control of motor systems.
Power Electronics
Inverter Design: Understand the design of inverters used in motor control applications.
Learn about different inverter topologies (e.g., H-bridge, three-phase inverters) and their
control strategies.
Gate Drivers: Select and implement appropriate gate drivers for switching the power
devices (e.g., MOSFETs, IGBTs) in your motor drive circuit.
45
Chapter 15: Introduction to MPLAB X IDE
Overview: This class covers the basics of the MPLAB® X IDE. This class will guide you
through the steps of creating a simple "blink an LED" program using one of our popular PIC
MCU Nano development boards. You will learn how to create a project from scratch, how to
navigate the IDE, how to write and debug a simple program and then how to test your code
on an actual development board. [English and Spanish subtitles available in video player]
46
15.1. Overview of MPLAB X IDE
MPLAB X IDE allows you to create, manage, and organize projects for your embedded
applications. You can easily add and remove source files, libraries, and configuration files,
and set project properties.
Integrated Development Environment (IDE): MPLAB X IDE is an integrated
development environment designed for developing applications for Microchip’s
microcontrollers and digital signal controllers. It provides a comprehensive suite of tools for
writing, debugging, and optimizing code.
Cross-Platform Compatibility: MPLAB X IDE is built on the NetBeans platform,
making it compatible with Windows, macOS, and Linux operating systems. This cross
platform support ensures flexibility and accessibility for developers.
47
15.4. Writing and Editing Code
The IDE provides an intuitive interface to configure and customize the settings of your
Microchip microcontroller or DSC. You can set clock frequencies, pin assignments, and
other device-specific parameters.
Code Editor: The MPLAB X IDE code editor provides features like syntax highlighting,
code completion, and error highlighting. Utilize these features to write and edit your source
code efficiently.
Code Templates and Snippets: Use code templates and snippets to insert common code
structures quickly. MPLAB X IDE allows you to create custom templates for repetitive
tasks.
Refactoring Tools: The IDE offers refactoring tools to improve code quality and
maintainability. Use features like rename, extract method, and inline to refactor your code
effectively.
48
Code Profiling and Analysis: Use code profiling and analysis tools to optimize your
application’s performance. Analyze execution time, memory usage, and code coverage to
identify bottlenecks and optimize your code.
Version Control Integration: Integrate version control systems like Git and Subversion
with MPLAB X IDE. Use the built-in version control tools to manage your source code
repository, track changes, and collaborate with team members.
Code Coverage: Measure code coverage to ensure that all parts of your code are tested.
MPLAB X IDE can generate code coverage reports, highlighting untested code paths.
Project Collaboration
Team Collaboration: Use MPLAB X IDE’s collaboration features to work with team
members. Share projects, configurations, and code through version control systems.
Leverage tools like code review and merge requests to maintain code quality.
Documentation: Maintain comprehensive documentation within your projects. Use
comments, README files, and project notes to document code functionality, design
decisions, and usage instructions.
49
CONCLUSION
The journey through this comprehensive guide on Embedded Systems Development has
been meticulously structured to provide an in-depth understanding of various facets of the
field. From the foundational concepts of microcontrollers to the advanced nuances of IoT
integration and motor control, this document serves as an extensive resource for both
beginners and seasoned professionals.
Key Takeaways
1. Microcontroller Fundamentals: The exploration of the PIC16 series microcontrollers
highlighted the significance of 8-bit architecture in embedded systems. Understanding
the core architecture, instruction set, and peripheral interface of PIC microcontrollers
lays the groundwork for effective system design and development.
3. Motor Control with dsPIC DSCs: The detailed insights into motor control using dsPIC
Digital Signal Controllers underscored the importance of precision and realtime
performance in controlling various types of motors. The dual-core architecture and
advanced peripherals of dsPIC DSCs make them ideal for complex motor control
applications.
4. IoT Integration: The sections on creating sensor nodes for Azure IoT Central and
design considerations for IoT projects provided a comprehensive overview of the steps
involved in connecting and managing devices in the cloud. Emphasizing security,
scalability, and power management ensures the reliability and longevity of IoT solutions.
5. Bluetooth® Low Energy (BLE): The exploration of BLE technology from basics to
final application demonstrated the versatility and efficiency of BLE in creating low
power, short-range wireless communication systems. Understanding the protocol stack
and application development in BLE is crucial for modern IoT applications.
6. Development Tools: The introduction to MPLAB X IDE and its features illustrated the
importance of a robust development environment in embedded systems. Efficient use of
debugging tools, simulators, and code optimization techniques significantly enhances the
development process.
50
Personal Experience and Reflection
The Embedded Systems Developer Virtual Internship has been an enriching and
fulfilling experience that has significantly enhanced my skills and knowledge in the
field. Through hands-on projects and assignments, I have gained practical experience
with the MPLAB X IDE module, allowing me to effectively develop, debug, and
program embedded applications.
Collaborating with industry professionals and fellow interns during this internship has
been invaluable. The opportunity to share knowledge, exchange ideas, and learn from
others in the field has broadened my perspective and exposed me to different approaches
and best practices. This collaborative environment has not only enhanced my technical
skills but also allowed me to develop strong teamwork and communication skills, which
are vital in a professional setting.
Finally, the Embedded Systems Developer Virtual Internship has equipped me with the
necessary tools and expertise to excel in the field of embedded systems development. I
am confident in my ability to contribute to the development of innovative solutions in
industries that rely on embedded systems. This internship has been a stepping stone
towards a successful career, and I am excited to apply the skills and knowledge gained to
make a meaningful impact in the industry.
Final Thoughts
This document serves as a foundational pillar for anyone looking to delve into the world
of embedded systems. The detailed explanations, practical examples, and advanced
topics covered here provide a solid base for further exploration and innovation. As
technology continues to advance, staying abreast of the latest developments and
continuously enhancing one’s skills will be paramount.
Embedded systems are at the heart of modern technology, driving innovation across
industries. Whether you are designing a simple microcontroller-based project or a
complex IoT solution, the knowledge and insights gained from this guide will
undoubtedly aid you in achieving your goals. As we look to the future, the possibilities
within embedded systems are boundless, and the journey of learning and discovery is
just beginning.
51