{
    "key": "max9814",
    "kind": "sensor",
    "model": {
        "aliases": [
            "max9814"
        ]
    },
    "driver": {
        "runtime": {
            "init": {
                "args": {
                    "adc_address": "{adc_address}",
                    "adc_channel": "{adc_channel}",
                    "reference_offset_db": "{calibration_offset_db}"
                },
                "class": "drivers.max9814.MAX9814"
            },
            "apt_packages": [],
            "pip_packages": [
                "adafruit-circuitpython-ads1x15"
            ],
            "python_module": "drivers.max9814"
        },
        "targets": [
            "raspberrypi"
        ],
        "verified": {
            "by": null,
            "os": null,
            "date": null,
            "board": null,
            "reviewed_by": null,
            "evidence_url": null
        },
        "interface": "analog",
        "connection": {
            "pins": [
                {
                    "role": "out",
                    "notes": "Analog audio output centred on a DC bias. The Raspberry Pi has no ADC, so an external converter is mandatory.",
                    "required": true
                },
                {
                    "role": "gain",
                    "notes": "Floating selects 60dB, tied to ground 50dB, tied to supply 40dB.",
                    "required": false
                },
                {
                    "role": "ar",
                    "notes": "Sets the automatic gain control attack and release ratio.",
                    "required": false
                }
            ],
            "supply_voltage": "3.3V or 5V",
            "level_shift_required": null
        },
        "constraints": {
            "warmup_seconds": null,
            "read_timeout_seconds": 2,
            "min_read_interval_seconds": 1
        },
        "failure_modes": [
            "The Raspberry Pi has no analog input. This part cannot be connected without an external ADC, which is a separate component and must be declared.",
            "The output is an audio waveform, not a level. A sound level requires sampling a window and computing RMS. A single ADC reading returns an arbitrary point on the waveform and is meaningless.",
            "An ADS1115 at its maximum sample rate is far below audio bandwidth. It can track a slow envelope but cannot reconstruct the signal, so the derived level is an approximation of loudness only.",
            "Automatic gain control continuously changes the amplifier gain, so absolute amplitude does not correspond to absolute sound pressure. Comparisons across time are only valid while the AGC is not moving.",
            "Decibel output requires calibration against a reference meter per installation. Without that constant the published value is relative, not sound pressure level."
        ]
    },
    "source": "platform-seed",
    "status": "draft",
    "platform": {
        "name": "MAX9814 Microphone Sound Level",
        "protocol": "analog",
        "readings": [
            {
                "slug": "sound-level",
                "unit": "decibels",
                "label": "Sound Level",
                "data_type": "float",
                "range_max": 120,
                "range_min": 40,
                "unit_symbol": "dB",
                "device_class": "sound_pressure",
                "decimal_places": 1,
                "threshold_crit_low": null,
                "threshold_warn_low": null,
                "threshold_crit_high": 100,
                "threshold_warn_high": 85
            }
        ],
        "description": "Electret microphone with automatic gain control. Analog output converted to dB SPL approximation via ADC.",
        "sensor_type": "acoustic",
        "manufacturer": "Maxim Integrated",
        "model_number": "MAX9814",
        "datasheet_url": "https://datasheets.maximintegrated.com/en/ds/MAX9814.pdf",
        "read_interval_seconds": 5
    },
    "revision": 1
}