Skip to main content

pico-tc08

Simple Python library for the Pico Technology USB TC-08 8-channel thermocouple data logger.

Uses direct ctypes bindings to the Pico shared library — bypasses the official picosdk Python wrapper, which has a macOS-specific attribute-naming bug that prevents it from loading the library.

Features

  • All 8 channels with any mix of thermocouple types (B, E, J, K, N, R, S, T)
  • Cold junction compensation temperature included in every reading
  • Averaged readings over a configurable time window
  • Continuous CSV logging (appends, runs until Ctrl+C)
  • Descriptive error messages for all common failure modes (missing library, wrong CPU architecture, device not connected)
  • Context manager support for safe resource cleanup

Important: Apple Silicon (M1/M2/M3/M4)

The Pico TC-08 library ships as an x86_64 binary only. It cannot run natively on Apple Silicon processors.

This library detects this at startup and prints clear instructions. See the Apple Silicon Setup section below.

Installation

pip install pico-tc08

Prerequisites

Install PicoLog for macOS from the Pico Technology website:

https://www.picotech.com/downloads

This installs PicoLog.app which contains the required libusbtc08.dylib library at:

/Applications/PicoLog.app/Contents/Resources/libusbtc08.dylib

Apple Silicon Setup (M1/M2/M3/M4)

The Pico library is an x86_64-only binary — it must run under Rosetta 2 (x86_64 emulation).

Run the provided setup script once:

bash setup_arm_mac.sh

This creates a dedicated tc08x86 conda environment under a Rosetta-compatible Miniconda installation. After setup:

conda activate tc08x86
python your_script.py

Manual Quick Fix

For a one-off run without the setup script:

arch -x86_64 python your_script.py

How the error looks

If you try to import pico_tc08 on Apple Silicon without Rosetta, you get:

======================================================================
  APPLE SILICON DETECTED — Rosetta 2 required
======================================================================

  You are running Python natively on ARM64 (Apple Silicon).
  The Pico library at:
    /Applications/PicoLog.app/Contents/Resources/libusbtc08.dylib
  is an x86_64 binary and CANNOT run on ARM processors.

  FIX OPTION 1 — Quick run under Rosetta 2:
    arch -x86_64 python your_script.py

  FIX OPTION 2 — Create a dedicated x86_64 conda environment:
    bash setup_arm_mac.sh
    conda activate tc08x86
    python your_script.py
======================================================================

Quick Start

1. Check your environment

from pico_tc08 import check_environment
check_environment()  # raises RuntimeError with clear instructions if anything is wrong

2. Single reading

from pico_tc08 import quick_read

sample = quick_read(channel_types={1: "K", 2: "K"})
if sample:
    print(f"Cold junction: {sample.cold_junction:.2f} °C")
    for ch, temp in sample.channels.items():
        print(f"  CH{ch}: {temp:.2f} °C")

3. Continuous CSV logging

from pico_tc08 import log_csv

log_csv(
    out_csv="temperatures.csv",
    channel_types={1: "K", 2: "K", 3: "T"},
    interval_seconds=300.0,       # log every 5 minutes
    sample_window_seconds=5.0,    # average over 5 seconds per log entry
    mains_hz=50,
)

4. Full device control

from pico_tc08 import TC08Device

with TC08Device(channel_types={1: "K", 2: "K", 3: "T", 4: "J"}, mains_hz=50) as dev:
    # Single reading
    sample = dev.read_once()
    print(f"Cold junction: {sample.cold_junction:.2f} °C")
    for ch, temp in sample.channels.items():
        print(f"  CH{ch}: {temp:.2f} °C")

    # Averaged reading over 10 seconds
    last, stats, (cjc_mean, cjc_std) = dev.sample_window(window_seconds=10.0)
    for ch, (mean_c, std_c) in stats.items():
        print(f"  CH{ch}: {mean_c:.2f} ± {std_c:.3f} °C")

API Reference

check_environment(lib_path=None)

Verify that the environment is correctly configured. Raises RuntimeError with instructions if anything is missing or misconfigured.

TC08Device Class

__init__(channel_types=None, mains_hz=50, lib_path=None)

Parameter Default Description
channel_types {1: "K"} Dict mapping channel (1–8) to thermocouple type
mains_hz 50 Mains frequency for noise filtering (50 or 60 Hz)
lib_path platform default Override library path

Thermocouple types: "B", "E", "J", "K", "N", "R", "S", "T"

Methods

Method Returns Description
open() — Open USB connection and configure channels
close() — Close USB connection
read_once(retries=10) Sample Single temperature reading
sample_window(window_seconds=5.0) (Sample, dict, tuple) Averaged reading over a time window

Context Manager

with TC08Device({1: "K"}) as dev:
    sample = dev.read_once()
# device automatically closed on exit

Sample Dataclass

Attribute Type Description
t_wall float Wall-clock timestamp (time.time())
t_mono float Monotonic timestamp (safe for duration math)
cold_junction float Cold junction compensation temperature (°C)
channels dict {channel_number: temperature_C}

Convenience Functions

log_csv(out_csv, channel_types, interval_seconds=300, sample_window_seconds=5, mains_hz=50)

Run continuous CSV logging until Ctrl+C. Appends to existing file.

quick_read(channel_types=None, mains_hz=50) -> Optional[Sample]

Connect, read once, disconnect. Returns Sample or None on failure.

CSV Output Format

t_wall,cold_mean_C,cold_std_C,ch1_mean_C,ch1_std_C,ch2_mean_C,ch2_std_C
1740000000.123,23.45,0.12,85.23,0.15,82.11,0.13
1740000300.456,23.47,0.11,86.01,0.14,82.98,0.12
  • t_wall: Unix timestamp of the reading
  • cold_mean_C / cold_std_C: Cold junction mean and standard deviation
  • chN_mean_C / chN_std_C: Channel N mean and standard deviation

Notes

  • Always close PicoLog before using this library — it holds the USB device
  • The minimum sampling interval is 200 ms (hardware limitation)
  • Channels not listed in channel_types are disabled
  • On macOS, the library is loaded from inside PicoLog.app — do not uninstall PicoLog

License

MIT License

Metadata

Release files for pico-tc08 0.1.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 pico-tc08 0.1.0
File Size Uploaded Provenance Actions
pico_tc08-0.1.0.tar.gz 10.3 kB Without provenance Details for pico_tc08-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pico-tc08 0.1.0
File Interpreter ABI Platform Actions
pico_tc08-0.1.0-py3-none-any.whl Python 3 none any Details for pico_tc08-0.1.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / pico_tc08-0.1.0.tar.gz

Download URL pico_tc08-0.1.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6c635e3c7a270f32d3da6cc591c476743c03c568d85914a73ccd39e2d2daa96
BLAKE2b-256 checksum
How to use checksums
51c5df3a651c436599d503bd128c9de23f6280d50492ed9ab1e577316329a232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / pico_tc08-0.1.0-py3-none-any.whl

Download URL pico_tc08-0.1.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e6dd71e4598b65c11138b14f7a1e984771c1be3fecd041905d54dc46d766b8a
BLAKE2b-256 checksum
How to use checksums
f08c1c864b6a9e0fb3b2a860a0bc63c552add11f688ac2a3bc7a317b5abd9321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for pico-tc08 0.1.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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