# chandravaran/smart_prepaid_electric_meter architecture

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

- Interactive diagram: https://gitdiagram.com/chandravaran/smart_prepaid_electric_meter
- Repository: https://github.com/chandravaran/smart_prepaid_electric_meter

## Overview

This repository documents a simulated smart prepaid electricity meter. Its main workflow measures electricity at the source and load, sends the top Arduino’s readings to the bottom Arduino for theft detection, calculates consumption and deducts cash, then notifies the user via GSM. The README also describes current and voltage sensing and a zero-crossing circuit. No source excerpts were provided, so implementation details and links beyond those documented are omitted; simulation files are shown as artifacts, not assumed to implement specific stages.

Main entry points: [`bottom_arduino.ino`](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino) (Bottom Arduino), [`top_arduino.ino`](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/top_arduino.ino) (Top Arduino), [`GSM Library for Proteus/GSMLibraryTEP.hex`](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/GSM%20Library%20for%20Proteus/GSMLibraryTEP.hex) (GSM module), [`theft.pdsprj`](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj) (Current sensing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_metering["Metering"]
  node_top_meter["Top Arduino<br/>[top_arduino.ino]"]
  node_bottom_meter["Bottom Arduino<br/>[bottom_arduino.ino]"]
  node_current_sensor["Current sensing<br/>[theft.pdsprj]"]
  node_voltage_sensor["Voltage sensing<br/>[theft.pdsprj]"]
  node_zero_crossing["Zero crossing<br/>[theft.pdsprj]"]
end

subgraph group_account["Theft and billing"]
  node_theft_detection["Theft detection<br/>[bottom_arduino.ino]"]
  node_usage_calculation["Usage calculation<br/>[bottom_arduino.ino]"]
  node_cash_deduction["Cash deduction<br/>[bottom_arduino.ino]"]
end

subgraph group_communications["GSM communication"]
  node_gsm_module["GSM module<br/>[GSMLibraryTEP.hex]"]
end

subgraph group_simulation["Circuit simulation"]
  node_theft_simulation["Theft circuit simulation<br/>[theft.pdsprj]"]
  node_no_theft_simulation["No-theft simulation"]
end

node_source(("Electrical source"))
node_load(("Electrical load"))
node_user(("Consumer"))

node_source -->|"provides readings"| node_top_meter
node_load -->|"provides readings"| node_bottom_meter
node_top_meter -->|"sends readings"| node_bottom_meter
node_bottom_meter -->|"compares readings"| node_theft_detection
node_bottom_meter -->|"determines usage"| node_usage_calculation
node_usage_calculation -->|"deducts cash"| node_cash_deduction
node_bottom_meter -->|"sends notifications"| node_gsm_module
node_gsm_module -->|"notifies"| node_user
node_current_sensor -.->|"measures current"| node_top_meter
node_voltage_sensor -.->|"measures voltage"| node_top_meter

click node_top_meter "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/top_arduino.ino"
click node_bottom_meter "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino"
click node_current_sensor "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj"
click node_voltage_sensor "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj"
click node_zero_crossing "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj"
click node_theft_detection "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino"
click node_usage_calculation "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino"
click node_cash_deduction "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino"
click node_gsm_module "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/GSM%20Library%20for%20Proteus/GSMLibraryTEP.hex"
click node_theft_simulation "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj"
click node_no_theft_simulation "https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/gsm_no_theft.pdsprj"

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_top_meter,node_bottom_meter,node_current_sensor,node_voltage_sensor,node_zero_crossing toneBlue
class node_theft_detection,node_usage_calculation,node_cash_deduction toneAmber
class node_gsm_module toneMint
class node_theft_simulation,node_no_theft_simulation toneRose
class node_source,node_load,node_user toneIndigo
```

## Components

### Metering

- [Top Arduino](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/top_arduino.ino): `top_arduino.ino`
- [Bottom Arduino](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino): `bottom_arduino.ino`
- [Current sensing](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj): `theft.pdsprj`
- [Voltage sensing](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj): `theft.pdsprj`
- [Zero crossing](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj): `theft.pdsprj`

### Theft and billing

- [Theft detection](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino): `bottom_arduino.ino`
- [Usage calculation](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino): `bottom_arduino.ino`
- [Cash deduction](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/bottom_arduino.ino): `bottom_arduino.ino`

### GSM communication

- [GSM module](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/GSM%20Library%20for%20Proteus/GSMLibraryTEP.hex): `GSM Library for Proteus/GSMLibraryTEP.hex`

### Circuit simulation

- [Theft circuit simulation](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/theft.pdsprj): `theft.pdsprj`
- [No-theft simulation](https://github.com/chandravaran/smart_prepaid_electric_meter/blob/main/gsm_no_theft.pdsprj): `gsm_no_theft.pdsprj`

### Other components

- **Electrical source**
- **Electrical load**
- **Consumer**

## Connections

- Electrical source → Top Arduino: provides readings (evidence: `README.md`)
- Electrical load → Bottom Arduino: provides readings (evidence: `README.md`)
- Top Arduino → Bottom Arduino: sends readings (evidence: `README.md`)
- Bottom Arduino → Theft detection: compares readings (evidence: `README.md`)
- Bottom Arduino → Usage calculation: determines usage (evidence: `README.md`)
- Usage calculation → Cash deduction: deducts cash (evidence: `README.md`)
- Bottom Arduino → GSM module: sends notifications (evidence: `README.md`)
- GSM module → Consumer: notifies (evidence: `README.md`)
- Current sensing → Top Arduino: measures current
- Voltage sensing → Top Arduino: measures voltage
