Monitoring/controlling with Linux on the cheap - Page 4 - Home Brew Forums
Register Now For Free!

Home Brew Forums > Home Brewing Beer > DIY Projects > Fermenters > Monitoring/controlling with Linux on the cheap

Reply
 
Thread Tools
Old 05-05-2011, 02:11 PM   #31
GatorDad
 
GatorDad's Avatar
Recipes 
 
Mar 2011
Brandon, Florida
Posts: 229
Liked 5 Times on 4 Posts


OK, but understand this isn't symlinks. Bash alias handling is a different animal all together. For this alias to work as you desire you're going to need to hack parameter passing to the alias (function, finger, etc).


Quote:
Originally Posted by Homercidal View Post
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.

 
Reply With Quote
Old 05-05-2011, 02:19 PM   #32
Homercidal
Licensed Sensual Massage Therapist.
HBT_MODERATOR.png
 
Homercidal's Avatar
Recipes 
 
Feb 2008
Reed City, MI
Posts: 31,361
Liked 5012 Times on 3383 Posts


Interesting. I'll try that.

 
Reply With Quote
Old 05-16-2011, 01:17 PM   #33
Homercidal
Licensed Sensual Massage Therapist.
HBT_MODERATOR.png
 
Homercidal's Avatar
Recipes 
 
Feb 2008
Reed City, MI
Posts: 31,361
Liked 5012 Times on 3383 Posts


Hey, what would you recommend as a Graphical display to show the temps and switch state, and for adjusting the settings of the temp controller? I'm looking into using PHP as a scripting language.

EDIT: currently looking at PHP-GTK as a way of incorporating the GTK graphical interface within PHP. Looks like the perfect compliment to PHP scripting. I don't know where I'll find time to actually start programming this stuff, but I think this could be a very useful method of setting up a graphical interface for a control panel.

 
Reply With Quote
Old 05-16-2011, 01:48 PM   #34
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,291
Liked 813 Times on 514 Posts


If you're using the Linux machine as a standalone controller, you can develop a simple Python GUI for display and control using Tk or WxPython. If you want to network things, use PHP on the Linux (server side). On the client side, use Ajax and JavaScript to dynamically update a webpage.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 05-16-2011, 01:58 PM   #35
GatorDad
 
GatorDad's Avatar
Recipes 
 
Mar 2011
Brandon, Florida
Posts: 229
Liked 5 Times on 4 Posts


Most of my background is in the "down on bare metal" stuff, so I don't have a lot of experience with GUI libs and what-not. I'm not sure if I'd use PHP (or any server side scripting) to do much eye-candy on the user side (browser). I'd look for a javascript lib that could be used to display your data using some fancy slider/range/toggle widgets. Get the data from a PHP script via ajax (or create the js on the fly with a PHP script).

I have built a number of web apps using the above model (PHP server side, JS client side, access via ajax). I used YUI for those projects, but YUI is probably better suited to "business" type apps rather than utility types - it doesn't have any fancy gui widgets (that I know of) that could be used to display ranges or states so you'd have to roll-your-own, in which case it'd be easier (and probably wiser) to go find something already done and use that instead.

jQuery is also making a lot of noise out there, but I've never used it.

 
Reply With Quote
Old 05-16-2011, 02:07 PM   #36
GatorDad
 
GatorDad's Avatar
Recipes 
 
Mar 2011
Brandon, Florida
Posts: 229
Liked 5 Times on 4 Posts


on second thought... Just use whatever PHP GUI lib you're comfortable with. I often get anal about design and scalability, and none of that is important here. Do what feels good.

 
Reply With Quote
Old 05-16-2011, 02:11 PM   #37
Homercidal
Licensed Sensual Massage Therapist.
HBT_MODERATOR.png
 
Homercidal's Avatar
Recipes 
 
Feb 2008
Reed City, MI
Posts: 31,361
Liked 5012 Times on 3383 Posts


Quote:
Originally Posted by Yuri_Rage View Post
If you're using the Linux machine as a standalone controller, you can develop a simple Python GUI for display and control using Tk or WxPython. If you want to network things, use PHP on the Linux (server side). On the client side, use Ajax and JavaScript to dynamically update a webpage.
I peeked briefly at Python, but it seems rather complicated. Do you have any links to some good beginner information?

 
Reply With Quote
Old 05-16-2011, 02:28 PM   #38
Homercidal
Licensed Sensual Massage Therapist.
HBT_MODERATOR.png
 
Homercidal's Avatar
Recipes 
 
Feb 2008
Reed City, MI
Posts: 31,361
Liked 5012 Times on 3383 Posts


Quote:
Originally Posted by GatorDad View Post
on second thought... Just use whatever PHP GUI lib you're comfortable with. I often get anal about design and scalability, and none of that is important here. Do what feels good.
At this point I have no real opinion. I just need something that will display the sensor information and allow me to adjust the setpoints of a script or program to tweak the controller.

It's been many years since I've done ANY programming, and what I did was some Pascal stuff, and a bunch of COBOL/RPG for business reporting mostly. There was a class on Unix that did some cool scripting, mostly in BASH shell.

I'm really just starting out with Linux, scripting, compiling, etc. Maybe I need to try a little bit of everything suggested in order to know what would be easy and work well.

I really just want a simple graphical interface for the user, and the ability to update a webpage on my Slackware server. I assumed that PHP-GTK would provide both. I think PHP has a method of creating a simple web page and updating on a web server?

I'm also thinking that this could work for monitoring a brewing session, not just as a fermentation monitor system. For a brewing controller, I don't see the need to involve a network. I could pick up a small, cheap LCD monitor or old laptop and build it right into a control panel. Or simply attach said laptop to the brew rig when brewday comes around.

Kind of excited to be working in GUI interface. I've never made a "window" program before that I can remember...

 
Reply With Quote
Old 05-16-2011, 03:22 PM   #39
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,291
Liked 813 Times on 514 Posts


Designing a GUI is a great way to bog down a simple project. At least for now, skip the GUI, and go with some simple scripts. Bash is easy. PHP works just as well.

Write one script that will echo all sensor data and relay states to stdout (a single instantaneous data dump, not a loop).

Write as many other scripts (or one script that takes command line arguments) as you need for control. Make it so that you can type something like this:
Code:
homer heat on
homer pump on
homer heat off
Use the watch command in one terminal window to continuously run your data dump script. Use another terminal window to call your control script(s) from the command line. You could even schedule your scripts to run at particular times using the "at" command.

This solution is easily networked since you can execute an ssh (or other remote login) shell from almost any computer.

Down the road, these scripts can become the basis for a simple GUI.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 05-16-2011, 05:54 PM   #40
GatorDad
 
GatorDad's Avatar
Recipes 
 
Mar 2011
Brandon, Florida
Posts: 229
Liked 5 Times on 4 Posts


Quote:
Originally Posted by Yuri_Rage View Post
Designing a GUI is a great way to bog down a simple project. At least for now, skip the GUI, and go with some simple scripts. Bash is easy. PHP works just as well.
I couldn't agree more.... a better use of time would be to go fishing, or drink beer. Or both.


Quote:
Write one script that will echo all sensor data and relay states to stdout (a single instantaneous data dump, not a loop).
Another option is to write that info to the system log file (from bash):
Code:
logger -t fermilab "$fermilabTemp degrees"
The above line will write a entry to the system log file with a tag of "fermilab". If the temp read (stored in the variable $fermilabTemp) was 68.000 degrees, the entry would read "68.000 degrees". Writing to the log file also provides a "history" of your operating temps.

To view the log file entries, in another terminal window use the "tail" command as such:
Code:
[[email protected] ~]# tail -f /var/log/messages |grep fermilab
May 16 13:22:02 x24 fermilab: 66.7625 degrees
May 16 13:23:02 x24 fermilab: 66.7625 degrees
May 16 13:24:03 x24 fermilab: 66.875 degrees
May 16 13:25:02 x24 fermilab: 66.875 degrees
May 16 13:26:02 x24 fermilab: 66.875 degrees
May 16 13:27:03 x24 fermilab: 66.9875 degrees
May 16 13:28:02 x24 fermilab: 66.9875 degrees
May 16 13:29:02 x24 fermilab: 66.9875 degrees
May 16 13:30:03 x24 fermilab: 66.9875 degrees
May 16 13:31:02 x24 fermilab: 67.1 degrees
May 16 13:32:02 x24 fermilab: 67.1 degrees
This runs the "tail" command in "forever" mode, piping it's output into grep, which will filter out only log file records that have the word "fermilab" in it. The advantage to using "tail" is that it doesn't run continuously (low resource use).

Quote:
You could even schedule your scripts to run at particular times using the "at" command.
Since you're going to want to run the scheduled task more than once, "cron" is a better tool:

http://www.ibm.com/developerworks/li...ing/index.html

I use cron to handle my fermentation fridges. It's a simple script that gets called once every minute. It checks the temps and turns a switch on or off. It writes a few entries to the system log file. That's it. Simple.

Quote:
I'm also thinking that this could work for monitoring a brewing session,
Certainly. I'm working on a HERMS system that will be driven by this project. Damned day job keeps getting in my way though...

Quote:
For a brewing controller, I don't see the need to involve a network. I could pick up a small, cheap LCD monitor or old laptop and build it right into a control panel. Or simply attach said laptop to the brew rig when brewday comes around
Just pick up an old laptop - they're cheaper than dirt these days. I bought a 5 lot of IBM x24's last year off ebay for ~$300.

 
Reply With Quote
Reply
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temperature Monitoring and Control with Arduino erock2112 Fermenters 85 04-05-2011 07:46 PM
Controlling Wort Flow capnr0n Brew Stands 12 03-16-2010 04: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 07:06 PM
Basic ambient temperature monitoring jasper9 Fermenters 8 01-01-2009 12:19 AM


Forum Jump