The STM32 Discovery Board has become one of the most popular development platforms in the embedded systems world, offering engineers and hobbyists an affordable, feature-rich entry point into ARM Cortex-M microcontroller development. Whether you are a seasoned firmware developer or just starting your journey into embedded programming, the STM32 Discovery Kit provides everything you need to prototype, test, and deploy real-world applications. In this guide, we explore five hands-on projects that demonstrate what this powerful board can do — from a simple blinking LED all the way to an advanced robotics system.
Overview of the STM32 Discovery Board
The STM32 Discovery Board is a low-cost evaluation and development platform produced by STMicroelectronics. It is built around STM32 microcontrollers — a family of 32-bit ARM Cortex-M processors that range from entry-level Cortex-M0 variants to high-performance Cortex-M7 devices. The Discovery series is designed to lower the barrier of entry for developers who want to explore STM32 peripherals, test firmware concepts quickly, and create functional prototypes without investing in expensive custom hardware.
Each board in the Discovery family is pre-loaded with an on-board ST-LINK/V2 debugger and programmer, which means you can flash and debug your firmware directly from a PC over USB — no external programmer required. This single feature alone makes the STM32 Discovery Kit exceptionally cost-effective for professional and hobbyist use alike.
Importance in Embedded Systems
ARM Cortex-M microcontrollers power a significant portion of the world's connected devices — from industrial sensors and medical monitors to consumer electronics and automotive control units. The STM32 family, in particular, dominates many of these segments thanks to STMicroelectronics' extensive peripheral integration, comprehensive HAL libraries, and strong community support.
By learning to work with the STM32 Discovery Board, developers gain transferable skills that apply directly to production hardware. The STM32CubeIDE development environment, the HAL (Hardware Abstraction Layer) drivers, and the low-layer (LL) APIs used on Discovery boards are the same tools used in professional firmware teams worldwide. For PCB designers and hardware engineers, familiarity with the STM32 ecosystem also simplifies the transition from evaluation board to custom PCB design — a path that NextPCB's prototyping service is specifically designed to support.
Getting Started with the STM32 Discovery Board
What Is the STM32 Discovery Kit?
The STM32 Discovery Kit is a family of hardware development boards produced by STMicroelectronics. The most widely used variants include:
- STM32F0Discovery — Entry-level board based on the Cortex-M0 STM32F051R8T6, ideal for learning GPIO, timers, and basic communication protocols.
- STM32F4Discovery — A popular mid-range board powered by the STM32F407VGT6 Cortex-M4 with FPU, featuring an accelerometer, audio DAC, and USB OTG.
- STM32F7Discovery — A high-performance board based on the Cortex-M7 STM32F746NGH6, offering a 4.3-inch LCD touchscreen, Ethernet, Wi-Fi, and audio capabilities.
- STM32L4Discovery Kit — Optimized for ultra-low-power applications, commonly used in IoT sensor nodes and battery-powered devices.
All Discovery boards share a common design philosophy: integrate the core microcontroller, an on-board programmer/debugger, and a set of peripherals onto a single compact board that can be connected to a PC via USB for both power and programming.
Key Features and Specifications
While specific features vary by board variant, the widely used STM32F4Discovery serves as a representative example of the Discovery family's capabilities:
| Feature | Specification |
|---|---|
| Microcontroller | STM32F407VGT6 (Cortex-M4, 168 MHz) |
| Flash Memory | 1 MB |
| SRAM | 192 KB (including 64 KB CCM) |
| On-board Debugger | ST-LINK/V2 |
| USB | USB OTG FS/HS |
| Digital Microphone | MEMS MP45DT02 |
| Audio DAC | CS43L22 with class D amplifier |
| Accelerometer | LIS302DL or LIS3DSH (3-axis) |
| User LEDs | 4 × LEDs (orange, green, red, blue) |
| User Button | 1 × push button |
| Supply Voltage | 3V / 5V via USB or external |
| GPIO Pins | 100 pins (via 2 × 50-pin headers) |
STM32 Discovery Board Datasheet
The official STM32 Discovery Board datasheet and user manual are published by STMicroelectronics and are freely available through their website. Key documents to download when working with any Discovery board include:
- UM1472 — User manual for the STM32F4Discovery board, covering board layout, power supply options, connector pinouts, and peripheral connections.
- STM32F407xx Datasheet — Full electrical characteristics, memory map, peripheral register descriptions, and AC/DC parameters for the onboard microcontroller.
- STM32F4xx Reference Manual (RM0090) — Comprehensive peripheral documentation including timers, ADC, DMA, USART, SPI, I2C, USB OTG, and CAN.
- STM32CubeMX Application Note (AN4488) — Guide for generating initialization code using the STM32CubeMX configuration tool.
Having these documents at hand is essential during hardware bring-up and peripheral configuration. When transitioning from the Discovery board to a custom PCB design, the reference manual and datasheet also serve as the primary references for schematic design and PCB layout decisions — areas where NextPCB's PCB assembly service can assist with volume production of your final design.
STM32 Discovery Board Pinout
Understanding the STM32 Discovery Board pinout is critical for connecting external sensors, actuators, and communication modules to the board. The STM32F4Discovery exposes its GPIO pins through two 50-pin extension connectors (P1 and P2) along with dedicated connectors for USB OTG and audio output.
The GPIO banks on the STM32F407 are labeled PA through PE, each containing up to 16 pins. Most pins support alternate function mapping, allowing a single physical pin to serve as a UART TX line, SPI MOSI, or timer PWM output depending on the firmware configuration. Key pinout considerations include:
- PA0 — Connected to the user push button; also usable as WKUP for low-power wake-up.
- PD12–PD15 — Connected to the four user LEDs (green, orange, red, blue).
- PA9/PA10 — USART1 TX/RX, commonly used for serial debug output.
- PB6/PB7 — I2C1 SCL/SDA, available for sensor communication.
- PA5/PA6/PA7, PB3/PB4/PB5 — SPI1 and SPI3 lines for high-speed peripheral interfacing.
- PA11/PA12 — USB OTG FS D-/D+ lines.
When designing a custom PCB based on the STM32F4, referencing the STM32 Discovery Board pinout schematic alongside the official STM32F407 datasheet allows you to replicate proven peripheral connections while adapting the design to your application's specific requirements. The STM32 Discovery Board schematic is published as part of the board's user manual and provides a verified reference for decoupling capacitor placement, crystal oscillator configuration, and power supply filtering — details that directly affect PCB layout quality.
Project 1: Blinking LED
The blinking LED is the embedded systems equivalent of "Hello, World" — a simple, verifiable starting point that confirms your development environment, firmware toolchain, and hardware are all working correctly together. Despite its simplicity, this project introduces the foundational concepts of GPIO configuration, clock initialization, and the HAL delay functions that underpin every STM32 application.
Components Required
- STM32 Discovery Board (any variant)
- USB Mini-B cable (for power and programming)
- STM32CubeIDE (free, available from STMicroelectronics)
No external components are required — the four user LEDs on the STM32F4Discovery (PD12–PD15) are sufficient to complete this project.
Step-by-Step Guide
- Install STM32CubeIDE — Download and install the latest version of STM32CubeIDE from the STMicroelectronics website. This integrated development environment includes the STM32CubeMX pin configuration tool, ARM GCC compiler, and ST-LINK debugging support.
- Create a new project — In STM32CubeIDE, select File → New → STM32 Project. Search for your board (e.g., STM32F4DISCOVERY) and select it. The IDE will automatically load the correct MCU configuration.
- Configure GPIO — In the CubeMX view, locate pin PD12 and set it to GPIO_Output mode. Repeat for PD13, PD14, and PD15.
- Generate initialization code — Click Project → Generate Code. CubeMX will produce the complete HAL initialization code including
MX_GPIO_Init(). - Write the blink loop — In
main.c, inside thewhile(1)loop, add:
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
HAL_Delay(500);
- Build and flash — Click Run → Debug to compile and flash the firmware to the Discovery board via the on-board ST-LINK. All four LEDs will now toggle at 500 ms intervals.
Schematic Diagram
The LED circuit on the STM32F4Discovery connects each LED anode to a current-limiting resistor (approximately 360 Ω) and then to 3.3V, with the cathode connected to the corresponding GPIO pin. When the GPIO is driven LOW, current flows and the LED illuminates. This active-low LED configuration is reflected in the board's STM32 Discovery Board schematic, available in the UM1472 user manual.
Project 2: Temperature and Humidity Monitor
Building a temperature and humidity monitor demonstrates how to interface the STM32 Discovery Board with an external sensor over a digital communication protocol — in this case, using a DHT22 sensor connected via a single-wire protocol, or alternatively an SHT31 sensor connected via I2C. This project introduces interrupt-driven GPIO, timer-based bit-banging, and UART-based data output.
Overview of the Project
The monitor reads temperature and relative humidity values from the sensor at defined intervals and transmits the data over USART1 to a PC serial terminal. Optional extensions include displaying the data on an OLED screen via I2C or logging it to an SD card via SPI — both of which the STM32F4Discovery's peripheral set fully supports.
Required Sensors
- DHT22 (AM2302) — Single-wire digital sensor, 0–100% RH range, ±0.5°C accuracy, 3.3V compatible with a pull-up resistor on the data line.
- Alternatively: SHT31 — I2C sensor with superior accuracy (±0.3°C, ±2% RH), directly addressable at 0x44 or 0x45.
- 4.7 kΩ pull-up resistor (for DHT22 data line)
- Breadboard and jumper wires
Wiring and Pin Configuration
For the DHT22 connected to the STM32F4Discovery:
| DHT22 Pin | STM32F4Discovery Pin | Notes |
|---|---|---|
| VCC | 3V pin | 3.3V supply |
| DATA | PA1 | 4.7kΩ pull-up to 3.3V required |
| GND | GND pin | Common ground |
Code Implementation
The DHT22 protocol requires the host to send an 18 ms LOW start pulse, then release the line and read 40 bits of data — 16 bits of humidity, 16 bits of temperature, and 8 bits of checksum. Timer-based bit timing using TIM2 in microsecond counting mode ensures accurate protocol timing. The decoded values are then formatted and sent via USART1 using HAL_UART_Transmit().
This project illustrates a fundamental embedded design principle: sensor interface logic developed and validated on a Discovery board can be directly ported to a custom PCB, provided the PCB schematic uses the same GPIO pin assignments and pull-up resistor values. NextPCB's PCB prototyping service is a natural next step once your sensor interface firmware is validated on the Discovery board.
Project 3: Remote-Controlled Car
The remote-controlled car project integrates PWM motor control, an HC-05 Bluetooth module for wireless command reception, and an H-bridge motor driver to create a fully functional wireless vehicle — all controlled through a smartphone application.
Introduction to the Project
This project demonstrates three core competencies essential to embedded systems work: PWM generation for DC motor speed control, UART-based Bluetooth communication, and real-time command parsing in a control loop. It also introduces the concept of motor driver interfacing, where the STM32's 3.3V GPIO signals control a higher-current motor driver circuit.
Materials Needed
- STM32 Discovery Board
- L298N H-bridge motor driver module
- 2 × DC gear motors with wheels
- HC-05 Bluetooth module
- 7.4V LiPo battery pack
- Chassis (3D-printed or purchased)
- Jumper wires and breadboard
Control Mechanisms
Motor speed is controlled via TIM3 in PWM mode, generating variable duty-cycle signals on PA6 and PA7 (TIM3 CH1 and CH2). Direction control uses two additional GPIO pins per motor, connected to the IN1–IN4 inputs of the L298N driver. The Bluetooth module connects to USART2 (PA2 TX, PA3 RX) and receives single-character commands from a smartphone app — 'F' for forward, 'B' for reverse, 'L' for left turn, 'R' for right turn, and 'S' to stop.
Project Schematic
The power architecture requires careful attention: the STM32 Discovery Board runs at 3.3V logic, while the L298N motor driver logic inputs accept 3.3V–5V. The motors are powered directly from the 7.4V battery through the L298N, while the Discovery board is powered from the same battery via a 5V buck converter feeding the board's USB/VIN pin. Level shifting between the HC-05 (5V logic) and the STM32 (3.3V logic) on the RX line is achieved with a simple resistor voltage divider. This complete schematic — once validated on the breadboard — forms the basis for a compact custom PCB that integrates all these components into a clean, production-ready motor controller board.
Project 4: Smart Home Automation
The smart home automation project expands the STM32 Discovery Board's role from a standalone embedded controller into a networked device, using an ESP8266 Wi-Fi module to connect the board to a home network and expose sensor data and relay control through an MQTT broker.
Concept and Goals
The system reads temperature and light level data from sensors connected to the STM32's ADC, publishes this data to an MQTT topic every 30 seconds, and subscribes to control topics that trigger relay outputs for lights, fans, or other appliances. The STM32 handles all real-time sensor acquisition and relay control, while the ESP8266 manages Wi-Fi connectivity and MQTT communication via AT commands over USART3.
Necessary Components
- STM32 Discovery Board
- ESP8266 Wi-Fi module (ESP-01 or NodeMCU breakout)
- DHT22 temperature/humidity sensor
- LDR (light dependent resistor) with 10 kΩ voltage divider
- 2-channel relay module (5V coil, optocoupler isolated)
- MQTT broker (Mosquitto running on a Raspberry Pi or cloud-based HiveMQ)
- Smartphone with MQTT dashboard app (e.g., IoT MQTT Panel)
Software Setup
The ESP8266 is configured in station mode using AT commands sent over USART3. Key AT command sequences include AT+CWMODE=1 to set station mode, AT+CWJAP to connect to the Wi-Fi network, and AT+CIPSTART to open a TCP connection to the MQTT broker. MQTT protocol packets (CONNECT, PUBLISH, SUBSCRIBE) are then constructed manually in the STM32 firmware and transmitted as raw TCP data through the ESP8266.
Final Implementation
Once validated, this system represents a complete IoT edge node architecture. Moving from the STM32 Discovery Board to a custom PCB for this project involves integrating the STM32 microcontroller, ESP8266 (or its successor ESP32), relay drivers, and power supply onto a single board — a design that benefits significantly from proper RF isolation, ground plane management, and relay snubber circuits. These are design considerations that align directly with the PCB assembly and DFM review process offered by NextPCB for production-ready boards.
Project 5: Advanced Robotics System
The advanced robotics project demonstrates the STM32 Discovery Board's capability to serve as the central processing unit of a multi-axis robotic system — in this case, a 3-degree-of-freedom (3-DOF) robotic arm controlled via inverse kinematics algorithms running in real time on the Cortex-M4 processor.
Overview of Robotic Features
The system uses three servo motors to control the base rotation, shoulder joint, and elbow joint of the robotic arm. A fourth servo controls the end-effector gripper. Position commands are received via USART from a PC running a Python GUI, which calculates target (X, Y, Z) coordinates and transmits joint angles to the STM32. The STM32 generates four independent PWM signals (50 Hz, 1–2 ms pulse width) to drive the servo motors simultaneously.
Integration with STM32 Discovery Board
The Cortex-M4's floating-point unit (FPU) is exploited to run the inverse kinematics calculations in real time, computing joint angles from Cartesian coordinates using trigonometric functions without the latency penalty that would affect a Cortex-M0 or M3 device. Timer TIM1 is configured in PWM mode with four output channels (PA8, PA9, PA10, PA11) to generate the servo control signals simultaneously — a feature that the STM32F4's advanced timer hardware supports natively.
Advanced Programming Techniques
This project introduces several advanced STM32 firmware concepts:
- DMA-driven USART reception — Using DMA to receive variable-length command frames from the PC without CPU intervention, freeing the main loop for kinematics computation.
- FreeRTOS task scheduling — Separating USART command parsing, kinematics computation, and PWM update into three independent RTOS tasks with defined priorities and inter-task communication via queues.
- Floating-point math optimization — Using ARM CMSIS-DSP library functions (e.g.,
arm_sin_f32,arm_cos_f32) to accelerate trigonometric computations using the Cortex-M4's FPU hardware. - PWM resolution and timing accuracy — Configuring TIM1's prescaler and auto-reload register to achieve 1 µs PWM resolution at 50 Hz servo frequency, ensuring smooth servo motion without jitter.
The combination of real-time OS, hardware-accelerated math, and DMA-driven communications in this project demonstrates the full capability of the STM32 Discovery Board as a serious embedded development platform — and provides a clear technical foundation for designing a dedicated robot controller PCB around the STM32F4 or STM32H7 family.
STM32 Discovery Board vs Nucleo
A common question among developers evaluating STM32 development boards is: Should I use a Discovery board or a Nucleo board? Both are produced by STMicroelectronics, both include an on-board ST-LINK programmer/debugger, and both support the STM32CubeIDE and HAL driver ecosystem. However, there are meaningful differences that affect which board is best suited for a given application.
Key Differences and Similarities
| Feature | STM32 Discovery Board | STM32 Nucleo Board |
|---|---|---|
| On-board peripherals | Rich (sensors, audio DAC, LCD, cameras depending on variant) | Minimal (LEDs, button, Arduino/Morpho headers) |
| Form factor | Fixed, board-specific layout | Standardized (Nucleo-32, Nucleo-64, Nucleo-144) |
| Shield compatibility | Limited (board-specific) | Arduino UNO R3 shields + ST Morpho expansion |
| ST-LINK version | ST-LINK/V2 (embedded) | ST-LINK/V2-1 (embedded, supports USB enumeration as virtual COM port) |
| Virtual COM port | Not available on older variants | Available via ST-LINK/V2-1 |
| Use case | Peripheral exploration, feature-specific demos | Custom hardware prototyping with shields |
| Price | $15–$30 USD typical | $10–$25 USD typical (Nucleo-64) |
| MCU variety | Limited to specific MCU per board variant | Wide range across STM32 families |
Which One Should You Choose?
Choose the STM32 Discovery Board when:
- You want to explore specific STM32 peripherals (audio, USB OTG, camera interface) without sourcing external components.
- You are following an application note or tutorial that targets a specific Discovery board variant.
- You need a self-contained demonstration platform for a specific application domain (motor control, audio processing, display systems).
Choose the STM32 Nucleo Board when:
- You want maximum flexibility to add external hardware via Arduino-compatible shields or custom expansion boards.
- You need to test the same firmware across multiple STM32 MCU families to make a silicon selection decision.
- You need a built-in virtual COM port for UART debugging without a separate USB-to-UART adapter.
In many practical development workflows, engineers use both: a Discovery board for initial peripheral validation and feature exploration, and a Nucleo board for system integration with external hardware before finalizing the custom PCB design. Both boards are fully supported by STM32CubeIDE, STM32CubeMX, and the STM32 HAL driver library, ensuring that firmware developed on either platform transfers directly to production silicon.
When your design is ready to move beyond evaluation boards — whether it started on a Discovery or Nucleo — NextPCB's PCB prototype service provides fast-turn manufacturing for custom STM32-based boards, with support for the fine-pitch BGAs and QFPs commonly used in the STM32 family, as well as full PCBA assembly including STM32 MCU placement and reflow.
Conclusion
Recap of the Projects
Throughout this guide, we explored five projects that collectively demonstrate the breadth of the STM32 Discovery Board's capabilities:
- Blinking LED — Establishes the development environment and GPIO fundamentals.
- Temperature and Humidity Monitor — Introduces sensor interfacing via single-wire and I2C protocols.
- Remote-Controlled Car — Demonstrates PWM motor control and Bluetooth wireless communication.
- Smart Home Automation — Explores Wi-Fi networking, MQTT protocol, and IoT system architecture.
- Advanced Robotics System — Showcases real-time OS, hardware-accelerated math, and multi-axis servo control.
Each project builds on the previous, progressively introducing more complex firmware concepts and hardware interfaces. More importantly, each project represents a validated functional block that can be carried forward into a custom PCB design — turning Discovery board prototypes into production-ready embedded systems.
Future of STM32 Development
STMicroelectronics continues to expand the STM32 family, with recent additions including the STM32H7 series (Cortex-M7 at 480 MHz with L1 cache), the STM32U5 series (ultra-low-power with TrustZone security), and the STM32WL series (integrated sub-GHz radio for LoRaWAN and Sigfox applications). The Discovery board ecosystem will continue to evolve alongside these new MCU families, providing developers with hardware platforms to explore next-generation peripherals before committing to custom silicon.
For hardware engineers ready to take the next step beyond the Discovery board, NextPCB offers a complete PCB manufacturing and assembly solution tailored to the needs of embedded systems developers — from rapid 2-layer prototypes for initial hardware validation to high-density multilayer boards for production deployments. With manufacturing facilities in Shenzhen and a global shipping network serving over 160 countries, NextPCB is positioned to support your STM32 product from first prototype to mass production.
The STM32 Discovery Board is your starting point. Where you take it next is limited only by your imagination — and the quality of your PCB partner.
