About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Knowledge Base

The AB Electronics UK Knowledge Base provides support solutions, tutorials and troubleshooting guides.

Knowledge Base

OWFS with I2C support on Raspberry Pi

Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero
Created: 02/10/2015 | Last Updated: 13/09/2020

This page details how to set up the 1 Wire File System to use with the 1 Wire Pi Plus and 1 Wire Pi Zero on Raspbian "Stretch" from http://www.raspberrypi.org/downloads

Step 1: Download the latest Raspbian linux image and burn to your SD Card following the instructions on http://elinux.org/RPi_Easy_SD_Card_Setup

Step 2: Follow our I2C, SMBus and Raspbian Linux tutorial to set up I2C on the Raspberry Pi.

Step 3:  Install OWFS and Python-OW

sudo apt-get update
sudo apt-get install owfs python-ow ow-shell

Step 4: Edit owfs.conf to enable the I2C 1 Wire interface

sudo nano /etc/owfs.conf

Comment out the following line

# server: FAKE = DS18S20,DS2405

Find the following section

# USB device: DS9490
#server: usb = all

Insert the line below to enable i2c support. 

server: device = /dev/i2c-1

Find the section titled

######################### OWFS ##########################

Remove the hashes from the lines

mountpoint = /mnt/1wire

Save your changes and exit the nano editor.

Step 5: Create a folder where the 1 Wire devices will be mounted.

sudo mkdir /mnt/1wire

Step 6: Reboot your Raspberry Pi

sudo reboot

Step 7: Enable the owserver service

sudo systemctl enable owserver.service

Step 8: Your Raspberry Pi should now work with OWFS.  To test this we will create a python script which lists all 1 Wire devices connected to the 1 Wire Pi.

Create a new python script called 1wiretest.py

nano 1wiretest.py

Insert the following python code:

import ow
sensorlist = ow.Sensor('/').sensorList()
for sensor in sensorlist:
    print('Device Found')
    print('Address: ' + sensor.address)
    print('Family: ' + sensor.family)
    print('ID: ' + sensor.id)
    print('Type: ' + sensor.type)
    print(' ')

Step 9: Save and run the file.

python 1wiretest.py

If everything works correctly the script should list every 1 Wire devices connected to the Raspberry Pi.

Using OWFS you can mount your 1 Wire devices to appear within the linux file system.  To mount the available devices run the following command.

sudo owfs -C -uall -m /mnt/1wire --allow_other

Your 1 Wire devices can be found in the directory /mnt/1wire


On certain versions of owfs available on Raspbian Linux a bug causes devices in the /mnt/1wire directory to be duplicated, showing two folder for each device.

If you encounter this problem it can be resolved by editing the configuration file for the owfs service.

Step 1: Open /lib/systemd/system/owfs.service in an editor.

sudo nano /lib/systemd/system/owfs.service

Step 2: Find the following line.

ExecStart=/usr/bin/owfs -c /etc/owfs.conf --allow_other %t/owfs

Remove "-c /etc/owfs.conf" so the line now looks like this.

ExecStart=/usr/bin/owfs --allow_other %t/owfs

Step 3: Save the file and reboot your Raspberry Pi.

You should now only see one instance of each device in the /mnt/1wire directory.

Was this article helpful? Yes / No

Releated Products

Order a 1 Wire Pi Plus 1-Wire expansion board for the Raspberry Pi

1 Wire Pi Plus

£11.99 Inc VAT: £14.39

Order a 1 Wire Pi Zero 1-Wire expansion board for the Raspberry Pi Zero

1 Wire Pi Zero

£10.49 Inc VAT: £12.59

Related Articles