Get your HBT Growlers, Shirts and Membership before the Rush!


Home Brew Forums > Home Brewing Beer > DIY Projects > Fermenters > Monitoring/controlling with Linux on the cheap
Reply
 
LinkBack Thread Tools
Old 04-25-2011, 08:35 PM   #21
Homercidal
Moderator
HBT_MODERATOR.png
Feedback Score: 0 reviews
 
Homercidal's Avatar
Recipes 
 
Join Date: Feb 2008
Location: Reed City, MI
Posts: 24,438
Liked 2450 Times on 1726 Posts
Likes Given: 1404

Default

Well, to be fair, that is not an installation guide as much as a quick reference. I'm sure I can make sense of it after a bit of studying. I did the dmesg thing a few times, but it's messy and I can't seem to find anything about the 1-wire device. I better check when I get home to see that I even plugged it in. I did use the dmesg to mount the USB stick to install owfs.

I just think it's "odd" that there is a link to the INSTALL page and here is what it says:

Installing OWFS can be the hardest part of the whole process. Once you get it working, you'll be amazed at how robust and flexible the system can be.

Take heart. Everyone has (eventually) gotten it to work and we have all the tricks gathered here.



Yep, that's the whole INSTALL page! That is from the owfs.org site, not the sourceforge site. I haven't looked through there yet.

__________________
Homercidal is offline
 
Reply With Quote Quick reply to this message
Old 04-25-2011, 08:42 PM   #22
Yuri_Rage
Gritty.
HBT_MODERATOR.png
Feedback Score: 0 reviews
 
Yuri_Rage's Avatar
Recipes 
 
Join Date: Jul 2006
Location: Southwest
Posts: 14,001
Liked 636 Times on 399 Posts
Likes Given: 58

Default

Way cool. Looks like I have a new way to waste some time.

__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc
Yuri_Rage is offline
 
Reply With Quote Quick reply to this message
Old 04-25-2011, 08:51 PM   #23
GatorDad
Feedback Score: 0 reviews
Recipes 
 
Join Date: Mar 2011
Location: Brandon, Florida
Posts: 234
Liked 5 Times on 4 Posts
Likes Given: 20

Default

I completely agree with you. This is why I wrote the topic up - it gave me fits installing and I've been doing this 30+ years (linux since 94). Getting owfs up and running can be a challenge, but as the docs say, once you're over that hurdle, it's really easy after that.

Being new here, what's the rules about editing a previous post? Should I edit my first post to include these usb parms? It might save someone a lot of heartache... eh?


Quote:
Originally Posted by Homercidal View Post
Well, to be fair, that is not an installation guide as much as a quick reference. I'm sure I can make sense of it after a bit of studying. I did the dmesg thing a few times, but it's messy and I can't seem to find anything about the 1-wire device. I better check when I get home to see that I even plugged it in. I did use the dmesg to mount the USB stick to install owfs.

I just think it's "odd" that there is a link to the INSTALL page and here is what it says:

Installing OWFS can be the hardest part of the whole process. Once you get it working, you'll be amazed at how robust and flexible the system can be.

Take heart. Everyone has (eventually) gotten it to work and we have all the tricks gathered here.



Yep, that's the whole INSTALL page! That is from the owfs.org site, not the sourceforge site. I haven't looked through there yet.
GatorDad is offline
 
Reply With Quote Quick reply to this message
Old 04-26-2011, 01:41 AM   #24
Homercidal
Moderator
HBT_MODERATOR.png
Feedback Score: 0 reviews
 
Homercidal's Avatar
Recipes 
 
Join Date: Feb 2008
Location: Reed City, MI
Posts: 24,438
Liked 2450 Times on 1726 Posts
Likes Given: 1404

Default

It's fine now AFAIC. I found that i had not plugged the adapter in before I left for work, so that is way my dmesg wasn't showing anything. I'm sitting with the wife as she watches DWTS, so hopefully I can concentrate on what i need to do.

__________________
Homercidal is offline
 
Reply With Quote Quick reply to this message
Old 04-28-2011, 03:29 PM   #25
GatorDad
Feedback Score: 0 reviews
Recipes 
 
Join Date: Mar 2011
Location: Brandon, Florida
Posts: 234
Liked 5 Times on 4 Posts
Likes Given: 20

Default

A few PHP classes I'm using that may be useful to someone else out there.

I've named this file "ow.php".

Code:
<?php
//
//  Copyright 2011, Chris Curran
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
//


//
// 1-wire base class
//
class OneWireT {
    public $devName;        //the device name
    public $devMode;        //the device mode (r, w, rw)

    private $fp;            //file pointer


    public function __construct($name, $mode) {
        $this->devName = $name;
        $this->devMode = $mode;

        $this->fp = @fopen($name,$mode);
    }

    protected function read() {
        rewind($this->fp);
        return trim(@fread($this->fp,1024));
    }

    protected function write($data) {
        rewind($this->fp);
        return @fwrite($this->fp, $data, strlen($data));
    }
}


//
// 1-wire base reader class
//
class OneWireReaderT extends OneWireT {

    public function __construct($name) {
        parent::__construct($name,"r");
    }

    public function read() {
        return parent::read();
    }
}


//
// 1-wire base writer class
//
class OneWireWriterT extends OneWireT {

    public function __construct($name) {
        parent::__construct($name,"w");
    }

    public function write($data) {
        return parent::write($data);
    }
}

//
// 1-wire base reader/writer class
//
class OneWireReadWriteT extends OneWireT {

    public function __construct($name) {
        parent::__construct($name,"r+");
    }

    public function read() {
        return parent::read();
    }

    public function write($data) {
        return parent::write($data);
    }
}


//
// 1-wire class to handle switches
//
class OneWireSwitchT extends OneWireReadWriteT {
    private $state = 0;

    public function __construct($name) {
        parent::__construct($name);
        $this->state = $this->read();
    }

    public function on() {
        $this->state = 1;
        return $this->write("1");
    }

    public function off() {
        $this->state = 0;
        return $this->write("0");
    }

    public function getState() {
        return $this->state;
    }

}



//
//
// 1-wire class to the DS18x20 temperature sensors
//
//
class OneWire1820 extends OneWireReaderT {

    public function __construct($name) {
        parent::__construct("$name/temperature");
    }

}



//
//
// 1-wire class to the DS2406 switch (port A)
//
//
class OneWire2406a extends OneWireSwitchT {

    public function __construct($name) {
        parent::__construct("$name/PIO.A");
    }

}

//
//
// 1-wire class to the DS2406 switch (port B)
//
// Note: the TO-92 packaging of the DS2406 does not have a "B" port.
//
class OneWire2406b extends OneWireSwitchT {

    public function __construct($name) {
        parent::__construct("$name/PIO.B");
    }

}

?>

A sample program:
Code:
<?php

    require_once("ow.php");

    //
    // if running from cmd line, use "\n" for newlines.
    // if running from browser, use "<br>" for newlines.
    //
    $nl = ( isset($_SERVER['SERVER_ADDR']) ) ? "<br>":"\n";


    //
    // create an instance to our temperature sensor
    //
    $tempObj = new OneWire1820("/mnt/fermiTemp");

    // display the temperature
    echo $tempObj->read(), $nl;


    //
    // create an instance to our switch
    //
    $switchObj = new OneWire2406a("/mnt/fermiSwitch");

    //
    // turn it on, wait one second, then turn it off
    //
    echo "turning switch on$nl";
    $switchObj->on();
    sleep(1);
    echo "turning switch off$nl";
    $switchObj->off();
    echo "$nl";

?>
GatorDad is offline
 
Reply With Quote Quick reply to this message
Old 05-04-2011, 08:04 PM   #26
Homercidal
Moderator
HBT_MODERATOR.png
Feedback Score: 0 reviews
 
Homercidal's Avatar
Recipes 
 
Join Date: Feb 2008
Location: Reed City, MI
Posts: 24,438
Liked 2450 Times on 1726 Posts
Likes Given: 1404

Default

Quote:
Originally Posted by twigboy2000 View Post
You may be able to find things like FUSE in your distro's package repositories. I'd highly recommend only compiling from source if it's not in the repos (or pre-packaged in 3rd party repos) or if you need a very specific dev version.

The package managers are your friend!

-chuck
Even though FUSE was noted as INSTALLED after I loaded Slackware, I could not get this to work. I eventually found time to install a newer version and the install process got it working. I am literate enough in linux to get things working, but smart enough in it to get something installed to actually RUN like it's supposed to.

Now am working on understanding the symlinks better. But I can get a readout from the adapter and sensor, so I'm most of the way there. Only have to remember how to program scripts.
__________________
Homercidal is offline
 
Reply With Quote Quick reply to this message
Old 05-04-2011, 08:32 PM   #27
GatorDad
Feedback Score: 0 reviews
Recipes 
 
Join Date: Mar 2011
Location: Brandon, Florida
Posts: 234
Liked 5 Times on 4 Posts
Likes Given: 20

Default

Over-simplifying, "symlinks" are to unix based systems as "shortcuts" are to Windows.

To create a symbolic link (symlink), use the command line tool "ln" as such:

Code:
#ln -s <real_name> <symbolic_name>
For example, if your temp sensor was "/mnt/1wire/10.26CC4F000800" and you wanted to create a symlink so you could refer to it as "/mnt/tempSensor1":

Code:
 ln -s /mnt/1wire/10.26CC4F000800 /mnt/tempSensor1
__________________

cheers & beers,
Chris

Monitor/control with Linux
You know your IPA - do you know your PSA?

GatorDad is offline
 
Reply With Quote Quick reply to this message
Old 05-05-2011, 01:19 PM   #28
GatorDad
Feedback Score: 0 reviews
Recipes 
 
Join Date: Mar 2011
Location: Brandon, Florida
Posts: 234
Liked 5 Times on 4 Posts
Likes Given: 20

Default

Quote:
Originally Posted by Homercidal View Post
Only have to remember how to program scripts.
BTW, you don't HAVE to use bash scripts. Any language (scripting or otherwise) that can interact with the file system (open, read, write & close files) can be used. The above PHP code for example. That can be run from the command line - or from cron. PHP isn't for web servers *only* - it's a damn useful utility language too.
__________________

cheers & beers,
Chris

Monitor/control with Linux
You know your IPA - do you know your PSA?

GatorDad is offline
 
Reply With Quote Quick reply to this message
Old 05-05-2011, 02:14 PM   #29
Gfei
Feedback Score: 0 reviews
Recipes 
 
Join Date: Aug 2009
Location: Richmond VA
Posts: 249
Liked 1 Times on 1 Posts
Likes Given: 3

Default

Awesome writeup, thanks for posting this. I see some more linux tinkering in my future.

__________________

Chris
Damn Yankee Brewing

|Bar Build|

Gfei is offline
 
Reply With Quote Quick reply to this message
Old 05-05-2011, 03:02 PM   #30
Homercidal
Moderator
HBT_MODERATOR.png
Feedback Score: 0 reviews
 
Homercidal's Avatar
Recipes 
 
Join Date: Feb 2008
Location: Reed City, MI
Posts: 24,438
Liked 2450 Times on 1726 Posts
Likes Given: 1404

Default

Quote:
Originally Posted by GatorDad View Post
Over-simplifying, "symlinks" are to unix based systems as "shortcuts" are to Windows.

To create a symbolic link (symlink), use the command line tool "ln" as such:

Code:
#ln -s <real_name> <symbolic_name>
For example, if your temp sensor was "/mnt/1wire/10.26CC4F000800" and you wanted to create a symlink so you could refer to it as "/mnt/tempSensor1":

Code:
 ln -s /mnt/1wire/10.26CC4F000800 /mnt/tempSensor1
Yeah it seems simple until I try it! Here is what went wrong:

I always start up my linux with the alias command so that I get the directory listing the way I want:

alias ddir='ls -a -l --color |more'

Works great except that when viewing certain directories from another location, nothing is returned. It makes it seem as though the directory is empty. I worked through the entire command until I hit the |more. Then it screwed up.

So I took that out of the command, deciding that I can simply add |more whenever I really needed it (which honestly is not that often).


Hopefully I will have time to play with this more today. I don't mind Bash scripts. I think that is what I used to use a lot of in college. But PHP would be a more useful language to learn.
__________________
Homercidal is offline
 
Reply With Quote Quick reply to this message
Reply



Quick Reply
Message:
Options
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temperature Monitoring and Control with Arduino erock2112 Fermenters 85 04-05-2011 08:46 PM
Controlling Wort Flow capnr0n Brew Stands 12 03-16-2010 05:00 AM
Temperature Controlled Brewcloset with remote monitoring Mista_Sparkle Fermenters 1 11-26-2009 08:53 AM
Monitoring temp on the cheap... tireater Brew Stands 20 04-15-2009 08:06 PM
Basic ambient temperature monitoring jasper9 Fermenters 8 01-01-2009 12:19 AM



Newest Threads

LATEST SPONSOR DEALS