个人工具

UbuntuHelp:1wireSoftware

来自Ubuntu中文

跳转至: 导航, 搜索

There are several kinds of software available to work with 1wire technology, I'll be detailing those I know. Please feel free to add or edit what you see.

Introduction

1wire technology gives you the chance to read temperatures, humidities, even detect rain and count door closures at great distances. Some of the software available for Linux makes controlling these things so simple as to nearly be trivial. And like always, there's choice and style.

OWFS

OWFS is a set of tools for reading/writing to the 1wire network. It's primary and IMO most clever one is OWFS itself: it reads the network and creates a directory of all that it sees. Reading a temperature becomes trivial. Here's how I turn on the exhaust fan in my trailer:

echo "1" > /var/1wire/1F.38C704000000/main/05.62E531000000/PIO

Here's how I turn it off:

echo "0" > /var/1wire/1F.38C704000000/main/05.62E531000000/PIO

Did I leave the fan on, or off?

cat /var/1wire/1F.38C704000000/main/05.62E531000000/PIO
0

No, it's off. Good thing, too- might rain. The project's located at: http://owfs.sourceforge.net/

owhttpd

This part of the package listens on port 81 like a web server, allowing you to 'walk around' the net and read values, setting some too. (screenshot)

owserver

This part lets you summarize the activity on one machine that actually connects tot the 1wire network, and remotely control it from across the globe.

owperl

A module that integrates nicely into perl for working with the network.

owpython

A module that integrates nicely into Python.

owphp

A set of bindings for PHP

owtcl

TCL bindings.

Building under Dapper

OWFS sure takes the work out of dealing with the network, and it provides a lot of options for other languages and protocols. Hey, let's build on on Dapper, shall we? What follows is largely based on Tomasz' Howto at [1]

Install required software

The Universe repository is required to get fuse-utils.

 apt-get install automake autoconf autotools-dev gcc g++ \
      libtool libusb-dev fuse-utils libfuse-dev swig \
       python2.4-dev tcl8.4-dev php5-dev

Get OWFS: Notice the version number will change.

cd /usr/src
wget http://umn.dl.sourceforge.net/sourceforge/owfs/owfs-2.4p3.tar.gz

Extract the file:

tar zxpf owfs-2.4p3.tar.gz

Compile and install:

cd owfs-2.4p3
./configure
make && make install

Mount the 1wire filesystem:

mkdir /var/lib/1wire
modprobe fuse
/opt/owfs/bin/owfs -U -F /var/1wire

See if it's there:

ls /var/1wire
09.CF9EC8010000
10.64502F000800
alarm
bus.0
simultaneous
statistics
structure
system
uncached

The 1F.XXXXXXXXXXXX devices there are hubs, that have other devices 'behind' them. The 10.64502F000800 above is a device for reading temperature. If you see something that looks similar, it's done. Several options are available, too; things specific to hardware, as well as whether to build the other packages, etc at the OWFS site.

Other Software

I've not used anything else, though I know there are alternatives, even alternatives for Windows, if you're so afflicted. :)

An Example: CounterMoon.org

I'm working on a trailer that uses Ubuntu, OWFS, and 1Wire technology. Come see what it looks like: 1wireAppCountermoon.org Back to the Meta 1wire