# angelcodesbomb/baymaxv1 architecture

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

- Interactive diagram: https://gitdiagram.com/angelcodesbomb/baymaxv1
- Repository: https://github.com/angelcodesbomb/baymaxv1

## Overview

BaymaxBot is an ESP32 push-to-talk voice companion. The user holds a button to record speech; the firmware sends the WAV audio to Groq Whisper, then routes the returned text to local keyword behaviors or the documented sad-command joke response. Behaviors combine spoken audio with OLED messages and, for disco, RGB effects; weather also reads the DHT sensor. The sampled code confirms capture, transcription, local routing, displays and audio playback. The main sketch and LLM request implementation were not sampled, so their internal wiring is shown only where documented.

Main entry points: [`baymax_actions.cpp`](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp) (Command routing), [`BaymaxBot.ino`](https://github.com/angelcodesbomb/baymaxv1/blob/main/BaymaxBot.ino) (Sketch controller), [`mp3_player.cpp`](https://github.com/angelcodesbomb/baymaxv1/blob/main/mp3_player.cpp) (MP3 playback), [`tts_player.cpp`](https://github.com/angelcodesbomb/baymaxv1/blob/main/tts_player.cpp) (Google TTS playback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Voice input"]
  node_firmware["Sketch controller<br/>[BaymaxBot.ino]"]
  node_mic["Microphone capture<br/>[mic_capture.cpp]"]
  node_wav["WAV recording<br/>[mic_capture.cpp]"]
end

subgraph group_routing["Command handling"]
  node_router["Command routing<br/>[baymax_actions.cpp]"]
  node_weather["Weather behavior<br/>[baymax_actions.cpp]"]
  node_disco["Disco behavior<br/>[baymax_actions.cpp]"]
  node_fistbump["Fist-bump behavior<br/>[baymax_actions.cpp]"]
  node_joke["Sad-command joke<br/>[baymax_actions.cpp]"]
end

subgraph group_responses["Response output"]
  node_display["OLED display<br/>[display_helper.cpp]"]
  node_audio["MP3 playback<br/>[mp3_player.cpp]"]
  node_speech["Google TTS playback<br/>[tts_player.cpp]"]
  node_led["RGB LED<br/>[rgb_led.cpp]"]
  node_speaker["Speaker output"]
end

subgraph group_integrations["External services"]
  node_whisper["Speech transcription<br/>[groq_client.cpp]"]
  node_groq{{"Groq Whisper"}}
  node_dht["DHT sensor"]
  node_ttsservice{{"Google TTS"}}
  node_llm{{"Groq LLM"}}
end

node_user(("User"))

node_user -->|"presses button"| node_firmware
node_firmware -->|"starts recording"| node_mic
node_mic -->|"builds WAV"| node_wav
node_firmware -->|"submits recording"| node_whisper
node_whisper -->|"transcribes via"| node_groq
node_whisper -->|"returns text"| node_firmware
node_firmware -->|"routes text"| node_router
node_router -->|"dispatches"| node_weather
node_router -->|"dispatches"| node_disco
node_router -->|"dispatches"| node_fistbump
node_router -.->|"dispatches"| node_joke
node_weather -->|"reads temperature"| node_dht
node_weather -->|"shows readings"| node_display
node_weather -->|"plays response"| node_audio
node_disco -->|"shows message"| node_display
node_disco -->|"plays track"| node_audio
node_disco -->|"flashes colors"| node_led
node_fistbump -->|"shows message"| node_display
node_fistbump -->|"plays track"| node_audio
node_joke -.->|"requests joke"| node_llm
node_joke -.->|"speaks response"| node_speech
node_speech -->|"fetches audio"| node_ttsservice
node_audio -->|"outputs audio"| node_speaker
node_speech -->|"outputs audio"| node_speaker

click node_firmware "https://github.com/angelcodesbomb/baymaxv1/blob/main/BaymaxBot.ino"
click node_mic "https://github.com/angelcodesbomb/baymaxv1/blob/main/mic_capture.cpp"
click node_wav "https://github.com/angelcodesbomb/baymaxv1/blob/main/mic_capture.cpp"
click node_whisper "https://github.com/angelcodesbomb/baymaxv1/blob/main/groq_client.cpp"
click node_router "https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp"
click node_weather "https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp"
click node_disco "https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp"
click node_fistbump "https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp"
click node_joke "https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp"
click node_display "https://github.com/angelcodesbomb/baymaxv1/blob/main/display_helper.cpp"
click node_audio "https://github.com/angelcodesbomb/baymaxv1/blob/main/mp3_player.cpp"
click node_speech "https://github.com/angelcodesbomb/baymaxv1/blob/main/tts_player.cpp"
click node_led "https://github.com/angelcodesbomb/baymaxv1/blob/main/rgb_led.cpp"

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_firmware,node_mic,node_wav,node_user toneBlue
class node_router,node_weather,node_disco,node_fistbump,node_joke toneAmber
class node_display,node_audio,node_speech,node_led,node_speaker toneMint
class node_whisper,node_groq,node_dht,node_ttsservice,node_llm toneRose
```

## Components

### Voice input

- [Sketch controller](https://github.com/angelcodesbomb/baymaxv1/blob/main/BaymaxBot.ino): `BaymaxBot.ino`
- [Microphone capture](https://github.com/angelcodesbomb/baymaxv1/blob/main/mic_capture.cpp): `mic_capture.cpp`
- [WAV recording](https://github.com/angelcodesbomb/baymaxv1/blob/main/mic_capture.cpp): `mic_capture.cpp`

### Command handling

- [Command routing](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp): `baymax_actions.cpp`
- [Weather behavior](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp): `baymax_actions.cpp`
- [Disco behavior](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp): `baymax_actions.cpp`
- [Fist-bump behavior](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp): `baymax_actions.cpp`
- [Sad-command joke](https://github.com/angelcodesbomb/baymaxv1/blob/main/baymax_actions.cpp): `baymax_actions.cpp`

### Response output

- [OLED display](https://github.com/angelcodesbomb/baymaxv1/blob/main/display_helper.cpp): `display_helper.cpp`
- [MP3 playback](https://github.com/angelcodesbomb/baymaxv1/blob/main/mp3_player.cpp): `mp3_player.cpp`
- [Google TTS playback](https://github.com/angelcodesbomb/baymaxv1/blob/main/tts_player.cpp): `tts_player.cpp`
- [RGB LED](https://github.com/angelcodesbomb/baymaxv1/blob/main/rgb_led.cpp): `rgb_led.cpp`
- **Speaker output**

### External services

- [Speech transcription](https://github.com/angelcodesbomb/baymaxv1/blob/main/groq_client.cpp): `groq_client.cpp`
- **Groq Whisper**
- **DHT sensor**
- **Google TTS**
- **Groq LLM**

### Other components

- **User**

## Connections

- User → Sketch controller: presses button
- Sketch controller → Microphone capture: starts recording
- Microphone capture → WAV recording: builds WAV
- Sketch controller → Speech transcription: submits recording
- Speech transcription → Groq Whisper: transcribes via
- Speech transcription → Sketch controller: returns text
- Sketch controller → Command routing: routes text
- Command routing → Weather behavior: dispatches
- Command routing → Disco behavior: dispatches
- Command routing → Fist-bump behavior: dispatches
- Command routing → Sad-command joke: dispatches
- Weather behavior → DHT sensor: reads temperature
- Weather behavior → OLED display: shows readings
- Weather behavior → MP3 playback: plays response
- Disco behavior → OLED display: shows message
- Disco behavior → MP3 playback: plays track
- Disco behavior → RGB LED: flashes colors
- Fist-bump behavior → OLED display: shows message
- Fist-bump behavior → MP3 playback: plays track
- Sad-command joke → Groq LLM: requests joke
- Sad-command joke → Google TTS playback: speaks response
- Google TTS playback → Google TTS: fetches audio
- MP3 playback → Speaker output: outputs audio
- Google TTS playback → Speaker output: outputs audio
