Knowledge Base

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

Knowledge Base

OWFS with I2C support on the Asus Tinker Board

Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero

This page details how to set up the 1-Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero on the TinkerOS Debian image for your Asus Tinker Board.

Step 1:  Install OWFS and Python-OW

sudo apt-get install owfs python-ow

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

 

 

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
allow_other

Save your changes and exit the nano editor.

 

Step 6: Create a directory called 1wire in /mnt 

sudo mkdir /mnt/1wire

 

Step 7: Before using OWFS with Python, you must start owserver.  To start this, when the Tinker Board boots, you must enable the owserver service.

sudo systemctl enable owserver

 

Step 8: Reboot your Tinker Board

sudo reboot

 

Step 9: Your Tinker Board 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
ow.init('localhost:4304')
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 device connected to the Tinker Board.

Note:

On specific versions of owfs available on Debian Linux, a bug causes devices in the /mnt/1wire directory to be duplicated, showing two folders 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 looks like this.

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

Step 3: Save the file and reboot your Tinker Board.

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


Was this article helpful? Yes No

Please tell us how we can improve this article:

Submit
Created 11/02/2017 | Last Updated: 25/10/2023

Related Expansion Boards

Order a 1 Wire Pi Plus Photo of 1 Wire Pi Plus
1 Wire Pi Plus

1 Wire interface for the Raspberry Pi

£14.39 Ex VAT: £11.99
Add to Cart
Order a 1 Wire Pi Zero Photo of 1 Wire Pi Zero
1 Wire Pi Zero

1 Wire interface for the Raspberry Pi Zero

£13.79 Ex VAT: £11.49
Add to Cart

Related Articles

Asus Tinker Board Introduction
Getting started with the Tinker Board
I2C and SMBus on the Tinker Board
Configuring I2C and SMBus with Python on the Asus Tinker Board
SPI on the Tinker Board
Configuring the SPI bus on the Asus Tinker Board
OWFS with I2C support on the Asus Tinker Board
Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero