Skip to main content

DS1631

This pure python module provides a raspberry pi i2c driver for Maxim-Dallas DS1621 DS1631 DS1631A DS1721 DS1731 high-precision digital thermometer and thermostat.

Prerequisites

Python : version 3
Raspberry pi (OS Raspbian)
All operating systems with virtual device

Installing DS1631 python module

From Pypi repository :
https://pypi.org/project/DS1631

pip install DS1631

Datasheets

2-wire serial data bus

DS1631s (8 devices max) are connected to Raspberry pi i2c GPIO with 4 wires :

  • SDA i2c bus (GPIO2)
  • SCL i2c bus (GPIO3)
  • Power (3.3 V or 5 V)
  • Ground

Basic usage

Raspberry pi : OS Raspbian

First, you need python 3 smbus module :

sudo apt install python3-smbus

DS1631 device simple example

import DS1631
import time

i2c_address = 0x48
ic1 = DS1631.DS1631(1, i2c_address)
# thermostat config
ic1.set_tout_polarity("active-low")
ic1.set_thigh(22.5)
ic1.set_tlow(20.5)
# thermometer config
ic1.set_conversion_mode("continuous")
ic1.set_resolution(12)
ic1.start_convert()
# read temperature
while True:
    time.sleep(0.75)
    temperature = ic1.get_temperature()
    print("Temperature  : {} °C".format(temperature))

Virtual device simple example

DS1631 module provides a DS1631virtualdevice class for development without raspberry pi or DS1631s devices.

On–Off controller (hysteresis controller) simulation is performed :

  • if temperature > thigh then electric radiator OFF
  • if temperature < tlow then electric radiator ON

Of course, you don't need python 3 smbus module, so you can work with a Windows OS computer or Android OS device (pydroid3).

import DS1631
import time

# virtual device
room = DS1631.DS1631virtualdevice(initial_temperature=18,
                                  thigh=20, tlow=19,
                                  P=1000, R=0.02,
                                  tau=360,
                                  Text_max=15,Text_min=10,
                                  period=24*3600)
while True:
    time.sleep(0.75)
    temperature = room.get_temperature()
    print("Temperature  : {} °C".format(temperature))

Metadata

Release files for DS1631 0.3.7

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

Source distribution (sdist)

Source distribution for DS1631 0.3.7
File Size Uploaded Provenance
DS1631-0.3.7.tar.gz 8.5 kB Without provenance Details

Release files / DS1631-0.3.7.tar.gz

Download URL DS1631-0.3.7.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
84c608dcaaadfd87a54abfbf9fc2d834bc0553d9e35fab1ace32c2b52d6d1dbb
BLAKE2b-256 checksum
How to use checksums
b020fa7b97b03f2efdc6eeeffacbaeaf5bbaaa01a39570ff5015c5c883d269a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.5.2

Security for DS1631 0.3.7

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.3.7 This release

1 release file 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