To connect 1-wire serial devices to the RPi I am using a DS9490R USB 1-wire adapter (rather than wiring I2C 1-Wire master components to GPIO I2C – which I might look at sometime down the track)
Install packages
sudo apt-get install owfs ow-shell
Edit config file
vim /etc/owfs.conf
! server: server = localhost:4304
# USB device: DS9490
server: usb = all
######################### OWFS ##########################
mountpoint = /mnt/1wire
allow_other
####################### OWHTTPD #########################
http: port = 2121
####################### OWFTPD ##########################
ftp: port = 2120
####################### OWSERVER ########################
server: port = localhost:4304
Create Startup Script
I created a startup script for owfs modelled on the owserver script (not sure why this one is actually missing)
vim /etc/init.d/owfs
#!/bin/sh
### BEGIN INIT INFO
# Provides: owfs
# Required-Start: $remote_fs $syslog $network $named
# Required-Stop: $remote_fs $syslog $network $named
# Should-Start: owfs
# Should-Stop: owfs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: 1-wire file system mount & update daemon
# Description: Start and stop 1-wire file system mount & update daemon.
### END INIT INFO
CONFFILE=/etc/owfs.conf
DESC="1-Wire file system mount"
NAME="owfs"
DAEMON=/usr/bin/$NAME
case "$1" in
start)
echo "Starting $NAME"
$DAEMON -c $CONFFILE
;;
stop)
echo "Stopping $NAME"
killall $NAME
;;
*)
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit 0
Starting daemons
/etc/init.d/owserver start
/etc/init.d/owfs start
Checking output
#ls /mnt/1wire/
Should show output similar to:
10.575349000000 12.95DD17000000 alarm simultaneous uncached
10.575349000000 12.95DD17000000 bus.0 statistics
12.57DD16000000 81.B2EA2E000000 bus.1 structure
12.57DD16000000 81.B2EA2E000000 settings system
cat /mnt/1wire/10.575349000000/temperature
Will then show the temperature of the particular DS18S20 temperature sensor.
DAEMON=/opt/owfs/bin
It seems to have been moved in current release (2014-09).
If I try
sudo bash /etc/init.d/owfs start
I get “DEFAULT: owfs.c:(92) No mount point specified.” Any ideas?
Maybe i have noob problem.. but i can not solve this, do you maybe have some idea, where to start debugging this problem..
pi@raspberrypi ~ $ python owtemp.py
Traceback (most recent call last):
File “owtemp.py”, line 11, in
file_object=open(file_name,’r’)
IOError: [Errno 2] No such file or directory: ‘/mnt/1wire/10.3D92BC000800/temperature’
and when i type…
pi@raspberrypi ~ $ sudo owfs -C -uall -m /mnt/1wire –allow_other
pi@raspberrypi ~ $ python owtemp.py
18.4375C
Now i get temp reading but without actual file, strange..
It is a bit unclear to me why this works, as it does..