lördag 26 september 2015

1Wire på Raspberry Pi


NOTE!! Seems to not work on Jessie!

#***************************************************
#**********            INSTALL            **********
#***************************************************

#Install One Wire File System (OWFS)
sudo apt-get install -y owfs

#Create Mount point
sudo mkdir /mnt/1wire

#fuse.conf really needed?
sudo nano /etc/fuse.conf
user_allow_other

#***************************************************
#**********           CONFIGURE           **********
#***************************************************

#Either configure your /etc/owfs.conf with yur favourite text editor (vim/nano) or run below comands for my configuration

#Replace: "server: FAKE = ..." with your device in /etc/owfs.conf, e.g:
sudo sed -i 's/^server\:.*/server: device =\/dev\/ttyUSB0/g' /etc/owfs.conf

#Uncomment mountpoint = /mnt/1wire
sudo sed -i 's/^#mountpoint.*/mountpoint = \/mnt\/1wire/g' /etc/owfs.conf

#Uncomment allow_other
sudo sed -i 's/^#allow_other.*/allow_other/g' /etc/owfs.conf

#Test start
sudo owfs

#Test
ls /mnt/1wire/
cat /mnt/1wire/28.746FE0020000/temperature

#http://pi1:2121/

#***************************************************
#**********            AUTOSTART          **********
#***************************************************
#(only half finished)
 

#Copy autostart skeleton
sudo cp /etc/init.d/skeleton /etc/init.d/switchkingd
sudo sed -i 's/^# Provides: .*/# Provides:          OWFS/g' /etc/init.d/owfs

sudo sed -i 's/^# Short-Description: .*/# Short-Description: OneWireFileSystem service daemon/g' /etc/init.d/
owfs


# Provides:          start1wire
# Required-Start:    $local_fs $syslog
# Required-Stop:     $local_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start OWFS at boot time
# Description:       Start OWFS at boot time
### END INIT INFO

# Starts OWFS
owfs

#

sudo chmod +x /etc/init.d/start1wire.sh

sudo update-rc.d start1wire.sh defaults

#Remove binaries
sudo apt-get remove mysql-server

#Remove config
sudo rm /etc/owfs.conf

#Removemount point
sudo rmdir /mnt/1wire
 

#Source:
#http://wiki.m.nu/index.php/OWFS_p%C3%A5_Rasperry_Pi

Inga kommentarer:

Skicka en kommentar