Skip to main content

Raspberry pi i2c driver for Maxim-Dallas DS1621 DS1631 DS1631A DS1721 DS1731 digital thermometer and thermostat.

Project description


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


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

Installing DS1631 python module

From Pypi repository :

pip install DS1631


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
# thermometer config
# read temperature
while True:
    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,
while True:
    temperature = room.get_temperature()
    print("Temperature  : {} °C".format(temperature))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for DS1631, version 0.3.7
Filename, size File type Python version Upload date Hashes
Filename, size DS1631-0.3.7.tar.gz (8.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page