Page 1 of 15 12311 ... LastLast
Results 1 to 10 of 149

Thread: Dallas Semiconductor one-wire plugin

  1. #1
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default Dallas Semiconductor one-wire plugin

    Via a link in my sig, you can get a girder 4 plugin to
    * get temperatures from one-wire DS1820 devices.
    * get temperatures from one-wire DS1920 devices.
    * read/write I/O pins on the DS2405
    * read/write I/O pins on the DS2406
    * read/write I/O pins on the DS2408
    * read counter values from DS2423
    * read/write wiper position from digital potentiometer DS2890
    * read 4 channel Voltages from A/D converter DS2450
    * read temperature,voltage,current from DS2438
    * support ds2409 based hub


    The plugin implements these lua functions :

    OneWire.GetTemperatures (returns all temps for all DS1820's/DS1920's)
    OneWire.GetTemperature (return temp for ONE DS1820/DS1920)
    OneWire.GetSwitches (return status for all DS2405's/DS2406's and optionally clear activity latch for DS2406)
    OneWire.GetSwitch (return status for ONE DS2405/DS2406 and optionally clear activity latch for DS2406)
    OneWire.SetSwitch (set output ports for ONE DS2405/DS2406, returncode 1=success)
    OneWire.GetCounters(return counter A,B value for all DS2423's)
    OneWire.GetCounter(return counter A,B value for ONE DS2423)
    OneWire.GetPots(returns wiper pos.+control byte for all DS2890's)
    OneWire.GetPot(returns wiper pos.+control byte for ONE DS2890)
    OneWire.SetPot(set wiper position)
    OneWire.SetPotControl(set control byte)
    OneWire.GetAtoDs(get Voltages for all DS2450's)
    OneWire.GetAtoD(get Voltages for ONE DS2450's)
    OneWire.Set2408Config(set configuration byte for ONE DS2408, returncode 1=success)
    OneWire.Set2408Output(set output port for ONE DS2408, returncode 1=success)
    OneWire.Set2408String(send string to output port for ONE DS2408, returncode 1=success);
    OneWire.Get2408Inputs(return input status for all DS2408's and optionally clear activity latch)
    OneWire.Get2408Input(return input status for one DS2408 and optionally clear activity latch)
    OneWire.Get2438s(return temperature,voltage,current for all DS2438's)
    OneWire.Get2438(return temperature,voltage,current for ONE DS2438's)
    OneWire.DeviceList(display all found one-wire devices)

    You use it like this :

    Code:
    print ("---devices-------------------------------------------");
    local devices = OneWire.DeviceList()
    table.print(devices)
    print ("---devices-------------------------------------------");
    for _,device in ipairs(devices) do 
      print ("device : "..device.name..", address : "..device.address);
    end
    print ("---2450-------------------------------------------");
    table.print(OneWire.GetAtoDs())
    print ("---2450-------------------------------------------");
    local A,B,C,D = OneWire.GetAtoD("6000000006B77020")
    print("input_A "..A);
    print("input_B "..B);
    print("input_C "..C);
    print("input_D "..D);
    print ("---2423-------------------------------------------");
    table.print(OneWire.GetCounters())
    print ("---2423-------------------------------------------");
    local A,B = OneWire.GetCounter("AF000000076D281D")
    print("input_A "..A);
    print("input_B "..B);
    print ("---2890-------------------------------------------");
    table.print(OneWire.GetPots())
    print ("---2890-------------------------------------------");
    -- CHARGE_PUMP_OFF 0x0C = 12 = 00001100 = power up state
    -- CHARGE_PUMP_ON  0x4C = 76 = 01001100
    print(OneWire.SetPotControl("5600000008E4D82C",76));
    print ("---2890-------------------------------------------");
    print(OneWire.SetPot("5600000008E4D82C",25));
    print ("---2890-------------------------------------------");
    local position,control = OneWire.GetPot("5600000008E4D82C")
    print("position "..position);
    print("control "..control);
    print ("---1820-------------------------------------------");
    table.print(OneWire.GetTemperatures())
    print ("---1820-------------------------------------------");
    print("temperature "..OneWire.GetTemperature("2A000800551D0210"));
    print ("---2406-------------------------------------------");
    table.print(OneWire.GetSwitches(false))
    print ("---2406-------------------------------------------");
    --print(OneWire.SetSwitch("040000001617F512",127)); power up state, needed for inputs
    table.print(OneWire.GetSwitch("040000001617F512",false));
    print ("---2406-------------------------------------------");
    -- 31    00011111  A on  B on
    -- 127   01111111  A off B off
    -- 63    00111111  A off B on
    -- 95    01011111  A on  B off
    print(OneWire.SetSwitch("0100000015E70612",31));
     
    print ("---2408-------------------------------------------");
    print(OneWire.Set2408Config("49000000014DDF29",4));
    print ("---2408-------------------------------------------");
    --0 -> 0v
    --1 -> 5v (use when input is required)
    print(OneWire.Set2408Output("49000000014DDF29",255));
    print ("---2408-------------------------------------------");
    table.print(OneWire.Get2408Inputs(true))
    print ("---2408-------------------------------------------");
    --0v -> 1
    --5v -> 0
    -- Activity latch = 0 -> tripped
    table.print(OneWire.Get2408Input("49000000014DDF29",true));
     
    print ("---2408-------------------------------------------");
    -- string can contain binary data including 0.
    print (OneWire.Set2408String("49000000014DDF29","testing"));
     
    print ("---2438-------------------------------------------");
    table.print(OneWire.Get2438s())
    print ("---2438-------------------------------------------");
    local temp,volt,current = OneWire.Get2438("51000000A8C20F26")
    print("temperature "..temp);
    print("voltage "..volt);
    print("current "..current);
    (see further in this thread for an example of connecting an LCD display via DS2408 )
    (see further in this thread for an example how to read humidity/pressure via DS2438 )


    the output is something like

    Code:
    ---devices-------------------------------------------
    {
        [1] = {
            ["name"] = "DS2408",
            ["address"] = "49000000014DDF29",
            ["description"] = "1-Wire 8-Channel Addressable Switch",
            ["alternatenames"] = "8-Channel Addressable Switch",
        },
    ....
    ...
    ---devices-------------------------------------------
    device : DS2408, address : 49000000014DDF29
    device : DS2409, address : 1500000004FADC1F
    ...
    ....
    ---2450-------------------------------------------
    {
        [1] = {
            ["input_D"] = 0.47336658835411,
            ["input_B"] = 0.36445868015289,
            ["address"] = "6000000006B77020",
            ["input_C"] = 5.0793743133545,
            ["input_A"] = 0.056953992694616,
        },
    ...
    ...
    }
    ---2450-------------------------------------------
    input_A 0.05882902443409
    input_B 0.34461462497711
    input_C 5.0796871185303
    input_D 0.44352239370346
    ---2423-------------------------------------------
    {
        [1] = {
            ["input_B"] = 0,
            ["input_A"] = 0,
            ["address"] = "AF000000076D281D",
        },
    }
    ---2423-------------------------------------------
    input_A 0
    input_B 0
    ---2890-------------------------------------------
    {
        [1] = {
            ["control"] = 76,
            ["position"] = 25,
            ["address"] = "5600000008E4D82C",
        },
    }
    ---2890-------------------------------------------
    1
    ---2890-------------------------------------------
    1
    ---2890-------------------------------------------
    position 25
    control 76
    ---1820-------------------------------------------
    {
        [1] = {
            ["temperature"] = 24.25,
            ["address"] = "2A000800551D0210",
        },
        [2] = {
            ["temperature"] = 24.4375,
            ["address"] = "AD000000BB71AD28",
        },
    ...
    ...
    }
    ---1820-------------------------------------------
    temperature 24.25
    ---2406-------------------------------------------
    {
        [1] = {
            ["activitylatch_A"] = 1,
            ["sensedlevel_A"] = 0,
            ["address"] = "0100000015E70612",
            ["flipflop_B"] = 1,
            ["activitylatch_B"] = 1,
            ["sensedlevel_B"] = 0,
            ["flipflop_A"] = 1,
        },
    ...
    ...
    }
    ---2406-------------------------------------------
    {
        ["activitylatch_A"] = 0,
        ["sensedlevel_A"] = 1,
        ["flipflop_A"] = 0,
        ["activitylatch_B"] = 0,
        ["flipflop_B"] = 0,
        ["sensedlevel_B"] = 1,
    }
    ---2406-------------------------------------------
    1
    ---2408-------------------------------------------
    1
    ---2408-------------------------------------------
    1
    ---2408-------------------------------------------
    {
        [1] = {
            ["inputs"] = 255,
            ["activitylatch"] = 159,
            ["address"] = "49000000014DDF29",
        },
    }
    ---2408-------------------------------------------
    {
        ["inputs"] = 255,
        ["activitylatch"] = 0,
    }
    ---2408-------------------------------------------
    1
    ---2438-------------------------------------------
    {
        [1] = {
            ["temperature"] = 32.25,
            ["address"] = "2B000000AEDA3B26",
            ["current"] = 9,
            ["voltage"] = 5.75,
        },
    ...
    ...
    }
    ---2438 humidity-------------------------------------------
    temperature 10
    voltage 2.8099999427795
    current 0
    note that getting one-wire temps is slow (1 second per device) so it would be best to call this function from a thread (see Mike's weather or my RSS feed for an example about threads)...

    the I/O stuff and device list is fast...

    the 4.02beta driver from here doesn't seem to work propely (at least on my vista pc, ibfs32.dll is not installed)
    http://www.maxim-ic.com/products/ibu...tmex/index.cfm

    this older version works ok for me

    http://files.dalsemi.com/auto_id/lic...ivers_v400.msi


    The plugin supports a hub based on DS2409's, as long as all the DS2409's are at the top level of the network.

    Adding/Removing DS2409's after girder has started, requires a restart of the plugin.

    Moving devices from one DS2409 channel to another, is no problem. The plugin handles this situation automatically, without a communication error.

    (the plugin is tested with the 6 channel master hub from http://hobby-boards.com)


    Marcel
    Last edited by mhwlng; February 13th, 2009 at 03:52 AM.

  2. #2
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    :lol: see my post, here as well!

    http://www.promixis.com/phpBB2/viewt...=130333#130333

    what a coincidence!
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  3. #3
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    What do you use to interface to the 1-wire devices?
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  4. #4
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    this plugin only works with the DS pc adapters (uses TMEX API)

    I only have the DS9097U serial adapter. But, in theory , it should work with the USB version as well ???

    Also, currently this plugin only supports the 1820/1920 temperatures.

    I have some ds2406 switches (SMD unfortunately). I'll play with them over the weekend to see if I can add support for those as well...


    Marcel

  5. #5
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    How many sensors and how much cable can you have on those devices?
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  6. #6
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    I have no idea.....

    you need to go to the dalsemi website and look it up....

    I have 1 meter telephone cable and 2 1820 devices on my workbench
    So not much of a home automation network...

    I use parasitic power (so two wires).

    If you make a big network, you should have a separate 5V supply (so 3 wires) and use decent cat5 or telephone wire.


    Marcel

  7. #7
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    yeah, I had a look on the Dallas Semi website.

    The datasheet for the DS9097, does not give you much info. I did see a post on Hoomseers msg board thou, saying a chap has 13 sensors around his house with no issues.

    this page would be of interest for anyone else looking

    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2982
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  8. #8
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    have you seen this document ?

    Guidelines for Reliable 1-Wire Networks

    http://www.maxim-ic.com/appnotes.cfm/appnote_number/148


    Marcel

  9. #9
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    yeah, I have not ready it fully yet thou, saw it the other day
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  10. #10
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    Plugin ID = 260.
    Ron
    No support through PM

Page 1 of 15 12311 ... LastLast

Posting Permissions

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