RYG LED Strip PWM Aries v3.0

Explore a Red-Yellow-Green LED strip PWM system for learning, simulating, and validating brightness control, PWM duty-cycle operation, and automated traffic light sequences using the Vega Aries v3.0 RISC-V SoC.

PWM LED Strip RYG GPIO Aries v3.0
Overview Theory Architecture Source Code Pinout Examples

Overview

The Red-Yellow-Green LED Strip PWM System (ryg_led_strip_pwm_aries_v3.0) is a virtual hardware peripheral based on the Vega Aries v3.0 RISC-V SoC.

The system controls three independent LED color channels: Red, Yellow, and Green. Each channel can be controlled using PWM duty-cycle values for brightness adjustment and traffic signal automation.

Embedded C firmware using fw_main can configure GPIO direction, control PWM duty cycles, implement brightness dimming, and create automated Red-Yellow-Green traffic light sequences.

Key Features

  • Vega Aries v3.0 RISC-V SoC
  • Three independent LED color channels
  • Red, Yellow, and Green LED control
  • PWM-based brightness control
  • 0% to 100% duty-cycle range
  • GPIO0 interface
  • Traffic light sequence automation
  • Multi-level brightness dimming
  • Integrated simulator
  • Integrated waveform viewer
  • Adjustable simulation speed

LED Strip Structure

Red-Yellow-Green LED Strip
RED
+
YELLOW
+
GREEN

3 Color Channels
→
PWM Control
→
Brightness

Applications & Use Cases

  • Traffic light simulation
  • LED brightness control
  • PWM duty-cycle experiments
  • Color channel control
  • Embedded PWM programming
  • GPIO control learning
  • Automated traffic sequences
  • Real-time waveform observation
RYG LED Control Flow
Firmware
→
GPIO0
→
PWM Channels
→
RYG LED Strip

PWM_RED
→
Red LED

PWM_YELLOW
→
Yellow LED

PWM_GREEN
→
Green LED

Theory

Pulse-Width Modulation (PWM) is a technique used to control the average power delivered to an electronic device by rapidly switching a digital signal between ON and OFF states.

The RYG LED Strip system uses three independent PWM channels to control the brightness of the Red, Yellow, and Green LED channels.

PWM Brightness Control

PWM Duty Cycle Control
0%
OFF
→
25%
Low Brightness
→
50%
Medium
→
100%
Full Brightness

Traffic Light Sequence

Firmware can use the three PWM channels to implement a traffic signal sequence. Each color can be enabled independently and configured with a required brightness level.

Traffic Signal Sequence
RED
→
YELLOW
→
GREEN
→
RED

PWM Control Example

for each traffic state:

    set_red_pwm(red_level);

    set_yellow_pwm(yellow_level);

    set_green_pwm(green_level);

    delay_ms(duration);
                

Brightness Levels

A duty cycle of 0% turns the selected LED channel OFF, while 100% provides full brightness. Intermediate duty-cycle values provide proportional brightness control.

Architecture

The RYG LED Strip PWM system consists of embedded firmware, GPIO control, three PWM channels, and independent Red, Yellow, and Green LED outputs.

Firmware
→
GPIO0
→
PWM Controller

PWM_RED
→
Red LED

PWM_YELLOW
→
Yellow LED

PWM_GREEN
→
Green LED

System Components

  • Vega Aries v3.0 RISC-V SoC
  • GPIO0 register block
  • Red PWM channel
  • Yellow PWM channel
  • Green PWM channel
  • Red LED output
  • Yellow LED output
  • Green LED output
  • PWM waveform generation
  • Integrated simulator

Source Code

Example GPIO and PWM configuration for the RYG LED Strip PWM system.

GPIO0 Configuration

// GPIO0: Bits 0-2 configured as outputs
// RED_PWM    -> GPIO0_0
// YELLOW_PWM -> GPIO0_1
// GREEN_PWM  -> GPIO0_2

WRITE_REGISTER(0x40000000, 0x07);
                

Red PWM Configuration

// Set Red LED brightness
// Value range: 0-100

WRITE_REGISTER(0x40000810, 100);
                

Yellow PWM Configuration

// Set Yellow LED brightness
// Value range: 0-100

WRITE_REGISTER(0x40000814, 100);
                

Green PWM Configuration

// Set Green LED brightness
// Value range: 0-100

WRITE_REGISTER(0x40000818, 100);
                

Traffic Light Example

// Red ON
WRITE_REGISTER(0x40000810, 100);
WRITE_REGISTER(0x40000814, 0);
WRITE_REGISTER(0x40000818, 0);

delay_ms(5000);


// Yellow ON
WRITE_REGISTER(0x40000810, 0);
WRITE_REGISTER(0x40000814, 100);
WRITE_REGISTER(0x40000818, 0);

delay_ms(2000);


// Green ON
WRITE_REGISTER(0x40000810, 0);
WRITE_REGISTER(0x40000814, 0);
WRITE_REGISTER(0x40000818, 100);

delay_ms(5000);
                

Firmware Entrypoint

void fw_main(void)
{
    // Configure GPIO0
    WRITE_REGISTER(0x40000000, 0x07);

    while (1)
    {
        // Red
        WRITE_REGISTER(0x40000810, 100);
        WRITE_REGISTER(0x40000814, 0);
        WRITE_REGISTER(0x40000818, 0);

        delay_ms(5000);

        // Yellow
        WRITE_REGISTER(0x40000810, 0);
        WRITE_REGISTER(0x40000814, 100);
        WRITE_REGISTER(0x40000818, 0);

        delay_ms(2000);

        // Green
        WRITE_REGISTER(0x40000810, 0);
        WRITE_REGISTER(0x40000814, 0);
        WRITE_REGISTER(0x40000818, 100);

        delay_ms(5000);
    }
}
                

Pinout

GPIO and PWM register mapping for the Red, Yellow, and Green LED channels.

GPIO0 - LED Channels

Bit 0
RED_PWM
Bit 1
YELLOW_PWM
Bit 2
GREEN_PWM

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

PWM Channel Mapping

PWM_RED
0x40000810
PWM_YELLOW
0x40000814
PWM_GREEN
0x40000818

Register Addresses

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

PWM_RED
0x40000810
PWM_YELLOW
0x40000814
PWM_GREEN
0x40000818

Examples

Example exercises for the Red-Yellow-Green LED Strip PWM system.

  • Turn the Red LED ON at 100% brightness
  • Turn the Yellow LED ON at 100% brightness
  • Turn the Green LED ON at 100% brightness
  • Control LED brightness using PWM
  • Create gradual LED dimming
  • Implement a traffic light sequence
  • Control multiple color channels
  • Generate different PWM duty cycles
  • Observe PWM waveforms
  • Implement automated traffic signal timing

Example Brightness Levels

0%
OFF
25%
Low
50%
Medium
75%
High
100%
Full