Piezo Buzzer PWM Aries v3.0

Explore a virtual Piezo Buzzer PWM system based on the Vega Aries v3.0 RISC-V SoC for learning, simulating, and validating PWM audio generation, musical tones, buzzer alerts, and embedded audio control.

Audio PWM Buzzer RISC-V Aries v3.0
Overview Theory Architecture Source Code Pinout Examples

Overview

Think of this as your virtual sound studio powered by the Vega Aries v3.0 RISC-V SoC—an interactive audio peripheral designed for learning, testing, and bringing your code to life with sound.

Whether you're composing musical melodies, generating alert tones, or experimenting with precise PWM (Pulse Width Modulation) timer generators, this system lets you produce variable-frequency square waves to drive a piezoelectric buzzer with crisp accuracy.

Using embedded C firmware, you can easily configure output frequencies, control note durations, and orchestrate custom audio sequences and alarm patterns to make your projects truly speak for themselves.

Key Features

  • Aries v3.0 RISC-V Microcontroller SoC
  • Hardware PWM audio frequency generator
  • Piezoelectric transducer audio output model
  • Variable-frequency tone generation
  • 50% duty-cycle pure tone generation
  • Musical note generation
  • Alarm and notification sound generation
  • Audio sequence generation
  • Integrated simulator and waveform viewer
  • Adjustable simulation speed control

Piezo Buzzer System Structure

PWM Audio Generation
Firmware
→
Aries v3.0
→
PWM Controller

PWM_FREQ
+
PWM_DUTY
→
Buzzer

Applications & Use Cases

  • Musical note generation
  • Alarm sound generation
  • Buzzer status notifications
  • PWM frequency experiments
  • PWM duty-cycle experiments
  • Embedded audio programming
  • RISC-V peripheral control
  • Real-time firmware simulation
Buzzer Control Flow
Embedded C
→
GPIO0
→
PWM
→
Piezo Buzzer

Theory

A piezoelectric buzzer converts an electrical signal into mechanical vibration, producing an audible sound. In this system, the electrical signal is generated using Pulse-Width Modulation (PWM).

The PWM frequency determines the pitch of the generated sound. Higher frequencies produce higher-pitched tones, while lower frequencies produce lower-pitched tones.

A duty cycle of approximately 50% produces a balanced square wave suitable for pure buzzer tones.

PWM Tone Generation

PWM Audio Generation
Set Frequency
→
Set Duty Cycle
→
Generate PWM
→
Produce Sound

Frequency and Pitch

The relationship between frequency and pitch can be expressed as:

Higher Frequency
       ↓
Higher Pitch

Lower Frequency
       ↓
Lower Pitch
                

Duty Cycle

The duty cycle represents the percentage of time that the PWM signal remains HIGH during one complete cycle. A 50% duty cycle provides an approximately equal HIGH and LOW duration.

PWM Duty Cycle = 50%

HIGH  ──────
            │
LOW   ──────
            │
            └── Repeated continuously
                

Architecture

The Piezo Buzzer PWM system consists of the embedded firmware, Aries v3.0 RISC-V SoC, PWM controller, GPIO interface, and piezoelectric buzzer output model.

Firmware
→
Aries v3.0
→
PWM Controller

PWM_FREQ
+
PWM_DUTY
→
GPIO0_0
→
Piezo Buzzer

System Components

  • Aries v3.0 RISC-V Microcontroller SoC
  • GPIO0 interface
  • PWM frequency generator
  • PWM duty-cycle controller
  • Piezoelectric transducer model
  • Audio output model
  • Integrated simulator and waveform viewer

Source Code

Example firmware for configuring the Piezo Buzzer PWM peripheral.

Register Definitions

#define GPIO0_MODE  0x40000000
#define GPIO0_IN    0x40000004
#define GPIO0_OUT   0x40000008

#define PWM_FREQ    0x40000820
#define PWM_DUTY    0x40000824
                

GPIO Configuration

// Configure GPIO0 bit 0 as buzzer output

WRITE_REGISTER(GPIO0_MODE, 0x01);
                

PWM Configuration

// Configure 50% duty cycle
WRITE_REGISTER(PWM_DUTY, 50);

// Generate A4 tone
WRITE_REGISTER(PWM_FREQ, 440);
                

Firmware Entrypoint

void fw_main(void)
{
    // Configure GPIO0 bit 0 as buzzer output
    WRITE_REGISTER(0x40000000, 0x01);

    // Configure 50% duty cycle
    WRITE_REGISTER(0x40000824, 50);

    // Generate 440 Hz A4 tone
    WRITE_REGISTER(0x40000820, 440);

    while (1)
    {
        // PWM hardware continuously drives the buzzer
    }
}
                

Pinout

GPIO and PWM register mapping for the Piezo Buzzer PWM output.

GPIO0 - Buzzer Output

Bit 0
BUZZER_PWM
Bit 1
Unused
Bit 2
Unused
Bit 3
Unused

Bit 4
Unused
Bit 5
Unused
Bit 6
Unused
Bit 7
Unused

Register Addresses

GPIO0 MODE
0x40000000
GPIO0 IN
0x40000004
GPIO0 OUT
0x40000008

PWM_FREQ
0x40000820
PWM_DUTY
0x40000824

Examples

Example exercises for the Piezo Buzzer PWM system.

  • Generate a single buzzer tone
  • Generate C4 through C5 musical notes
  • Generate an ascending musical sequence
  • Generate an alarm sound
  • Experiment with PWM frequency
  • Experiment with PWM duty cycle
  • Create a custom melody
  • Control note duration
  • Observe PWM waveforms

Musical Notes

C4
262 Hz
D4
294 Hz
E4
330 Hz
F4
349 Hz

G4
392 Hz
A4
440 Hz
B4
494 Hz
C5
523 Hz