Skip to main content

AtmosPyre

Python interface for Modbus-based environmental sensors.

📖 Full documentation

Why AtmosPyre?

Write sensor drivers in ~100 lines of Python instead of buying expensive vendor software. AtmosPyre provides a consistent API for adding new sensors.

  • 💰 No proprietary software licenses needed
  • 🔧 Add new sensors quickly
  • 🎯 Single API for all sensors
  • 📝 Clear documentation and examples

Installation

From PyPI

Recommended installation

For most users, install with the recommended backends:

pip install atmospyre[recommended]

This includes minimalmodbus for Modbus communication and schedule for scheduling.

Minimal installation

Install only the core library (you'll need to install backends separately):

pip install atmospyre

Specific backends

Choose specific backends based on your needs:

# Just Modbus backend
pip install atmospyre[minimalmodbus]

# Just scheduling backend
pip install atmospyre[schedule]

# Combine multiple backends
pip install atmospyre[minimalmodbus,schedule]

# All available backends
pip install atmospyre[all]

From source (cloned repository)

If you've cloned the repository:

# Clone the repository
git clone https://git.iws.uni-stuttgart.de/measurements/atmospyre.git
cd atmospyre

# Install with recommended backends
pip install .[recommended]

# Or install in editable mode for development
pip install -e .[dev]

# Or minimal installation (core only)
pip install .

Available extras

  • minimalmodbus - Modbus communication backend
  • schedule - Scheduling backend
  • recommended - Recommended setup for most users (minimalmodbus + schedule)
  • all - All available backends
  • dev - Development dependencies (includes pytest, coverage tools, and backends)

Requirements

AtmosPyre requires Python 3.10+ and the following dependencies:

  • multipledispatch (≥0.6.0) - Type-based dispatch for sensor tags

The currently implemented and tested backends are:

  • minimalmodbus (≥2.0.0) - Modbus RTU communication
  • schedule (≥1.2.2) - Job scheduling

These are automatically installed when you pip install atmospyre[recommended].

Example: Multi-Sensor Data Logging

This example demonstrates setting up multiple sensors on the same serial port and logging their data at different intervals:

Hardware Setup:

  • GMP252 CO₂ sensor at address 121 (19200 baud, 2 stop bits)
  • AlphaTRACER radon sensor at address 122 (19200 baud, 1 stop bit)
  • Both connected to /dev/ttyACM0

The sensors automatically share the port without conflicts.

import time
from atmospyre.sensors.implementations.co2 import gmp252
from atmospyre.sensors.implementations.radon import alphatracer
from atmospyre.sensors import Stopbits
from atmospyre.loggers import SensorLogger
from atmospyre.loggers.strategies.writers import CSVWriter
from atmospyre.loggers.strategies.savers import JSONMetadataSaver
from atmospyre.scheduler.logger_scheduler import LoggerScheduler
from atmospyre.scheduler.schedule.schedule_backend import ScheduleTag

def main():
    # CO2 Sensor - Vaisala GMP252
    co2_sensor = gmp252.GMP252(
        port='/dev/ttyACM0',
        slave_address=121
    )

    # Radon Sensor - RadonTech AlphaTRACER
    radon_sensor = alphatracer.AlphaTRACER(
        port='/dev/ttyACM0',
        slave_address=122,
        baudrate=19200,
        stopbits=Stopbits.ONE
    )

    # CO2 Logger - logs every 10 seconds
    co2_logger = SensorLogger(
        sensor=co2_sensor,
        tags=[gmp252.CO2, gmp252.MEASURED_TEMPERATURE],
        interval_seconds=10,
        output_path="./CO2Probe",
        writer=CSVWriter(),
        metadata_saver=JSONMetadataSaver()
    )

    # Radon Logger - logs every 10 minutes
    radon_logger = SensorLogger(
        sensor=radon_sensor,
        tags=[alphatracer.RADON_LIVE],
        interval_seconds=600,
        output_path="./RadonProbe",
        writer=CSVWriter(),
        metadata_saver=JSONMetadataSaver()
    )

    # Scheduler Setup
    scheduler = LoggerScheduler(
        scheduler_dispatch_tag=ScheduleTag(),
        log_path="./scheduler_logs"
    )

    scheduler.add_logger(logger=co2_logger)
    scheduler.add_logger(logger=radon_logger)

    # Run
    print("Starting multi-sensor data logging...")
    print(f"  - CO2 sensor: logging every 10 seconds to ./CO2Probe")
    print(f"  - Radon sensor: logging every 600 seconds to ./RadonProbe")
    print("Press Ctrl+C to stop.\n")

    try:
        while True:
            scheduler.run_pending()
            time.sleep(1)
    except KeyboardInterrupt:
        print("\n\nStopping data logging...")

if __name__ == "__main__":
    main()

Supported Sensors

  • Vaisala GMP252 — CO₂ and temperature
  • RadonTech AlphaTRACER — Radon concentration

Quick Links

Metadata

Release files for atmospyre 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atmospyre 1.0.0
File Size Uploaded Provenance
atmospyre-1.0.0.tar.gz 58.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for atmospyre 1.0.0
File Interpreter ABI Platform
atmospyre-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 131.9 kB

Release files / atmospyre-1.0.0.tar.gz

Download URL atmospyre-1.0.0.tar.gz
Size 58.4 kB
Tags Source
SHA-256 checksum
How to use checksums
425f52f35b6dee590b400009047c7ba68a36f35c12043d0ddb941266bdf7f854
BLAKE2b-256 checksum
How to use checksums
af03416d87422789e9ccc3f08c688d935ba5dcd53a9085ebb9c19497c1a98f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / atmospyre-1.0.0-py3-none-any.whl

Download URL atmospyre-1.0.0-py3-none-any.whl
Size 73.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e196133de0e0202b0bce69d63992c1c00b9e0d0228cb603767587af2afd141b7
BLAKE2b-256 checksum
How to use checksums
43325a02fd6831fb6d4025a0081b630ff9a2c66310aa83d3569b9ba6bb7eb8d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for atmospyre 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page