← All projects

2024 · ECE 355 · Microprocessor-Based Systems · Team of 2

PWM Generation & Monitoring System

A bare-metal STM32F0 system that both drives and measures a PWM signal: a potentiometer steers an NE555 timer through an optocoupler, while the MCU times signal edges and reports frequency and resistance live on an OLED.

Test station: STM32F0 Discovery board and NE555 circuit on a breadboard beside a bench function generator and oscilloscope
The test station — STM32F0 Discovery, NE555/4N35 breadboard circuit, function generator and oscilloscope for verification.

Overview

Everything here is register-level C with CMSIS — no HAL. The board's ADC reads a potentiometer, and the DAC drives a 4N35 optocoupler that varies the effective resistance seen by an NE555 astable circuit, changing its output frequency. That PWM signal returns to the MCU, where an EXTI interrupt and a hardware timer measure the period edge-to-edge. A push-button (also on EXTI) switches the measurement source between the 555 circuit and a bench function generator.

Measured frequency and computed potentiometer resistance stream to an SPI OLED display that refreshes in real time. Accuracy was characterized against the bench function generator across the operating range, and edge cases — source disconnection, source switching, hardware reset — were tested explicitly.

Highlights

STM32F0 C / CMSIS NE555 · 4N35 EXTI · Timers ADC · DAC SPI OLED

Files & downloads