Menu

#34 owfs doesn't find all sensors

v1.0_(example)
open
nobody
None
1
2016-12-14
2016-12-01
Anonymous
No

Hi,
I have a net of 18 DS18B20 tempersture sensors (powered). owfs finds some of the sensors some of the time but not all of the sensors all of the time. One sensor has never been found. The discovery of sensors listed in /mnt/1wire seems to be different at each opening of the directory. The program using the sensors fails because it cannot find all the sensors.
The net is a mix of linear and star wiring. Connections are tested and good.
Any ideas on what might be the cause would be appreciated.
Stephen Coombs

Discussion

  • Jan Kandziora

    Jan Kandziora - 2016-12-01

    Star wiring is bad, you should change it to lobes to avoid problems with signal reflections. Are the sensors powered through the bus cable? If yes, make sure your GND wire is THICK so you don't have too much ground lift at the far end.

    For testing, bypass the cache by reading the /uncached tree.

    In additon, DO NOT USE the owfs fuse binding. That one has concurrency problems when a read happens while the cache expires. Result are broken temperature readouts as "21.5.25" . It's not more than a technical demo. Use owserver and the owshell tools instead.

     
  • Stephen Coombs

    Stephen Coombs - 2016-12-01

    Thank you Jan,
    It may be difficult to change the wiring but I'll see what I can do.
    The cable is a Cat5 4xtwisted pair. I just have 1 core each for Dat, Vcc and Gnd. Dat and Vcc are one twisted pair. Is this ok? Should I double up the Gnd?
    I am new to this so where do I find the /uncached tree and please explain owfs fuse binding. Also I need to study owserver and owshell tools. Any pointers to help?
    Thanks again
    Stephen

     
    • Jan Kandziora

      Jan Kandziora - 2016-12-01

      Yes, double GND. To make a lobe, use e.g.

      host side +5V: brown
      host side GND(1): brown-white
      host side DQ: orange
      host side GND(2): orange-white
      far side +5V: blue
      far side GND(1): blue-white
      far side DQ: green
      far side GND(2): green-white

      and connect host and far side contact at the sensor. And far side of the first lobe cable and host side of the next lobe cable of course. And so on.

      /uncached is a subdirectory from the root of the onewire directory. When you access it, you get uncached access to all chips. That's why it's better for testing.

      When you are acessing the onewire by using standard tools like ls, echo, and cat on /mnt/1wire, you are using the FUSE binding owfs has. But that's only one (poor) method to use owfs. You can also access through the various language bindings and through owdir, owread, owwrite (and owget), which are the owshell tools. They are included in the owfs source distribution as the owserver backend needed by these frontends is. When you are not compiling from source, you may need to install these packages as an extra.

       
  • Stephen Coombs

    Stephen Coombs - 2016-12-01

    Thank you for this Jan it is very helpful and compehensive.
    I will try your suggestions and post how I get on.
    Stephen

     
  • Stephen Coombs

    Stephen Coombs - 2016-12-09

    Hi Jan,
    I managed to change some of the wiring but still don't find all of the sensors all of the time.
    As you recommended I've changed to use owserver with a shell script to read the data and write to a file external to the owfs fuse system. This works except if the script doesn't find a sensor it gives an error message
    ServerRead: Data error on /28.xx.....xx/temperature
    and returns a null value to the appropriate file.
    How can I capture the error such that the value in the file remains at previous figure? This should be possible with an "if" routine in the script but what would the if statement be for the Data error?
    Stephen

     
    • Jan Kandziora

      Jan Kandziora - 2016-12-10

      This shouldn't happen but in a bus systems, sensors may come and go. You can always have failures.

      As you recommended I've changed
      to use owserver with a shell script to read the data and write to a
      file external to the owfs fuse system. This works except if the
      script doesn't find a sensor it gives an error message ServerRead:
      Data error on /28.xx.....xx/temperature and returns a null value to
      the appropriate file. How can I capture the error such that the value
      in the file remains at previous figure? This should be possible with
      an "if" routine in the script but what would the if statement be for
      the Data error?

      SENSORS="28.xx.....xx 28.xx.....xx 28.xx.....xx"
      
      for SENSOR in $SENSORS
      do
          VALUE=$(owread /uncached/$SENSOR/temperature) && echo $VALUE >/tmp/temperatures.$SENSOR
      done
      

      But using files is same as bad as using the owfs-fuse binding. It may be updated during the time you read it, so you are reading garbage. Try to avoid files at all!

       

      Last edit: Jan Kandziora 2016-12-10
  • Stephen Coombs

    Stephen Coombs - 2016-12-14

    Hi Jan,
    I know you're not keen on files but I need to be able to store the values where my Proview plc program can read them but filter out any garbage.
    I've done a script along the lines you suggest but owread doesn't work. I get an error
    ServerRead: Data error on /28.xxx...xx/temperature
    If I run owread in a terminal it works perfectly.
    Any ideas about this.
    I do appreciate your help
    Stephen

     
  • Stephen Coombs

    Stephen Coombs - 2016-12-14

    It's the carriage return between each line in my sensors file.
    Stephen

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.