Knowledge Base

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

Knowledge Base

OWFS with I2C support on Orange Pi

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 Armbian image from https://www.armbian.com for your Orange Pi computer. Armbian 23.8.1 Bookwoom was used for testing this tutorial.

Step 1:  Install OWFS and Python-OW

sudo apt-get install owfs owserver

Step 2: 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-0

If your Orange Pi model uses a different I2C bus for pins 3 and 5 on the GPIO header, change i2c-0 to the number for your I2C bus.

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: Enable the owserver service

sudo systemctl enable owserver.service

Step 7: Reboot your Orange Pi

sudo reboot

Step 8: Your Orange Pi should now work with OWFS.

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

Each 1 Wire device directory will contain several files representing the values available from that device. For example, with the DS18B20 temperature sensors, there will be a directory in /mnt/1wire with the serial number for the sensor, normally starting with "28.". Inside the directory for the sensor, you may find the following files.

address errata id power r_locator temperature10 temperature9 tempres

alias family latesttemp r_address scratchpad temperature11 temphigh type

crc8 fasttemp locator r_id temperature temperature12 templow

The temperature for the sensor is stored in the "temperature" file, so we can use the "cat" command to display the file's contents. For example, with a sensor called "28.0844C4030000", you would use the following command.

cat /mnt/1wire/28.0844C4030000/temperature

 

Note:

On specific versions of owfs available on the Orange Pi and running Ubuntu or Armbian, 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 Orange Pi.

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

Related Articles

Orange Pi computer boards introduction
Expansion boards compatible with the Orange Pi computers using Armbian linux
OWFS with I2C support on Orange Pi
Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero