Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: iButton/1-Wire

  1. #1
    Join Date
    Jun 2005
    Beans
    8

    iButton/1-Wire

    I don't know how many people have heard of it, but iButtons are small devices able to take different readings (such as temperature and humidity). My research lab is hoping to get some of these to monitor our linux cluster room (so our 40-some computers don't overheat).

    I was just wondernig if anyone has come across software to allow linux (ubuntu, specifically) to work with iButtons. It's unfortunate the ibutton kits that are sold are only intended for PCs.


    Thanks for any help.



    (Ubuntu = best linux community)

  2. #2
    Join Date
    Jan 2005
    Location
    Baltimore, MD, USA
    Beans
    865
    Distro
    Ubuntu Development Release

    Re: iButton/1-Wire

    Knowledge is half the battle.
    The other half is violence!

  3. #3
    Join Date
    Jun 2005
    Beans
    8

    Re: iButton/1-Wire

    Thanks. I'll b giving this a try.

  4. #4
    Join Date
    Jan 2006
    Location
    Berkeley
    Beans
    458
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: iButton/1-Wire

    I'd be interested in hearing if anybody has gotten these to work under Linux. I'm struggling with mine despite the fact that it's ridiculously old tech, and ought to work without any issues whatsoever.

    Any help?

  5. #5
    Join Date
    Mar 2007
    Beans
    Hidden!

    Lightbulb Re: iButton/1-Wire

    I've used these babies for research starting about a year ago.
    Maxim has a good deal of software (they have a public domain kit).

    The drivers are in the kernel as I recall. I was able to get real time readings but have not been able to read the log or reconfigure the devices. I ended up reading my iButtons through a windows virtual machine, using the java reader.

    Update:
    I just checked the public domain kit. It's a new version as precompiled binaries and/or source code. It may be worth your time to check em out.
    Last edited by spike the jackal; September 4th, 2009 at 06:38 AM.

  6. #6
    Join Date
    Dec 2009
    Beans
    0

    Re: iButton/1-Wire

    You can use the Java OneWireViewer, but it expects librxtx-java support to be installed and will only work with the DS9097U Serial to One-Wire bridge.

    I've got the DS9490R USB to One-Wire bridge to work under OWFS, it seems to expose all the iButton stuff pretty well, but this is kind of a clunky way to do things. After writing some extensive scripting, you might be able to set a thermochron up, save a mission and then retrieve data. Which is all straight forward using the Java interface...

  7. #7
    Join Date
    May 2008
    Beans
    13

    Re: iButton/1-Wire

    If there are any news on this I would be VERY interested.

    I have the DS9490B adapter and installed the librxtx-java package from respositories. However, using the maxim 1-wire java app it says, it is looking for the DS9097U.

    Am I right, that the problem is within the rxtx, which doesn't support usb?

  8. #8
    Join Date
    Apr 2008
    Beans
    16
    Distro
    Ubuntu Development Release

    Re: iButton/1-Wire

    Sounds like it. I'd be really interested if we can get this working on linux. (I'm Spike the Jackal)

  9. #9
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    369
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: iButton/1-Wire

    I have just started playing with an ibutton (a DS1921G) and a DS9490 running kernel 2.6.31-22-generic.
    I am running owfs with some python scripts. At the moment I am just able to get the current temperature and it all has to be using sudo so there is some way to go. It's my first time with fuse which owfs uses and I need to figure out why I have to use sudo for every command. The code I have so far is

    Code:
    sudo /opt/owfs/bin/owfs -F -u -m /home/norman/1-wire
    which sets up the fuse file access to the ibutton

    Code:
    #! /usr/bin/env python
    
    # $Id: one_wire_sensors.py 23 2004-07-22 04:35:36Z peter $
    #
    # need to check for /1-wire mounted but Vendor=04fa is not
    # in the usb usb devices file. this can occur when the usb
    # dongle is no longer connected.
    #
    # check that /1-wire is mounted
    # if not, check that Vendor=04fa is in the usb devices file.
    # if it is, then kick /etc/init.d/owfs to start up again
    # if not, then ?
    
    
    import os
    import syslog
    import csv
    import time
    ##import util
    
    
    Debug           = True
    OWUSBVendor     = '04fa'
    USBDevices      = '/home/norman/1-wire/21.B5fb22000000/temperature'
    MountFile       = '/proc/mounts'
    OWUSBMount      = '/home/norman/1-wire/21.B5fb22000000/temperature'
    MountCommand    = '/etc/init.d/owfs.init start'
    UnmountCommand  = '/etc/init.d/owfs.init stop'
    SensorLogName   = 'sensor.log'
    Sensors         = {
        'Temperature1' : os.path.join( OWUSBMount, '10.B7B64D000800' ),
        'Temperature2' : os.path.join( OWUSBMount, '10.54BA4D000800' ),
        #'Humidity1'   : os.path.join( OWUSBMount, '12.386623000000' ),
        #'Humidity2'   : os.path.join( OWUSBMount, '12.3B6F23000000' ),
       }
    Messages        = {
        'MountedNoPresence' :
        '1-wire mounted but no usb presence, unmounting 1-wire',
    
        'UnmountedPresence' :
        '1-wire not mounted but usb presence, mounting 1-wire',
    
        'UnmountedNoPresence' :
        '1-wire not mounted and no usb presence, nothing can be done',
    
        'MountedNoSensors' :
        '1-wire mounted and usb presense but no sensors, remounting 1-wire',
        }
    
    
    def log_message( message ):
        if Debug:
            print message
        syslog.syslog( syslog.LOG_DAEMON|syslog.LOG_WARNING, message )
    
    
    def check_mount( mount_point ):
        known_mounts = open( MountFile, 'r' ).readlines()
        for mount in known_mounts:
            if mount_point in mount:
                return True
        return False
    
    
    def check_usb_vendor( vendor ):
        usb_lines = open( USBDevices, 'r' ).readlines( )
        vendor = 'Vendor=' + vendor
        for line in usb_lines:
            if vendor in line:
                return True
        return False
    
    
    def check_sensors( ):
        for sensor in Sensors:
            if not os.path.isdir( Sensors[ sensor ] ):
                return False
        return True
    
    
    def read_temperature( ):
        path = os.path.join( Sensors[ 'Temperature1' ], 'temperature' )
        temperature1 = open( path, 'r' ).readlines( )
        path = os.path.join( Sensors[ 'Temperature1' ], 'temperature' )
        temperature2 = open( path, 'r' ).readlines( )
        return ( float( temperature1[ 0 ] ), float( temperature2[ 0 ] ) )
    
    
    def log_sensors( ):
        current_time = time.time( )
        path = util.log_path( '', SensorLogName )
        temperature1, temperature2 = read_temperature( )
        writer = csv.writer( file( path, 'a' ) )
        writer.writerow( ( current_time, temperature1, temperature2 ) )
    
    
    def one_wire( ):
        mounted      = check_mount( OWUSBMount )
        usb_presence = check_usb_vendor( OWUSBVendor )
        sensors      = check_sensors( )
    
    ##    if mounted:
    ##        if not usb_presence:
    ##            log_message( Messages[ 'MountedNoPresence' ] )
    ##            os.system( UnmountCommand )
    ##        elif not sensors:
    ##            log_message( Messages[ 'MountedNoSensors' ] )
    ##            os.system( UnmountCommand )
    ##           os.system( MountCommand )
    ##        elif Debug:
    ##            print 'all is right with the world'
    ##    elif usb_presence:
    ##        log_message( Messages[ 'UnmountedPresence' ] )
    ##        os.system( MountCommand )
    ##    else:
    ##        log_message( Messages[ 'UnmountedNoPresence' ] )
    
    
    if __name__ == '__main__':
        one_wire( )
        if check_mount( OWUSBMount ):
            log_sensors( )
    This is code I found here: http://www.pyzine.com/Issue007/Secti...ollection.html

    I saved it as readbutton.py and run it with sudo again.
    All the lines with ## at the beginning are lines I had to comment out so it would run. Mainly because I had access errors otherwise.

    Then
    Code:
    sudo cat 1-wire/21.B5fb22000000/temperature
    to see the current value held in the ibutton.

    Hope this helps and maybe someone can help me get it all working fully. I could not find the util module anywhere nor would it work without sudo. I am a member of the fuse group but all I see for the 1-wire directory is
    d????????? ? ? ? ? ? 1-wire
    Last edited by linuxonbute; August 14th, 2010 at 08:48 PM.

  10. #10
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    369
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: iButton/1-Wire

    Ok

    add the lines :
    user_allow_other
    allow_other

    to /etc/fuse.conf

    also note that:

    Code:
    sudo /opt/owfs/bin/owfs -F -u -m /home/norman/1-wire
    should be :
    Code:
    /opt/owfs/bin/owfs --allow_other -F -u -m /home/norman/1-wire
    then no need for sudo.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •