skip to navigation
skip to content

Not Logged In

pydigitemp 1.1.post1

Python implementation of 1-Wire protocol

Python implementation of 1-Wire protocol.

Originally written to replace digitemp utility in my pet project and get direct access to 1-wire devices. It was created for reading DS1820 temperature sensor connected to RS232 serial port through DS9097 adapter.

Supported Hardware

Master

  • DS9097 - COM port adapter which performs RS-232C level conversion.
  • Custom 1-wire serial port interface (see below).

Slave

Usage

Find ROM codes for all connected devices:

from digitemp.master import UART_Adapter
from digitemp.device import AddressableDevice

print(AddressableDevice(UART_Adapter(0)).get_connected_ROMs())
# ['108739A80208006F', '10A75CA80208001A']

Get temperature:

from digitemp.master import UART_Adapter
from digitemp.device import DS1820

bus = UART_Adapter(0)  # DS9097 connected to COM1 (/dev/ttyS0)

# only one 1-wire device on the bus:
sensor = DS1820(bus)

# specify device's ROM code if more than one 1-wire device on the bus:
sensor = DS1820(bus, rom='10D67E5B02080037')

# display sensor's information
sensor.info()

# get temperature
print(sensor.get_temperature())
# 25.48

1-wire serial port interface

See Serial Port Temperature Sensors - Hardware Interface for details.

License

Python license. In short, you can use this product in commercial and non-commercial applications, modify it, redistribute it. A notification to the author when you use and/or modify it is welcome.

See the LICENSE file for the actual text of the license.

 
File Type Py Version Uploaded on Size
pydigitemp-1.1.post1.tar.gz (md5) Source 2015-04-03 10KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 43 downloads in the last week
  • 178 downloads in the last month