# thediyguy999/rc_engine_sound architecture

> Architecture diagram of the GitHub repository thediyguy999/rc_engine_sound, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thediyguy999/rc_engine_sound
- Repository: https://github.com/thediyguy999/rc_engine_sound

## Overview

This is an Arduino-based RC engine sound generator. Its main workflow reads the receiver’s PWM throttle signal, derives engine RPM and simulated gear changes, then plays the selected engine sound through the audio output; startup sounds and engine on/off behavior are additional stages. Configuration lives in `settings.h`, while `curves.h` defines shifting behavior and the root-level headers provide sound data. The README documents these capabilities and hardware pins; the supplied source excerpts show sound-array formats, not the sketch’s implementation, so detailed call wiring is inferred only where documented.

Main entry points: [`Rc_Engine_Sound.ino`](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino) (Arduino Sketch), [`settings.h`](https://github.com/thediyguy999/rc_engine_sound/blob/master/settings.h) (Sound Selection), [`curves.h`](https://github.com/thediyguy999/rc_engine_sound/blob/master/curves.h) (Gear Shifting), [`ScaniaV8Idle.h`](https://github.com/thediyguy999/rc_engine_sound/blob/master/ScaniaV8Idle.h) (Idle Sound Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["RC Control"]
  node_runtime["Arduino Sketch"]
  node_configuration["Sound Settings<br/>[settings.h]"]
end

subgraph group_engine["Engine Simulation"]
  node_throttle["Throttle Mapping"]
  node_rpm["RPM Calculation"]
  node_shifting["Gear Shifting<br/>[curves.h]"]
  node_engine_state["Engine State"]
end

subgraph group_audio["Sound Playback"]
  node_sound_selection["Sound Selection<br/>[settings.h]"]
  node_idle_sounds["Idle Sound Data<br/>[ScaniaV8Idle.h]"]
  node_start_sounds["Startup Sound Data<br/>[ScaniaV8Start.h]"]
  node_sound_catalog["Other Engine Sounds<br/>[DefenderV8Idle.h]"]
  node_sound_player["Sound Playback"]
end

subgraph group_hardware["Audio Hardware"]
  node_audio_output["PWM Audio Output"]
end

node_receiver(("RC Receiver"))
node_amplifier["Audio Amplifier"]

node_receiver -->|"sends PWM"| node_runtime
node_runtime -->|"reads settings"| node_configuration
node_runtime -->|"maps input"| node_throttle
node_throttle -->|"derives RPM"| node_rpm
node_runtime -->|"uses curves"| node_shifting
node_runtime -->|"controls state"| node_engine_state
node_configuration -->|"selects sounds"| node_sound_selection
node_runtime -->|"uses selection"| node_sound_selection
node_sound_selection -->|"selects idle"| node_idle_sounds
node_sound_selection -->|"selects startup"| node_start_sounds
node_sound_selection -->|"selects engine"| node_sound_catalog
node_runtime -->|"controls playback"| node_sound_player
node_sound_player -->|"outputs audio"| node_audio_output
node_audio_output -->|"drives output"| node_amplifier

click node_runtime "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"
click node_configuration "https://github.com/thediyguy999/rc_engine_sound/blob/master/settings.h"
click node_throttle "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"
click node_rpm "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"
click node_shifting "https://github.com/thediyguy999/rc_engine_sound/blob/master/curves.h"
click node_engine_state "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"
click node_sound_selection "https://github.com/thediyguy999/rc_engine_sound/blob/master/settings.h"
click node_idle_sounds "https://github.com/thediyguy999/rc_engine_sound/blob/master/ScaniaV8Idle.h"
click node_start_sounds "https://github.com/thediyguy999/rc_engine_sound/blob/master/ScaniaV8Start.h"
click node_sound_catalog "https://github.com/thediyguy999/rc_engine_sound/blob/master/DefenderV8Idle.h"
click node_sound_player "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"
click node_audio_output "https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_configuration toneBlue
class node_throttle,node_rpm,node_shifting,node_engine_state toneAmber
class node_sound_selection,node_idle_sounds,node_start_sounds,node_sound_catalog,node_sound_player toneMint
class node_audio_output toneRose
class node_receiver,node_amplifier toneIndigo
```

## Components

### RC Control

- [Arduino Sketch](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`
- [Sound Settings](https://github.com/thediyguy999/rc_engine_sound/blob/master/settings.h): `settings.h`

### Engine Simulation

- [Throttle Mapping](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`
- [RPM Calculation](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`
- [Gear Shifting](https://github.com/thediyguy999/rc_engine_sound/blob/master/curves.h): `curves.h`
- [Engine State](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`

### Sound Playback

- [Sound Selection](https://github.com/thediyguy999/rc_engine_sound/blob/master/settings.h): `settings.h`
- [Idle Sound Data](https://github.com/thediyguy999/rc_engine_sound/blob/master/ScaniaV8Idle.h): `ScaniaV8Idle.h`
- [Startup Sound Data](https://github.com/thediyguy999/rc_engine_sound/blob/master/ScaniaV8Start.h): `ScaniaV8Start.h`
- [Other Engine Sounds](https://github.com/thediyguy999/rc_engine_sound/blob/master/DefenderV8Idle.h): `DefenderV8Idle.h`
- [Sound Playback](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`

### Audio Hardware

- [PWM Audio Output](https://github.com/thediyguy999/rc_engine_sound/blob/master/Rc_Engine_Sound.ino): `Rc_Engine_Sound.ino`

### Other components

- **RC Receiver**
- **Audio Amplifier**

## Connections

- RC Receiver → Arduino Sketch: sends PWM
- Arduino Sketch → Sound Settings: reads settings
- Arduino Sketch → Throttle Mapping: maps input
- Throttle Mapping → RPM Calculation: derives RPM
- Arduino Sketch → Gear Shifting: uses curves
- Arduino Sketch → Engine State: controls state
- Sound Settings → Sound Selection: selects sounds
- Arduino Sketch → Sound Selection: uses selection
- Sound Selection → Idle Sound Data: selects idle
- Sound Selection → Startup Sound Data: selects startup
- Sound Selection → Other Engine Sounds: selects engine
- Arduino Sketch → Sound Playback: controls playback
- Sound Playback → PWM Audio Output: outputs audio
- PWM Audio Output → Audio Amplifier: drives output
