Skip to content

Protocentral/protocentral-micropython-max30205

Repository files navigation

ProtoCentral MAX30205 MicroPython Library

Publish to PyPI

MicroPython library for the ProtoCentral MAX30205 ±0.1 °C clinical-grade human body-temperature breakout board. The same driver also runs on a Raspberry Pi (via a lightweight smbus2 shim), so one codebase covers MCUs (Raspberry Pi Pico, ESP32) and Linux SBCs alike.

Don't have one? Buy it here

Features

  • 16-bit (0.00390625 °C / LSB) digital temperature sensor
  • ±0.1 °C accuracy over 37 °C to 39 °C — clinical / body-temperature grade
  • I2C interface, default address 0x48 (strap A0–A2 for 0x480x4F, up to 8 on one bus)
  • Qwiic / STEMMA QT connector for solder-free wiring
  • Continuous and shutdown (low-power) conversion modes
  • Programmable over-temperature (OS) comparator with hysteresis
  • One driver for MicroPython and Raspberry Pi / Linux

Installation

MicroPython (Raspberry Pi Pico, ESP32, …)

Install over the network with mip:

mpremote mip install github:Protocentral/protocentral-micropython-max30205

Or copy protocentral_max30205.py to the board's filesystem manually (e.g. mpremote cp protocentral_max30205.py :).

Raspberry Pi / Linux

sudo raspi-config            # Interface Options -> enable I2C
pip install protocentral-max30205
i2cdetect -y 1               # confirm the sensor shows up at 0x48

Hardware Setup

The board uses I2C. Connect power, ground, and the two I2C lines; the default address is 0x48.

Raspberry Pi Pico (MicroPython)

MAX30205 Pin Pico Pin Notes
VIN 3V3 (OUT) 3.3 V supply
GND GND Ground
SDA GP6 I2C0 SDA
SCL GP7 I2C0 SCL

ESP32 (MicroPython)

MAX30205 Pin ESP32 Pin Notes
VIN 3V3 3.3 V supply
GND GND Ground
SDA GPIO21 default I2C SDA
SCL GPIO22 default I2C SCL

Raspberry Pi (Linux)

MAX30205 Pin RPi Header Notes
VIN Pin 1 (3V3) 3.3 V supply
GND Pin 6 (GND) Ground
SDA Pin 3 (GPIO2 / SDA1) I2C bus 1
SCL Pin 5 (GPIO3 / SCL1) I2C bus 1

Quick Start

MicroPython

import time
from machine import Pin, I2C
from protocentral_max30205 import MAX30205

i2c = I2C(0, scl=Pin(7), sda=Pin(6), freq=400000)   # set pins for your board
sensor = MAX30205(i2c)

if sensor.scan_available_sensors() is None:
    raise SystemExit("No MAX30205 found on the bus")
sensor.begin()

while True:
    print("Temperature: {:.2f} C".format(sensor.get_temperature()))
    time.sleep(1)

Raspberry Pi / Linux

Same driver — swap machine.I2C for the smbus2 shim:

import time
from protocentral_max30205_linux import I2C
from protocentral_max30205 import MAX30205

with I2C(bus=1) as i2c:
    sensor = MAX30205(i2c)
    sensor.begin()
    while True:
        print("Temperature: {:.2f} C".format(sensor.get_temperature()))
        time.sleep(1)

API Reference

Constructor

Constructor Description
MAX30205(i2c, address=0x48) Create a sensor on a machine.I2C (or Pi shim) bus, optional I2C address

Methods

Method Returns Description
scan_available_sensors() int or None Probe 0x480x4F; binds and returns the first address found, else None
begin() Wake into continuous-conversion mode (clears the SHUTDOWN bit)
get_temperature() float Read body temperature in °C (handles two's-complement negative values)
shutdown() Enter low-power shutdown mode
set_over_temp(celsius) Set the OS comparator over-temperature trip point (TOS)
set_hysteresis(celsius) Set the OS comparator hysteresis / release point (THYST)

Examples

Example Platform Description
max30205_simpletest.py MicroPython Scan, begin, and print temperature once per second
max30205_raspberrypi.py Raspberry Pi Same loop using the smbus2 shim

Tests

A mocked-bus unit suite runs on desktop CPython — no hardware or smbus2 install required:

python3 tests/test_max30205.py

It covers positive and negative (two's-complement) temperatures, the begin/shutdown config writes, sensor scanning, and Raspberry Pi shim parity.

License

Software: MIT License — see LICENSE.md.

Hardware: the MAX30205 breakout board is open-source hardware licensed under CERN-OHL-P v2.

Based on the ProtoCentral MAX30205 Arduino library — method names and behaviour mirror it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages