# auxinnepaul/pads_vending_machine_with_coin_acceptor architecture

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

- Interactive diagram: https://gitdiagram.com/auxinnepaul/pads_vending_machine_with_coin_acceptor
- Repository: https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor

## Overview

This is proof-of-concept ESP32 firmware for a coin-operated sanitary-pad vending machine. The principal workflow is coin detection, vend control and pad delivery, with pay-on-delivery protecting credit if a vend fails. The README also documents stock sensing, a customer retry button, and serial-console setup and diagnosis. The sketch was not excerpted, so the graph uses the README for relationships and does not infer internal call structure beyond these documented stages.

Main entry points: [`pads_vending_machine_with_coin_acceptor.ino`](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino) (Credit and vend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Vend control"]
  node_coin_input["Coin detection"]
  node_credit_vend["Credit and vend"]
  node_stock_guard["Stock guard"]
  node_pad_delivery["Pad delivery"]
end

subgraph group_operator["Operator interface"]
  node_console["Serial console"]
  node_setup["Setup and diagnosis"]
end

subgraph group_hardware["Machine hardware"]
  node_coin_acceptor{{"Coin acceptor"}}
  node_stock_switch{{"Pad stock switch"}}
  node_retry_button{{"Retry button"}}
  node_motor_relay["Motor relay"]
  node_motor_coil["Motor and coil"]
  node_lcd["LCD"]
  node_buzzer["Buzzer"]
end

node_customer(("Customer"))

node_customer -->|"inserts coin"| node_coin_acceptor
node_coin_acceptor -->|"sends pulses"| node_coin_input
node_coin_input -->|"registers credit"| node_credit_vend
node_stock_switch -->|"signals stock"| node_stock_guard
node_stock_guard -->|"gates acceptance"| node_credit_vend
node_retry_button -->|"requests retry"| node_credit_vend
node_credit_vend -->|"starts vend"| node_pad_delivery
node_pad_delivery -->|"drives"| node_motor_relay
node_motor_relay -->|"switches"| node_motor_coil
node_customer -->|"enters commands"| node_console
node_console -->|"configures and diagnoses"| node_setup
node_setup -->|"reports status"| node_lcd
node_setup -->|"signals"| node_buzzer

click node_console "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino"
click node_setup "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino"
click node_coin_input "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino"
click node_credit_vend "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino"
click node_stock_guard "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino"
click node_pad_delivery "https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.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_coin_input,node_credit_vend,node_stock_guard,node_pad_delivery toneBlue
class node_console,node_setup toneAmber
class node_coin_acceptor,node_stock_switch,node_retry_button,node_motor_relay,node_motor_coil,node_lcd,node_buzzer toneMint
class node_customer toneIndigo
```

## Components

### Vend control

- [Coin detection](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`
- [Credit and vend](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`
- [Stock guard](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`
- [Pad delivery](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`

### Operator interface

- [Serial console](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`
- [Setup and diagnosis](https://github.com/auxinnepaul/pads_vending_machine_with_coin_acceptor/blob/main/pads_vending_machine_with_coin_acceptor.ino): `pads_vending_machine_with_coin_acceptor.ino`

### Machine hardware

- **Coin acceptor**
- **Pad stock switch**
- **Retry button**
- **Motor relay**
- **Motor and coil**
- **LCD**
- **Buzzer**

### Other components

- **Customer**

## Connections

- Customer → Coin acceptor: inserts coin (evidence: `README.md`)
- Coin acceptor → Coin detection: sends pulses (evidence: `README.md`)
- Coin detection → Credit and vend: registers credit (evidence: `README.md`)
- Pad stock switch → Stock guard: signals stock (evidence: `README.md`)
- Stock guard → Credit and vend: gates acceptance (evidence: `README.md`)
- Retry button → Credit and vend: requests retry (evidence: `README.md`)
- Credit and vend → Pad delivery: starts vend (evidence: `README.md`)
- Pad delivery → Motor relay: drives (evidence: `README.md`)
- Motor relay → Motor and coil: switches (evidence: `README.md`)
- Customer → Serial console: enters commands (evidence: `README.md`)
- Serial console → Setup and diagnosis: configures and diagnoses (evidence: `README.md`)
- Setup and diagnosis → LCD: reports status (evidence: `README.md`)
- Setup and diagnosis → Buzzer: signals (evidence: `README.md`)
