Knowledge Base

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

Knowledge Base

OWFS with I2C support on ODroid

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

This tutorial details how to set up the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero on an ODroid computer running Ubuntu 20.04 from https://www.hardkernel.com.

Step 1: Download the latest Ubuntu image and burn it to your SD Card following the instructions on https://wiki.odroid.com/getting_started/os_installation_guide.

Step 2: Follow our ODroid C1 Ubuntu I2C Setup or ODroid C2 Ubuntu I2C Setup tutorial to set up I2C on the ODroid platform.

Step 3:  Install OWFS

sudo apt-get update
sudo apt-get install owfs 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

Note: If your Odroid computer uses a different I2C bus for pins 3 and 5 on the GPIO header, change i2c-1 to the correct bus number for your setup. 

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 5: Create a folder where the 1 Wire devices will be mounted.

sudo mkdir /mnt/1wire

Step 6: Reboot your ODroid

sudo reboot

Step 7: Enable the owserver service

sudo systemctl enable owserver.service

Step 8: Your ODroid 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 ODroid and running Ubuntu 20.04, 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 ODroid.

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 04/10/2023 | 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 Basket
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 Basket

Related Articles

ODroid C2 Ubuntu I2C Setup
How to set up I2C communication on the Odroid C2 using i2c tools.
ODroid Board Introduction
Getting started with the ODroid Board
Using the 1-Wire w1 Subsystem with the 1 Wire Pi
Enabling w1 and finding 1-Wire devices
ODroid C1 Ubuntu I2C Setup
How to set up I2C communication on the Odroid C1 using i2c tools.
OWFS with I2C support on Raspberry Pi
Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero
OWFS with I2C support on ODroid
Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero
1 Wire with DS18S20 digital thermometer
Using 1 Wire with DS18S20 digital thermometer