OWFS and Pi GPIO

1,739 views
Skip to first unread message

Gary Lake

unread,
Apr 20, 2014, 10:54:15 AM4/20/14
to weewx...@googlegroups.com
Hi guys,

I am new to the Raspberry Pi and Linux and I have been trying to get Weewx and OWFS to get some data from some DS18B20 sensors. I have one connected GPIO4 to try out the w1 kernel driver and a couple more connected to a DS2482S-100 i2c to 1-wire bridge to play with i2c.

The sensors on GPIO4 is detected and I can read temperature form the sensor with this:
cat /sys/bus/w1/devices/10-*/w1_slave
28 00 4b 46 ff ff 0a 10 39 : crc=39 YES
28 00 4b 46 ff ff 0a 10 39 t=20125

The sensors on the i2c I'm not so sure about but the DS2482 is detected on the i2c bus at the correct address.

When I try to the test it with the command from the OWFS driver readme file, I get this error:

~ $ sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/owfs.py --sensors

Traceback (most recent call last):
  File "/home/weewx/bin/user/owfs.py", line 261, in <module>
    main()
  File "/home/weewx/bin/user/owfs.py", line 229, in main
    ow.init(iface)
  File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init
    raise exNoController
ow.exNoController

I think it has something to do with info in the owfs.conf file as I get this in the syslog:

Apr 20 23:17:41 gazpi1 weewx[4099]: owfs: driver version is 0.4
Apr 20 23:17:41 gazpi1 weewx[4099]: owfs: interface is i2c
Apr 20 23:17:41 gazpi1 weewx[4099]: owfs: polling interval is 10
Apr 20 23:17:41 gazpi1 weewx[4099]: owfs: sensor map is {'inTemp': '/uncached/10-0008016cb3f8/temperature', 'outTemp': '/uncached/28-000004722924/temperature', 'extraTemp1': '/uncached/28-000004723323/temperature'}
Apr 20 23:17:41 gazpi1 weewx[4099]: owfs: sensor type map is {}
Apr 20 23:17:46 gazpi1 weewx[4099]: wxengine: Unable to open WX station hardware:

 In the owfs.conf I have set the "station_type to OWFS but can't workout what I need to put in the "interface ="  line for the 1w kernel module and i2c, all the examples around here are for the USB 1-wire interface.




Gary

mwall

unread,
Apr 20, 2014, 11:15:17 AM4/20/14
to weewx...@googlegroups.com
gary,

the owfs.py and owfss.py extensions to weewx both use the python bindings to owfs.  the one-wire interface is specified in the ow.init() method.  the perl bindings explicitly enumerate the following interfaces:

u - usb
/dev/ttySx - serial
port | host:port

however, the owfs man pages indicate support for many device types - usb, serial, i2c, network, w1 kernel

perhaps something like this would work with the i2c interface:

interface = /dev/i2c-0

you might have to dig into the python bindings for ow.init to find out exactly what ow methods are invoked.

m

Gary Lake

unread,
Apr 22, 2014, 7:55:32 AM4/22/14
to weewx...@googlegroups.com
Thanks for that, so far I have found this list of options:

# Sources
device = /dev/ttyS0 # serial port: DS9097U DS9097 ECLO or LINK
device = /dev/i2c-0 # i2c port: DS2482-100 or DS2482-800
usb # USB device: DS9490 PuceBaboon
usb = 2 # Second DS9490
usb = all # All DS9490s
altUSB # Willy Robison’s tweaks
LINK = /dev/ttyS0 # serial LINK in ascii mode
LINK = [address:]port # LINK-HUB-E (tcp access)
HA7 # HA7Net autodiscovery mode
HA7 = address[:port] # HA7Net at tcp address (port 80)
etherweather = address[:port] # Etherweather device
server = [address:]port # owserver tcp address
FAKE = 10,1B # Random simulated device with family codes (hex)
TESTER = 28,3E # Predictable simulated device with family codes

I have made a DS9097 serial adapter that should confirm that my system is configured correctly but will have to wait to the weekend to try a few different settings for i2c.

So far I have found no info on using the w1 kernel module.



Gary

Gary Lake

unread,
May 9, 2014, 5:15:49 AM5/9/14
to weewx...@googlegroups.com

What I have done since last time.

The passive DS9097 serial adapter I made works OK on a real serial port but won't work with USB to serial converter so no good on the Pi. I have managed to get hold of a couple of original Dallas serial adapters, a DS9097U-9 and a DS1411 and have made a DS2482S-100 based i2c adapter to do some further testing and this has conformed that OWFS is installed and working but I still can't get Weewx to read any data from my sensors.

If I manually configure OWFS and create a mount point for the data I can read it but if I try the same config from the OWFS driver it seems to recognise the interface as valid but I get an error when it tries to read the sensor data.

Here is what I get from the serial and i2c adapters with a DS18S20 attached, I'm using 'onewireident.py' from the 'onwwireweewx' package to test the sensors while weewx is not running. This shows that OWFS is working and can see the adapter and sensors:

**********
DS9097U-9 serial 1-wire adapter

sudo /usr/bin/owfs -C --allow_other - /dev/ttyUSB0 -m /mnt/1wire

sudo python //home/pi/1wireweewx/onewireident.py /dev/ttyUSB0

Main Adapter - DS9097U
Unknown Sensor DS18S20 - 10.F8B36C010800
Unknown Sensor DS2502 - 09.634C99010000
**********

DIY I2C adapter with DS2482S-100 connected to GPIO 3 & 5

sudo /usr/bin/owfs -C --allow_other - /dev/i2c-1 -m /mnt/1wire

sudo python //home/pi/1wireweewx/onewireident.py /dev/i2c-1

Main Adapter - DS2482-100
Unknown Sensor DS18S20 - 10.E8DF6C010800
***********

Some reading of the OWFS doco has shown that a fuse mount point is required for the onewire data and this is created as a part of the command when running OWFS manually as above.

With an install of the OWFS driver following the wiki instructions does the driver intallation create a the mount point for onewire data ??,

If so, where is it ??

If not, where should I create it so that weewx can access the data??


Gary

mwall

unread,
May 9, 2014, 6:39:03 AM5/9/14
to weewx...@googlegroups.com
On Friday, May 9, 2014 5:15:49 AM UTC-4, Gary Lake wrote:
Some reading of the OWFS doco has shown that a fuse mount point is required for the onewire data and this is created as a part of the command when running OWFS manually as above.

With an install of the OWFS driver following the wiki instructions does the driver intallation create a the mount point for onewire data ??,

If so, where is it ??

If not, where should I create it so that weewx can access the data??

try testing the OWFS driver directly before you use it as a driver in weewx.  first have it enumerate the sensors:

cd /home/weewx
PYTHONPATH=bin python bin/user/owfs.py --sensors

then have it display readings from the sensors:

PYTHONPATH=bin python bin/user/owfs.py --sensors

add the '--iface XXX' option to specify the interface.

you should not have to mount before doing this.

tested on an ubuntu system with a DS9490R and multiple DS18B20 and a hobby-boards lightning detector.

m

Gary Lake

unread,
May 9, 2014, 7:59:09 AM5/9/14
to weewx...@googlegroups.com


On Friday, May 9, 2014 8:39:03 PM UTC+10, mwall wrote:

add the '--iface XXX' option to specify the interface.


This bit helped, I had not seen any reference to additional options for the test commands before.

So the OWFS driver is working as I get this for --sensors:

sudo PYTHONPATH=bin python bin/user/owfs.py --sensors --iface /dev/i2c-1
E8DF6C010800: /10.E8DF6C010800 DS18S20
F8B36C010800: /10.F8B36C010800 DS18S20
242972040000: /28.242972040000 DS18B20
233372040000: /28.233372040000 DS18B20

and this for the first one of --readings

sudo PYTHONPATH=bin python bin/user/owfs.py --readings --iface /dev/i2c-1
E8DF6C010800
_usePath: /10.E8DF6C010800
_type: DS18S20
_path: /10.E8DF6C010800
_useCache: True
  /10.E8DF6C010800/templow:           70
  /10.E8DF6C010800/power: 1
  /10.E8DF6C010800/family: 10
  /10.E8DF6C010800/locator: FFFFFFFFFFFFFFFF
  /10.E8DF6C010800/type: DS18S20
  /10.E8DF6C010800/crc8: 1D
  /10.E8DF6C010800/temphigh:           75
  /10.E8DF6C010800/r_id: 0008016CDFE8
  /10.E8DF6C010800/address: 10E8DF6C0108001D
  /10.E8DF6C010800/errata/: die,trim,trimblanket,trimvalid
  /10.E8DF6C010800/r_address: 1D0008016CDFE810
  /10.E8DF6C010800/r_locator: FFFFFFFFFFFFFFFF
  /10.E8DF6C010800/id: E8DF6C010800
  /10.E8DF6C010800/temperature:      20.8125

So what path do I put in sensor_map section of weewx.conf to get this data ??



Gary



mwall

unread,
May 9, 2014, 9:15:05 AM5/9/14
to weewx...@googlegroups.com
On Friday, May 9, 2014 7:59:09 AM UTC-4, Gary Lake wrote:
So what path do I put in sensor_map section of weewx.conf to get this data ??


assuming that sensor 10.E8DF... is measuring outside temperature, your weewx.conf should have something like this:

[OWFS]
    driver = user.owfs
    interface = /dev/i2c-1
    [[sensor_map]]
        outTemp = /10.E8DF6C010800/temperature

if you prefer to use an uncached value (results in slightly longer sensor read time), then use this:

        outTemp = /uncached/10.E8DF6C010800/temperature

as you can see, each sensor contains quite a bit of information.  however, for the DS18x20 sensors only the temperature field is really useful for data collection.  some other devices include status fields that can be useful in addition to the actual sensor values.

m

Gary Lake

unread,
May 10, 2014, 9:51:52 AM5/10/14
to weewx...@googlegroups.com


Hi Matt,

Thanks for your help, I now have Weewx reading the 3 x DS18B20 sensors on my solar hot water system plus one extra one via my DS2482S-100 I2C adapter. A photo of the prototype adapter that plugs into the Raspberry Pi GPIO interface is attached.

The next task is to modify the simple skin to display what I want.



Gary

Thomas Keffer

unread,
May 10, 2014, 10:05:10 AM5/10/14
to weewx-user
Very nice! Looks like an interesting project!

-tk


--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages