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

EmbeddedSystems Week1

The document outlines a course on Embedded Systems at OSTİM Technical University, led by Şamil Korkmaz, who has extensive experience in aerospace simulations. It covers the importance of embedded systems in various applications, the role of microcontrollers, and the skills students will develop, including real-time control and concurrent task management using platforms like ESP32 and FreeRTOS. The course aims to generate interest in embedded systems, offering hands-on experience and preparing students for challenges in IoT, robotics, and embedded AI.

Uploaded by

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

EmbeddedSystems Week1

The document outlines a course on Embedded Systems at OSTİM Technical University, led by Şamil Korkmaz, who has extensive experience in aerospace simulations. It covers the importance of embedded systems in various applications, the role of microcontrollers, and the skills students will develop, including real-time control and concurrent task management using platforms like ESP32 and FreeRTOS. The course aims to generate interest in embedded systems, offering hands-on experience and preparing students for challenges in IoT, robotics, and embedded AI.

Uploaded by

nazlicansoyer06
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

Embedded Systems

Programming (CENG/BİL 462)


Week 1
OSTİM Technical University Computer Engineering
Fall 2025
Şamil Korkmaz
● Hello everybody. My name is Şamil Korkmaz, and I have been working as an
engineer for 29 years, primarily focusing on aerospace simulations since
1996.
● Simulations use mathematical models to reduce costs and risks by testing
systems on a computer before real-world deployment. Testing a real missile
system can cost more than a couple of million dollars per test. In a typical
project, you can only have around 15 live tests, which is not enough to cover
the design space. Simulations fill that gap. They are also used in developing
tactics and strategies by testing a wide array of scenarios.
In addition to my professional work, I’ve been mentoring computer engineering
students and leading software teams for early-stage startups.
typedef enum {
DISPLAY_TIME,
EDIT_TIME
} State;

State state = DISPLAY_TIME;


//Inside a main loop
void handleEvent(Event e) {
switch (state) {
case DISPLAY_TIME:
if (e == EVT_LONG_SET) state = EDIT_TIME;
break;
case EDIT_TIME:
// handle hour/minute setting here
if (e == EVT_SAVE) state = DISPLAY_TIME;
break;

// ...
}
}

Let’s look at some examples of embedded systems from simple to complex, so that
you have a general idea

Simple Embedded Systems: deterministic but relatively simple logic — often just state
machines running on bare-metal firmware. No RTOS

Simple digital watch: Time Display Mode, long-press the Set button →
Increase/decrease time → Press Set button → Time Display Mode

State machines are often considered a design pattern, though they straddle the line
between design pattern and architectural concept. Like the Strategy, Observer, or
Singleton patterns, state machines provide a reusable way to structure behavior. They
solve a recurring design problem: “How do I organize code that changes behavior
depending on state?” The solution: represent each state explicitly, define transitions,
and make events drive movement between states.
A washing machine controller moves through states: Idle → Fill Water → Wash →
Drain → Spin → Done.
PC mouse (simple camera → DSP → position change)
RFID (Radio Frequency Identification) is a technology used for wireless
identification of objects using radio waves. It typically consists of two main parts:

1. RFID reader (interrogator) – continuously transmits a strong radio-frequency


signal using its antenna which powers the tag (if passive), communicates with
it, processes signals, and often connects to a computer or network. The reader
usually has a microcontroller or processor, firmware, communication
interfaces, and power management, which makes it an embedded system.
2. RFID tag (transponder) – antenna captures part of the RF energy from the
reader.
a. The alternating RF signal is rectified inside the tag’s chip (using
diode-like circuits) to produce DC voltage.
b. A tiny capacitor inside the tag stores this DC voltage briefly, acting like
a battery.
c. Inside the chip are transistor switches that can connect or disconnect a
load resistor (or capacitor) across the antenna. When the chip switches
the load ON, the antenna “absorbs” more energy, reducing the wave
reflected back. When the chip switches the load OFF, the antenna
reflects more energy.

By rapidly toggling this load, the tag creates a pattern (like 1s and 0s) in the
RF wave that the reader can detect. This process is called backscatter
modulation. The reader demodulates the reflected wave to recover the tag’s
bits.

Steps:
1. Reader sends Continuous/Carrier Wave (sinusoidal)
2. Tag sends “hello” (modulated)
3. Reader sends command (modulated - can be used to change data in tag
stored in EEPROM / Flash)
4. Tag sends response to command (modulated)
Pacemaker (sense beat, deliver pulse): If no natural heartbeat is detected before the
programmed interval expires, the timer ISR triggers the output stage to deliver a
pacing pulse. Sometimes RTOS, especially if data is sent outside

IoT temperature/humidity sensors – simple ones are bare-metal, but


Wi-Fi/BLE-enabled devices (e.g., ESP32) usually run FreeRTOS.
Automatic cannon and programmable airburst ammunition systems: The gun’s fire
control system measures the muzzle velocity of each round in real time. This is
usually done with muzzle velocity sensors (radar or inductive coils at the muzzle).
Since the exact speed can vary slightly shot-to-shot due to temperature, barrel wear,
propellant variation, etc., the system calculates the projectile’s expected time of flight
more accurately than just assuming nominal values. Based on this measured velocity
and the target range, the fuse is programmed electromagnetically (via an inductive
coil around the barrel near the muzzle) while the round is still traveling down the
barrel, just before it exits. That means the fuze timing is set “after firing, before muzzle
exit”. Examples: Oerlikon 35 mm AHEAD, Rheinmetall 30 mm ABM (Air Burst
Munition)
Smart (connected) E-Scooters
i. throttle → motor controller → brake cut-off
ii. GPS + GSM/LTE/LoRa modules for tracking
iii. Bluetooth for unlocking and diagnostics
iv. Battery management (BMS) with safety logic
v. Firmware update over the air (FOTA)
vi. Multiple sensors (IMU for fall/crash detection, speed sensors, etc.)
vii. Concurrent tasks:
1. Motor control (milliseconds)
2. Communication stacks (Bluetooth, LTE → often require an RTOS)
3. Logging, OTA updates, encryption, user interactions
Counter-battery radar detects artillery projectiles and, from their trajectories, locates
the position on the ground of the weapon that fired it.
Smart shooter (improves existing rifles effectiveness): Embedded + ballistics
As soon as the ECU must manage multiple concurrent real-time tasks (engine ignition
timing, fuel injection, CAN bus comms, diagnostics, safety monitoring), a structured
scheduler becomes essential.
What ABS (Anti-lock Braking System) controllers do:
1. Sample wheel speed sensors at a high rate (hundreds of Hz to kHz).
2. Run control algorithms to detect impending wheel lock.
3. Generate PWM signals to hydraulic valves and pumps in a very time-critical
way.
4. Perform safety checks (redundancy with multiple sensors, plausibility,
watchdogs disabling ABS but keeping conventional braking).
[Link]
ADAS (Advanced driver-assistance system, improves existing cars)
Autonomous Vehicles – dozens of ECUs + GPUs + sensor fusion for cameras, lidar,
radar; extremely compute-heavy
UAVs – combine IMU sensors, GPS, camera feed, motor control, and communication.
Aircraft: Multiple computers, distributed system, network
What is an embedded systems?

What do you think would define these examples, how are they different from your
laptops?

Writing better embedded software: “If you say it is a computer, it’s not an embedded
system. If you say it’s some other appliance, then it’s embedded”

A computer that is designed for a specific function. It combines hardware


(microcontroller, peripherals) and software (firmware, RTOS) to perform its task under
given constraints (cost, power, size). It bridges the gap between virtual reality and
physical reality.

Even when developing a web app, you have to make sure that the initial page load
time is less than 1s, otherwise users will navigate away. Since web apps are usually
accessed from mobile phones, you also have to make sure that your app uses
minimal amount of battery and internet bandwidth. A CENG student recently
developed a web app for service drivers to use instead of WhatsApp location sharing.
After a month, the drivers stopped using it due to high battery and internet usage. The
app has to minimize how frequently is uses the phone GPS.
Disturbances
d
x
Plant Sensor
xm

δc Navigation
xe

ac Mission
Autopilot Guidance Datalink

Embedded computing in autonomous systems:


● Reading sensor data (IMU, LiDAR, cameras, GPS).
● Running real-time control loops (stability, motor control, braking).
● Communicating over automotive/industrial buses (CAN, LIN, EtherCAT).
● Ensuring safety and reliability through watchdogs, redundancy, and fail-safes.
?
Why Learn Embedded Systems?
What is An Engineer
Engineers create maximum value with minimum resources; in this sense, they are
environmentalists. Resource constraints increases the value of an engineer
because the tighter the constraints, the more ingenuity, efficiency, and reliability
matter. Embedded systems are the ultimate example of resource-constrained
computing:

● Modern embedded/IoT: Low-power chips demand careful timing, memory


alignment, sleep modes — engineers who can handle this are in high demand.
● Safety-critical domains (automotive, aerospace, medical): Extra constraints
(safety, real-time deadlines, certification) amplify the engineer’s value.
Why Learn Embedded Systems?
● Embedded systems is at the core of smart/autonomous systems. Without
embedded systems, autonomy would just be “AI software” running in the cloud
— disconnected from reality.
● Microcontrollers (CPU, RAM, ROM, and I/O on a single chip) are getting
cheaper (32-bit CH32V003 $0.1 in bulk) and smaller → Used everywhere, new
products are developed, existing products are made smarter, demand for
developers increasing.
● One of the greatest advantages of software is that you can continuously
improve functionality and add new capabilities without changing the underlying
[Link] difficult to learn than standard app development, less
competition
● Appreciating the challenges of solving problems on low power, low memory
hardware
● Development of the tech sector in Türkiye, the Middle East and Africa
● AI resilience: embedded software engineers focus on interfacing low-level
hardware, ensuring real-time operation, and safety-critical functionality—areas
where human oversight remains essential
● You will be able to better understand and work with embedded systems
engineers
● It is an interesting hobby and easy to start your personal embedded
● development lab:
○ Projects like Arduino created open source libraries that abstract low
level detail
○ Cheap development boards (ESP32 board ~ $6) from China delivered
to your door.
○ Open source operating systems with good documentation (FreeRTOS)
○ LLMs make it very easy to dive deeper
The goal of this course is to generate interest in embedded systems and inspire
you to start your own projects. This field is rapidly evolving, offering great career
opportunities if you develop the right skills.
Provide a systems perspective. We don’t focus on low-level electronics or
microcontroller datasheets (bare-metal programming).
Using the ESP32 and FreeRTOS, students will learn how to design and implement
concurrent tasks, manage scheduling, synchronize shared resources.
By the end of the course, students will not only understand how real-time systems
differ from general-purpose computing, but also gain hands-on experience developing
small projects that integrate sensors, actuators, and communication tasks.
These skills will prepare them to tackle challenges in IoT, robotics, and embedded
AI, while reinforcing foundational CENG topics like concurrency, synchronization, and
resource management in a concrete and applied way.
To make the class more interactive and help you improve your presentation skills, I
will give you exercise prompts for your LLM of choice during the course. You will solve
the exercise, and one of you will present the solution to the class.
Course Overview

● Since I am working at TÜBİTAK SAGE during the weekdays, all courses will
be on Saturdays, 3 consecutive hours (Morning: 9:00-12:00, Afternoon:
13:00-16:00)
● I am aware that you have other courses demanding your attention, so I’ll try to
make this one as painless as possible.
● No mandatory attendance, attend only if you are interested
● No homeworks, you have enough course load. You would use LLMs solve
them and I would use LLMs to grade them anyway :)
● Two multiple choice exams, I will use the higher grade
[Link]
wMDkwOTA3?cjc=nbx3byha
Online course group to share announcements, course notes, information and ask
questions
Prerequisites
● Bring laptop to class, connect it to WiFi or your mobile hotspot, we will use
Wokwi simulator whenever possible
● Optional: Buy and bring these to class for real experience. Shopping links in
Google Classroom
C/C++
● C is standard in embedded development for decades.
○ Modern alternative: Rust toolchains are newer; debugging support is
improving but not as polished as C. Safety-critical standards (DO-178C
in aerospace, ISO 26262 in automotive) have decades of tooling and
certification workflows for C.
● Manipulate hardware registers, memory-mapped I/O (registers working like
electronic switches), and bit fields directly
● Deterministic in execution (no garbage collector pauses)
● Debugging tools (JTAG, SWD) and compilers (GCC, Clang, vendor toolchains)
are heavily optimized for C.
C exercise:
2<<3 = ?
● Beginner C programming
2 = 0b00010 → 2 << 3 = 0b10000 = 2^4 = 16. 100x faster than pow(2, 4) when using
integers and powers of 2 → A simple example showing how similar functionality can
be made much faster and lightweight (no math lib) by paying attention to low level
details
● [Link]
● bit shifting:
○ ~3-4 cycles including the sub and mov instructions
○ 1 cycle for bit shift
● pow:
○ Function call overhead: ~10-20 cycles (call/return, stack setup,
parameter passing)
○ Floating-point conversion: ~2-3 cycles each for integer→double and
double→integer conversions
○ Actual pow computation: 50-200+ cycles depending on
implementation and processor
○ Total: ~100-300 cycles for pow(2, n) with integer arguments

○ C is standard in embedded development for decades.


■ Modern alternative: Rust toolchains are newer; debugging
support is improving but not as polished as C. Safety-critical
standards (DO-178C in aerospace, ISO 26262 in automotive)
■ have decades of tooling and certification workflows for C.
○ Manipulate hardware registers, memory-mapped I/O (registers working
like electronic switches), and bitfields directly
○ Deterministic in execution (no garbage collector pauses)
○ Debugging tools (JTAG, SWD) and compilers (GCC, Clang, vendor
toolchains) are heavily optimized for C.
● Nice to have: Operating Systems (CENG 303, task priority, scheduling,
queues)
C exercise:
3<<3 = ?
3 = 0b00011 → 3 << 3 = 0b11000 = 16 + 8 = 24, note that it is not 3^4 = 81
C exercise:
int bit = 0b010;
int out = 0b111;
out &= ~bit;
printf("out:%b",out);

out: 101
Transistor → Logic Gate → Integrated Circuit (SSI → VLSI) → Microprocessor →
Microcontroller → SoC

A microcontroller is one of the most common building blocks of embedded systems,


especially for compact and low-power designs. It is a compact integrated chip that
combines a microprocessor RAM, Flash memory, and peripherals (UART, ADC,
timers, GPIO) on a single chip. However, not all embedded systems rely on
microcontrollers—some use microprocessors, DSPs, FPGAs, or even purely analog
or digital logic, depending on the performance and cost requirements.
Who knows what an Arduino is?
Microcontroller with pins to communicate with the real world
Arduino + ultrasonic distance sensor + buzzer ~ park sensor

You might also like