Embedded Software for Beginners: How Firmware Works, With Worked Examples

What embedded software is, how C code gets onto a microcontroller, and the five calculations every beginner meets, worked with ATmega328P datasheet numbers: a 1 ms timer tick, UART baud error, ADC readings, switch debounce and coin-cell battery life. Plus which language, board and tools to start with.

Embedded Software for Beginners: How Firmware Works, With Worked Examples

Embedded software is the program that runs on a small computer built into a product, usually a microcontroller, and controls its hardware directly: reading sensors, switching outputs, talking over serial links and reacting to events on time. Unlike an app on a laptop, it works inside fixed limits. On an Arduino Uno, for example, all your code has to fit in 32 KB of flash and run with 2 KB of RAM.

Key takeaways

  • The ATmega328P on an Arduino Uno has 32 KB of flash, 2 KB of SRAM and 1 KB of EEPROM, and runs at up to 16 MHz (Microchip datasheet 7810D). That is the budget most beginners first write firmware for.
  • A 1 ms timer tick on a 16 MHz clock needs a prescaler of 64 and a compare value of 249. 9,600 baud serial at 16 MHz has a 0.16% error, while 115,200 baud is off by 3.55% unless you switch on double-speed mode, which brings it to 2.12%.
  • Mechanical switches bounce. In Jack Ganssle's tests, 16 of 18 switches bounced for 1.6 ms on average and at most 6.2 ms, so he suggests a debounce period of 20 to 50 ms.
  • Sleep current decides battery life. In our example, a node that wakes every 10 s averages 15 µA and lasts about 612 days on a 220 mAh coin cell. Waking every second cuts that to 87 days.
  • C and C++ still lead professional embedded work: 33% and 37% of professionals in JetBrains' State of Embedded Development 2025. FreeRTOS is the RTOS used by 82% of RTOS users in that survey.

This guide is for engineering students and freshers who want to start writing embedded software. It covers what the software is and how it gets onto a chip. It then works through the five calculations every beginner meets in their first projects (timer, serial baud rate, ADC, debounce and battery life), with real datasheet numbers checked by a script. It ends with which language, board and tools to start on, and a 12-week learning path. If you first want the bigger picture of the hardware, read what an embedded system is and our guide to embedded systems architecture.

What is embedded software?

Embedded software is code written for a device with one dedicated job, such as a motor controller, a smart meter or a washing machine, rather than for a general-purpose computer. It usually runs on a microcontroller, starts the moment power is applied, talks to hardware through registers, and has to meet timing, memory and power limits without a user to restart it.

You will hear three words used loosely. Firmware usually means the low-level program stored in a chip's non-volatile memory that runs the device, such as a keyboard controller or a motor driver. Embedded software is the wider term. It covers firmware and also larger stacks, like the application and drivers on an embedded Linux board. Application software is what runs on top of a full operating system on a phone or PC. On a small microcontroller, firmware and embedded software are the same thing.

How is embedded software different from normal software?

The main differences are resources, timing and consequences. Embedded code often has kilobytes rather than gigabytes of memory and frequently runs without an operating system. It has to respond within a fixed time, and when it fails it can stop a machine rather than just crash a window. Those limits shape every design decision.

AspectDesktop or web softwareEmbedded software (typical microcontroller)
MemoryGigabytes of RAMKilobytes: ATmega328P 2 KB SRAM; RP2350 520 KB SRAM
Operating systemWindows, Linux, macOSNone (bare metal), a small RTOS, or embedded Linux on bigger chips
Hardware accessThrough drivers and APIsDirectly, by reading and writing peripheral registers
Timing"Fast enough" on averageHard or soft deadlines in micro- to milliseconds
FailureRestart the appWatchdog reset, fail-safe state; may affect safety
UpdatesFrequent, automaticRare; over-the-air updates must not brick the device
PowerMains or a large batteryOften a coin cell; sleep current matters (see the battery example)

How does code get from your laptop onto a microcontroller?

You write C on a PC, a cross-compiler turns it into machine code for the target chip, and a linker places that code at the addresses the chip expects. The result is converted into a hex or binary file and written into the chip's flash with a debug probe or bootloader. On reset, the chip jumps to that code and runs it.

Build flow: C source files are compiled to object files, linked with a linker script into firmware.elf, converted to hex or bin, flashed over an SWD probe or bootloader; the reset vector runs startup code and then main loops forever.
The embedded build flow. The compiler is a cross-compiler: it runs on your PC but produces code for the target chip (avr-gcc for AVR, arm-none-eabi-gcc for Arm Cortex-M). Drawn by Skill-Lync.

Three details here confuse beginners:

  • The linker script tells the linker where flash and RAM start and how big they are. Code and constants go to flash. Variables go to RAM. If your program outgrows either, the build fails here rather than on the device.
  • The ELF file keeps symbol names and line numbers so a debugger can show your C source while the chip runs. The hex or bin file is only the raw bytes that go into flash.
  • main() never returns. There is no operating system to return to, so firmware ends in an infinite loop. Before main() runs, startup code copies initial values of variables into RAM and zeroes the rest.

What does a first embedded program look like?

The classic first program blinks an LED. On an Arduino Uno, the onboard LED sits on pin PB5 of the ATmega328P. You set bit 5 of the data-direction register DDRB to make the pin an output, then toggle bit 5 of PORTB. Writing it at register level once teaches more than any library call.

#define F_CPU 16000000UL      // 16 MHz clock, used by the delay routine
#include <avr/io.h>
#include <util/delay.h>

int main(void) {
    DDRB |= (1 << DDB5);      // PB5 as output (Arduino pin 13 LED)
    while (1) {                // firmware never returns
        PORTB ^= (1 << PORTB5); // toggle the LED
        _delay_ms(500);        // 0.5 s on, 0.5 s off
    }
}

Three habits start here. Bit masks (|= to set, &= ~ to clear, ^= to toggle) change one pin without disturbing the other seven on the port. Register names come straight from the datasheet, so learning to read a datasheet is part of the job. Busy-wait delays like _delay_ms waste the CPU, which is why the next step is a hardware timer.

The same blink in the Arduino API is pinMode(13, OUTPUT) and digitalWrite. That is fine to start with, but employers test whether you know what those calls do underneath. Our Embedded C interview questions post covers the bit-manipulation and volatile questions that follow.

How do you set up a timer for a 1 ms tick?

Run a hardware timer in CTC (clear timer on compare) mode. The counter counts clock pulses divided by a prescaler N and resets when it reaches a compare value OCR, raising an interrupt each time. On a 16 MHz ATmega328P, N = 64 and OCR = 249 give an interrupt exactly every 1 ms, which is 1,000 per second.

The timer fires once every clock cycles, so the interrupt rate is:

Solve for OCR with = 1 kHz:

249 fits in an 8-bit timer (maximum 255). With N = 8 you would need 1,999, which only fits a 16-bit timer. Choosing the prescaler so that the compare value is a whole number and fits the register is the whole trick. The datasheet's own formula for CTC mode gives the pin-toggle frequency, . That is half the interrupt rate, because one full output wave needs two toggles. A 1 ms tick like this is the heartbeat for the debounce routine below and for the scheduler in an RTOS.

How do you pick a UART baud rate setting?

The UART divides the CPU clock to get its bit rate, and the divisor must be a whole number, so most baud rates come out slightly wrong. Keep the error within about ±2%. On a 16 MHz ATmega328P, 9,600 baud is off by only 0.16%. 115,200 baud is off by 3.55% in normal mode, which is risky. Double-speed mode brings it to 2.12%.

In normal asynchronous mode the datasheet (Table 19-1) gives:

For 9,600 baud: 16,000,000 / (16 × 9,600) − 1 = 103.17, so you write 103. The actual rate is 16,000,000 / (16 × 104) = 9,615 baud, which is 0.16% fast. The datasheet's table rounds this to 0.2%.

BaudModeUBRR (exact → set)ActualError
9,600÷16103.17 → 1039,615+0.16%
115,200÷167.68 → 8111,111−3.55%
115,200÷8 (double speed)16.36 → 16117,647+2.12%

Errors add up across a frame. Over 10 bits (start, 8 data, stop), a 3.55% error pushes the receiver's sampling point a third of a bit away from the centre of the last bit, before the other side's clock error is added. That is why boards meant for fast serial use "baud-friendly" crystals such as 14.7456 MHz, which divide exactly.

How do you read a sensor with the ADC?

An analogue-to-digital converter turns a voltage into a number. A 10-bit ADC gives a code from 0 to 1023, where the code equals Vin × 1024 / Vref. With an LM35 temperature sensor (10 mV per °C) at 25 °C, the output is 250 mV. With a 5 V reference that reads as code 51. Each step is 0.49 °C.

The datasheet formula and the worked numbers:

Converting back, 51 × 5.0 / 1024 = 249 mV, which reads as 24.9 °C. The problem is resolution. One step is 5.0/1024 = 4.88 mV, or 0.49 °C. A 5 V reference would also cover up to 500 °C, far beyond what the sensor can measure. Switch to the chip's internal 1.1 V reference and one step becomes 1.07 mV, or 0.107 °C. 25 °C now reads as code 232 (24.92 °C), and full scale is 110 °C, which suits a room or battery sensor. Matching the reference to the signal range is a design choice, not a detail.

Why do push buttons need debouncing?

When a mechanical contact closes, it physically bounces for a few milliseconds, so the microcontroller sees a burst of presses instead of one. Firmware fixes this by sampling the pin on a timer and accepting a new state only after it stays the same for several samples. Sampling every 5 ms and requiring four equal readings is a 20 ms filter.

Jack Ganssle measured 18 different switches, pressing each one many times. Two were badly behaved; one bounced for 157 ms when it opened. The other 16 averaged 1,557 µs of bounce with a worst case of 6,200 µs. He also observed that a 50 ms response still feels instant to a person, and recommends a debounce period of 20 to 50 ms. Our 20 ms filter covers his 6.2 ms worst case more than three times over.

Top: a raw button signal bounces between open and closed for about 4.6 ms after a press at 8 ms; a 5 ms sample at 10 ms catches it open. Bottom: the debounced state switches to pressed at 30 ms, after four equal closed samples.
A press at 8 ms bounces for 4.6 ms. The sample at 10 ms happens to catch the contact open, which is exactly why one sample is not enough. The debounced state changes at 30 ms, after four closed samples in a row. Simulated by Skill-Lync; script kept with this article.

Avoid the common beginner fix of a long delay() after the first edge. It blocks everything else the firmware should be doing. A sampled counter driven by the 1 ms timer tick costs a few bytes of RAM and no blocking.

How long will a battery-powered device last?

Average the current over one wake-sleep cycle, then divide the battery capacity by it. A sensor node that draws 5 mA for 20 ms, then sleeps at 5 µA, averages about 15 µA if it wakes every 10 s. On a 220 mAh coin cell that is about 14,700 hours, or 612 days. Waking every second cuts it to 87 days.

Battery life against wake-up interval on a log scale: 87 days at 1 s, 612 days at 10 s, 1,375 days at 60 s, approaching a 1,833-day ceiling set by the 5 µA sleep current.
Same hardware, different firmware: the wake-up interval sets battery life until sleep current takes over. Example values (5 mA active for 20 ms, 5 µA asleep, 220 mAh), not a specific product. Drawn by Skill-Lync.

Two lessons follow. First, battery life is a software decision as much as a hardware one: the same board lasts 87 days or more than three years depending on one constant in the code. Second, there is a ceiling. Even if the node never woke up, 5 µA of sleep current would drain the cell in 1,833 days, so a forgotten pull-up resistor or a peripheral left on can matter more than clever code. We used 220 mAh as a conservative design value. Energizer's datasheet for its Ultimate CR2032 rates it at 254 mAh to 2.0 V at a 15 kΩ load, and real capacity falls at higher pulse currents and low temperatures.

Which programming language should a beginner learn for embedded software?

Start with C. It is the language of chip vendors' examples, driver code and most job descriptions, and it maps closely to what the hardware does. Learn C++ next for larger firmware. Treat Rust and MicroPython as useful extras: Rust for memory safety, MicroPython for quick prototypes.

JetBrains' State of Embedded Development 2025 survey found that professionals mostly use C++ (37%) and C (33%), while hobbyists lean on Python (29%). Safety-critical teams in automotive and medical devices usually write C under the MISRA C guidelines. Their latest edition, MISRA C:2025, was released in March 2025. Rust has an official Embedded Rust book and growing support, but it is still a second language for most Indian embedded roles. You can read more on why C dominates embedded development.

LanguageUse it forTrade-off
CDrivers, bare-metal firmware, automotive ECUs (with MISRA C)No memory safety; discipline and static analysis needed
C++Larger firmware, reusable driver classes, Arduino librariesAvoid heap allocation and exceptions on small MCUs
RustNew projects that want memory safety without a garbage collectorSmaller ecosystem, fewer jobs in India today
MicroPythonPrototypes and teaching on RP2040/RP2350 or ESP32Slower, larger memory use, not for hard real-time

Which board and tools should you start with?

Begin with an Arduino Uno or a Raspberry Pi Pico 2, then move to an STM32 Nucleo board with a proper debugger. The Uno teaches registers on a simple 8-bit chip. The Pico 2 starts at $5 and has a 150 MHz dual-core RP2350. STM32 boards use the Arm Cortex-M cores you will meet in automotive and industrial jobs.

BoardChip, core and memoryWhy start here
Arduino UnoATmega328P, 8-bit AVR, 16 MHz; 32 KB flash, 2 KB SRAMSimplest datasheet; every register example in this guide runs on it
Raspberry Pi Pico 2RP2350, dual Cortex-M33 or RISC-V, 150 MHz; 4 MB flash, 520 KB SRAMFrom $5; C/C++ SDK and MicroPython
STM32 Nucleo / DiscoveryArm Cortex-M0+ to M7 (ST); memory depends on the partOn-board ST-LINK debugger; industry-standard Cortex-M
ESP32 dev kitEspressif ESP32 family; memory depends on the moduleBuilt-in Wi-Fi and Bluetooth for IoT projects

The same JetBrains survey shows what people actually use: ESP32 boards in 42% of main projects, Arduino in 37% and STM32 Nucleo or Discovery boards in 23%. For tools, you need four things: a cross-compiler (GCC), an editor or IDE (VS Code, or a vendor IDE such as STM32CubeIDE), a debug probe (built into Nucleo boards), and a cheap logic analyser for looking at serial and timing signals.

How do you test and debug embedded software?

Use four layers. Unit-test pure logic such as filters, parsers and state machines on your PC. Print over UART to trace behaviour. Step through code with a hardware debugger over SWD or JTAG. Use a logic analyser or oscilloscope to check what actually happens on the pins and when.

  • Host unit tests: keep hardware access behind small functions so the logic compiles and runs on your laptop. In the JetBrains survey, 54% of embedded developers do software testing, and only 27% use simulation.
  • printf over UART: quick, but it changes timing. Never print inside an interrupt.
  • Debugger: breakpoints, watching variables, and reading peripheral registers live. This is the biggest step up from Arduino-style development.
  • Logic analyser: confirms the baud rate, the debounce timing and the 1 ms tick from the examples above on real pins.

What should you learn first? A 12-week path for beginners

Spend the first month on C and digital basics, the second on peripherals (GPIO, timers, interrupts, UART, ADC, I2C, SPI), and the third on an RTOS, debugging and one complete project. Write every driver yourself at least once before using a library. Keep a GitHub repository of what you build, because recruiters ask to see it.

  1. Weeks 1-2: C pointers, structs, bitwise operators, volatile, fixed-width types (uint8_t).
  2. Weeks 3-4: blink with registers, then read a button with debounce, on an Uno or Pico.
  3. Weeks 5-6: timers and interrupts: a 1 ms tick, PWM to dim an LED, input capture.
  4. Weeks 7-8: UART, I2C and SPI: read a temperature sensor and print values to the PC.
  5. Weeks 9-10: move to an STM32 board: use the debugger, read the reference manual, try FreeRTOS tasks and queues.
  6. Weeks 11-12: one complete project, such as a low-power data logger or a motor speed controller, with a README, a block diagram and measured results.

Our embedded project ideas list has more starting points.

Where do embedded software freshers get hired in India?

Most entry-level embedded software roles in India are in automotive electronics, engineering services and industrial controls. Among Skill-Lync learners placed in embedded roles, the median offer was ₹4.0 LPA (n = 278). Cyient, Nexteer Automotive, Expleo, Tata Technologies and L&T Technology Services hired the most.

These figures come from 3,711 Skill-Lync placement records up to 7 Nov 2026 (data snapshot of 15 Nov 2026). Treat them as a starting point, not a market average. They are a self-selected sample of Skill-Lync learners who reported a placement, and they are mostly starting offers from 2022 and 2023. In the embedded domain, 133 offers are from 2022, 98 from 2023 and only 42 from 2024, when the median was ₹3.21 LPA. The middle half of all embedded offers fell between ₹3.5 and ₹5.0 LPA. We will update these numbers as new placements come in. See embedded engineer salaries for the role-level view and what an embedded developer does day to day.

How can you learn embedded software with Skill-Lync?

Skill-Lync's Fundamentals of Embedded Systems (12 weeks) covers microcontroller architecture, GPIO, timers, ADC, interrupts and serial protocols with hands-on projects. Embedded Programming Essentials focuses on Embedded C. The 16-week Pre-Graduate Program in Embedded Systems is built for freshers aiming at their first job. You can compare every option on the embedded systems courses page, or book a free call with a Skill-Lync counsellor to find the right fit for your branch and year.

Frequently asked questions

Is embedded software hard to learn for beginners?

It is harder than web programming at first, because you debug hardware and software together and must read datasheets. It is very learnable in steps: C basics, then one peripheral at a time on a cheap board. With steady practice, blinking an LED at register level is a first-week task, and the 12-week path in this guide ends with a complete sensor project.

Can I learn embedded software without an electronics degree?

Yes. Mechanical, computer science and IT graduates work in embedded roles. You need working knowledge of digital logic, Ohm's law, voltage levels and pull-up resistors, plus reading datasheets. Those can be learned alongside C in a few weeks. Electronics and electrical graduates have a head start on circuits, not on the programming.

Is Arduino real embedded programming?

Arduino runs real firmware on a real microcontroller, so it is a good start. Its libraries hide the registers, timers and interrupts that interviews and industry work depend on. Use Arduino to get going, then rewrite the same projects at register level and move to an STM32 board with a debugger.

What is the difference between firmware and embedded software?

Firmware is the low-level program stored in a device's non-volatile memory that directly controls its hardware, like a microcontroller's flash image. Embedded software is the broader term. It includes firmware and also bigger stacks, such as applications running on embedded Linux. On small microcontrollers the two words mean the same thing.

Do embedded software engineers need to know Python?

Not for the firmware itself, which is mostly C and C++. Python is very useful around it: test scripts, reading serial logs, automating hardware-in-the-loop tests and data analysis. MicroPython also runs on boards like the Raspberry Pi Pico for prototypes. Learn C first and add Python as your scripting tool.

Which microcontroller should I learn first in 2026?

Start on an AVR (Arduino Uno) or RP2040/RP2350 (Raspberry Pi Pico) to learn the basics cheaply. Then move to an Arm Cortex-M part such as an STM32, because Cortex-M parts are widely used in automotive and industrial products. The concepts carry over; only register names change.

Sources and further reading

Want this on your résumé?

Talk to a counsellor.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.