# upsidedownlabs/muscle-bioamp-biscute architecture

> Architecture diagram of the GitHub repository upsidedownlabs/muscle-bioamp-biscute, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/upsidedownlabs/muscle-bioamp-biscute
- Repository: https://github.com/upsidedownlabs/muscle-bioamp-biscute

## Overview

##### Project Type & Purpose
- Type: Embedded bio-electronics device with companion firmware and documentation.
- Purpose: Amplify and band-pass filter EMG signals (72–720 Hz, gain ×2420), digitize them via a microcontroller (or external ADC), perform envelope detection in firmware, and relay data to a host.

##### File Structure
- hardware/ → KiCad design (schematic, PCB).
- graphics/ → board images, assembly steps.
- software/EMGEnvelop → Arduino sketch + demo video.
- docs/ → HTML documentation site.
- README.md, LICENSE.md → project overview, licensing.

##### Extract Key Architectural Insights from the README
- Analog front-end: instrumentation amplifier + band-pass filter.
- Data conversion: on-board ADC of an Arduino/Nano or external ADS1115 I²C ADC.
- Firmware: EMGEnvelop.ino reads samples, computes an envelope.
- Host interface: USB serial to PC for logging/visualization.

##### Main Components & Their Interactions
a. Analog Sensor Block
– Electrodes (muscle leads)
– BioAmp PCB (instrumentation amplifier → band-pass filter)
– Output connector
b. Data-Acquisition & Processing Block
– MCU with built-in ADC or external ADS1115 I²C ADC
– EMGEnvelop sketch (rectify → low-pass envelope filter)
– USB-Serial link
c. Host PC / Software
– Serial listener or plotting tool
– (Optionally) data-logging application
d. Documentation Server
– docs/index.html
– Assembly guide graphics

##### Architectural Patterns & Design Principles
- Separation of analog front-end and digital processing.
- Modular hardware (BioAmp board) vs. modular firmware (Arduino sketch).
- Optional interchangeable ADC (internal vs. external).
- Clear documentation-driven development via docs/ site.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Analog Domain
  subgraph "Analog Domain"
    direction TB
    Electrodes("Electrodes"):::analog
    BioAmpPCB("BioAmp PCB"):::analog
    subgraph "Analog Front-End" 
      direction TB
      InstAmp("Instrumentation Amp (×2420)"):::analog
      BandPass("Band-Pass Filter (72–720 Hz)"):::analog
    end
  end

  %% Embedded Firmware Domain
  subgraph "Embedded Firmware Domain"
    direction TB
    ADCOption("On-Board ADC"):::embedded
    ADS1115("External ADS1115 I²C ADC"):::embedded
    MCU("MCU"):::embedded
    Envelope("Envelope Detection Algorithm"):::embedded
    Sketch("EMGEnvelop.ino"):::embedded
    DemoVideo("EMGEnvelop.mp4"):::embedded
  end

  %% Host & Documentation Domain
  subgraph "Host & Documentation Domain"
    direction TB
    subgraph Host
      direction TB
      USBSerial("USB-Serial Link"):::host
      HostPC("Host PC: Data Logger/Plotter"):::host
    end
    subgraph Documentation
      direction TB
      DocsSite("docs/index.html"):::docs
      AssemblyGuide("Assembly Guide Graphics"):::docs
      BoardIllustrations("Board Illustrations"):::docs
      MiscGraphics("Miscellaneous Graphics"):::docs
      README("README.md & LICENSE.md"):::docs
    end
  end

  %% Connections
  Electrodes -->|Analog EMG signal| BioAmpPCB
  BioAmpPCB -->|Filtered analog| ADCOption
  BioAmpPCB -.->|Optional I²C| ADS1115
  ADCOption -->|Digital samples| MCU
  ADS1115 -->|Digital samples| MCU
  MCU -->|process| Envelope
  Envelope -->|Serial data| USBSerial
  USBSerial -->|data| HostPC

  %% Click Events
  click BioAmpPCB "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/hardware/muscle-bioamp-biscute.kicad_sch"
  click BioAmpPCB "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/hardware/muscle-bioamp-biscute.kicad_pcb"
  click BioAmpPCB "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/hardware/schematic.pdf"
  click Sketch "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/software/EMGEnvelop/EMGEnvelop.ino"
  click DemoVideo "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/software/EMGEnvelop/EMGEnvelop.mp4"
  click DocsSite "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/docs/index.html"
  click AssemblyGuide "https://github.com/upsidedownlabs/muscle-bioamp-biscute/tree/main/graphics/Assembly/pngs"
  click BoardIllustrations "https://github.com/upsidedownlabs/muscle-bioamp-biscute/tree/main/graphics/board"
  click MiscGraphics "https://github.com/upsidedownlabs/muscle-bioamp-biscute/tree/main/graphics/misc"
  click README "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/README.md"
  click README "https://github.com/upsidedownlabs/muscle-bioamp-biscute/blob/main/LICENSE.md"

  %% Styles
  classDef analog fill:#d4f4dd,stroke:#0b6623,color:#0b6623;
  classDef embedded fill:#d0e7ff,stroke:#1a5fb4,color:#1a5fb4;
  classDef host fill:#ffe2b3,stroke:#b36b00,color:#b36b00;
  classDef docs fill:#e0e0e0,stroke:#707070,color:#404040;
```
