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

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

Repeated problems using 1wire plus from Python

1661 Views - Created 08/09/2016

08/09/2016

Posted by:
dhewison

Users Avatar

Hi,

 I've followed the installation instructions for the software for 1wire plus, OWFS, and keep having numerous problems accessing 1wire devices from Python 2.7.9, any help would be greatly appreciated as I'm getting serioulsy fed up with it.

 Currently I can read the temperature of a DS18B20 using:

   cat /mnt/1wire/28.53C158070000/temperature

But, the line in Python:

  ow.init('localhost:4304')

returns:

 File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init
    raise exNoController

It has worked on accasion previously and I do not knok what has changed to break it, I've re-installed it to no avail.

 

Regards,

David

08/09/2016

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hi David

I think I have found a solution to the problem you are having.  It looks like owserver is not running which is why your python script is throwing the exNoController error.  I tried installing owfs and when I ran the following python script I got the same error as you. 

import ow
ow.init('localhost:4304')
sensorlist = ow.Sensor('/').sensorList()
for sensor in sensorlist:
    print(sensor.address)
    print(sensor.family)
    print(sensor.id)
    print(sensor.type)

To fix the problem I did the following things.

Edit /etc/owfs.conf using the command: 

sudo nano /etc/owfs.conf

Add the following line in the same area as the other server:device lines:

server: device = /dev/i2c-1

This will allow owfs to connect to the 1 Wire Pi Plus.

The whole of the owfs.conf on my Raspberry Pi looked like this:

! server: server = localhost:4304

server: i2c = /dev/i2c-1:ALL

mountpoint = /mnt/1wire
allow_other

http: port = 2121

ftp: port = 2120

server: port = localhost:4304

Next start the owserver with the command:

sudo /opt/owfs/bin/owserver -c /etc/owfs.conf --pid-file /var/run/owfs/owserver.pid

Once owserver is running you should be able to run your python program.

owserver will need to be started each time the Raspberry Pi boots.  The easiest way to do this is to add the above command into /etc/rc.local so it will be run when the Raspberry Pi starts.

 

AB Electronics UK Tech Support

12/09/2016

Posted by:
dhewison

Users Avatar

Hi Andrew,

 Many thanks for the reply that has fixed the problem.

David

33 days ago

Posted by:
bcraytor

Users Avatar

Hello and good day!

I am having this issue as well, and have followed all the instructions above, I even copied and paste your file to owfs.conf without success, then I don't see anything from 1wiretest.py.  What am I doing wrong?

pi@bretraspberrypi:~ $ sudo systemctl enable owserver.service
owserver.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable owserver
pi@bretraspberrypi:~ $ python 1wiretest.py
Traceback (most recent call last):
  File "1wiretest.py", line 2, in <module>
    ow.init('localhost:4304')
  File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init
    raise exNoController
ow.exNoController
pi@bretraspberrypi:~ $ 
 

Thanks!

Bret

32 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Bret

Please can you try going through all of the steps in our OWFS tutorial

Also try running the command "sudo i2cdetect -y 1" which should return a list of devices connected to the I2C bus.  The 1 Wire Pi should appear on address 0x18.  If it does not appear then go through the steps in our I2C tutorial to make sure I2C is enabled on your Raspberry Pi.

AB Electronics UK Tech Support

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.