Monitoring/controlling with Linux on the cheap

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
My order includes:

8 Channel I/O Kit (8 Relay Version)
20x4 LCD with backlight
LCD Driver
1-Wire USB Adaptor

It still says "processing." I hope they ship it soon. I'm going to mount the LCD on the toolbox enclosure to display most of the same data as the webpage. I ordered a handful of DS2438s from Mouser. I need at least one of them to measure the output of the pressure sensor on the steam generator.
 
I just have to try this. My order from Hobby Boards should be here next week. I'm building owfs on a Debian distro as I type this post. If all goes well, my next brew day will be controlled solely by 1-wire devices connected via USB to my NSLU2.

Yuri,

Did you load owfs on your NSLU2 or was it there to start with? What distro are you using?
 
Debian Etch. I built owfs from an svn checkout. The binaries seem like they'll work, but I still don't have the adapter to confirm that it will actually work.
 
You can do both. It would just be poor practice to rely on remote browser input as the sole means for process control. Toggling a mode or changing a value via the browser is fine and perhaps even desirable behavior. It just shouldn't be the primary means by which the rig is managed, and there should be no negative/irrecoverable implications should browser connectivity be lost.

Here's a bash script to generate a simple xml file that is compatible with the browser page above:
Code:
#!/bin/bash

# read all files in a directory
# output their contents to an xml file

# create the xml header and root node
xml="<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
xml=$xml"<!-- Created by update_xml.sh bash script -->\n"
xml=$xml"<brewhut>\n"

# each file becomes a child element with the filename as its tag
files=/mnt/onewire/links/*
for f in $files
  do
    fname="${f##*/}"
    xml=$xml" <"$fname">"`cat $f`"</"$fname">\n"
  done

# close the root node tag
xml=$xml"</brewhut>"

# output the file
echo -e "$xml" > /var/www/xml/brewhut.xml

Here documents can make quoting a lot easier:
Code:
OUTPUT=/var/www/xml/brewhut.xml
cat <<EOF > $OUTPUT
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Created by update_xml.sh bash script -->
<brewhut>
EOF

find /mnt/onewire/links -maxdepth 1 | while read f; do 
    fname="${f##*/}"
    cat <<EOF >> $OUTPUT
<$fname>$(cat $f)</$fname>
EOF
done
cat <<EOF >> $OUTPUT
</brewhut>
EOF

In either case if there are a lot of files in /mnt/onewire/links, or if the names become really long you can overrun built-in limits. A lot of people will avoid this with the "find /foo | while read f ; do" construct.

I think I'm happier with the native library/daemon language bindings. The basic feature I need in python is:
Code:
#!/usr/bin/env python 
import ow
ow.init('/dev/1WIRE') 
ow.opt('F')
for entry in ow.Sensor('/').sensorList():
    if 'temperature' in entry.entryList():
        print "{}: {}".format(entry, entry.temperature)

and get output like this:

Code:
~$ ~/src/read1wire.py
/28.71818C020000 - DS18B20:        83.75


I'm probably not doing control of anything at this point, but this is a pretty comfortable interface for uploading to google app engine and using the create a time series of temperature that should be pretty easy to graph with their chart tools.
 
My Hobby Boards order finally arrived (a couple of weeks after placing it), and I got a chance to do some tinkering today.

I highly recommend the 8 relay board, but pay the extra few bucks to have it preassembled. It has a bunch surface mount components that are somewhat difficult to solder without a reflow setup. I managed, but it took a long time and a lot of patience.

I can't recommend the LCD driver board...at least not yet. I've yet to display anything on the LCD. It lights up and shows a couple of lines of blocks, and it shows up in the file structure, but it is completely unresponsive. It's not a contrast problem - I've adjusted it across the entire range. I'm going to e-mail the company.

I hooked up a DS18S20 and edited a symlink to point to the temperature file. The webpage and update script work exactly as expected. The file's data refresh rate is about once per 10 seconds. I made a short test script to toggle a relay based on temperature, and it works well.

I learned a bit more about how to use owfs along the way. Unless you're using the owshell commands to interact with the file structure or using direct TCP connections, there is no need to run owserver. I'm invoking owfs with this single command:
Code:
sudo /opt/owfs/bin/owfs -F -u --allow_other /mnt/onewire
The -u option is for the USB dongle. If there is a reason to unmount the file structure, umount works just as you'd expect.

For grins, I set up a cron job to log the ambient temp in the brew hut every 15 minutes (that's about the only thing I can do with the rig in its present state - the relays are connected to nothing, and I haven't made thermowells yet). We're having record temps this week, and I'm curious as to how well the A/C is keeping up.
 
The results of my datalogging over the last 12 hours:

link.do


Strange that the peak is at 4:30 AM and the big trough occurs during the hottest part of the day. I'm encouraged to see that my cheap window A/C is keeping up, even when we're experiencing record high temps!

The chart is courtesy of www.chartgo.com and some copy/paste.
 
I highly recommend the 8 relay board, but pay the extra few bucks to have it preassembled. It has a bunch surface mount components that are somewhat difficult to solder without a reflow setup. I managed, but it took a long time and a lot of patience.

I remember when you posted your shopping list I thought to myself "this guy must have some mad soldering skills". For $8 I'm letting someone else do it. :)
 
To go along with this thread, it seems like it would be useful to add on an additional thermistor to the 1-wire bus, and use it with a thermowell to get actual fermentation temps as well. Does anyone know what's required of a thermowell to get it to mate with a thermistor? Does the thermistor need to be physically connected (e.g. solder wires to the inside of the thermowell) or something?
 
I've got one half-made. I'm using a DS18S20 and some copper tubing (one end sealed). Solder up the wires to the sensor, drop it in the tubing and then fill with epoxy. I'm at the "fill with epoxy" stage right now (need to go buy some).

Work has been kicking my butt for a few weeks, so my play time has been extremely limited. I hope to finish it this weekend, but Maxwell's Demon is a busy guy these days...
 
I'm using sections of a Corny dip tube welded shut and the same epoxy fill method as Gator.

FWIW, you can't connect a thermistor directly to the 1-wire bus. A DS18S20 works to directly measure temp. You need an analog input device compatible with the 1-wire bus to use a thermistor.
 
I'm using sections of a Corny dip tube welded shut and the same epoxy fill method as Gator.

FWIW, you can't connect a thermistor directly to the 1-wire bus. A DS18S20 works to directly measure temp. You need an analog input device compatible with the 1-wire bus to use a thermistor.

Yes, the DS18S20-type of device is what I was thinking of.
 
Also, I'd like to be able to hide the "threshold" marker, but that doesn't seem possible without changing the SteelSeries code. That's probably an easier fix than the LED issue, but I really hate reverse engineering someone else's sparsely commented code.

Add the following to you constructor and the threshold marker will be hidden.

Code:
thresholdVisible: false
 
For those of you using an arduino, how are you guys sending configuration data to the board? I'm not really seeing a "clean" and effective way to be able to send dynamic configurations to the board.

For instance, how do I change the max limit for my HLT (for example) from say a 164 degree max to a 185 degree max during operation?

Maybe I'm making this to complicated...
 
For those of you using an arduino, how are you guys sending configuration data to the board? I'm not really seeing a "clean" and effective way to be able to send dynamic configurations to the board.

For instance, how do I change the max limit for my HLT (for example) from say a 164 degree max to a 185 degree max during operation?

Maybe I'm making this to complicated...

Add a potentiometer to an analog input. Use its value to set the temp threshold.
 
I've been through what you're experiencing. I've come to this conclusion:

If you're using a microcontroller, use it to its fullest capability. Allow it to control - that's what it's designed to do. If it's spitting out data to a computer, that data should likely be for display only. If it suddenly lost the data link with the computer, it should be able to run autonomously with no catastrophic errors. Use pots, buttons, and switches to interface with it directly.

Otherwise, use something like LabJack or the 1-wire setups mentioned in this thread. Using those systems, the computer itself becomes both the display and controller.

Trying to use Arduino as a "middle man" is highly likely to leave you frustrated. I'm not saying it can't be done. In fact, I had a great deal of success with such a system. I just think it's counterproductive. Also, I found serial comms to be somewhat finicky with Arduino. I'd much rather rely on a unidirectional data dump than bidirectional data/control streams where the control inputs could be critical.
 
I've been through what you're experiencing. I've come to this conclusion:

If you're using a microcontroller, use it to its fullest capability. Allow it to control - that's what it's designed to do. If it's spitting out data to a computer, that data should likely be for display only. If it suddenly lost the data link with the computer, it should be able to run autonomously with no catastrophic errors. Use pots, buttons, and switches to interface with it directly.

Otherwise, use something like LabJack or the 1-wire setups mentioned in this thread. Using those systems, the computer itself becomes both the display and controller.

Trying to use Arduino as a "middle man" is highly likely to leave you frustrated. I'm not saying it can't be done. In fact, I had a great deal of success with such a system. I just think it's counterproductive. Also, I found serial comms to be somewhat finicky with Arduino. I'd much rather rely on a unidirectional data dump than bidirectional data/control streams where the control inputs could be critical.

Yeah, the more I mess with it, the more I think you are right. Thanks for the reality check ;-)...

I may continue working through more automation, but I need to nail down the control first.
 
I'm finally getting around to finishing my temp probes today. The mash temp probe is complete and in working order, reporting temperature to the server. I'm going to make two more probes and connect them. Pics to follow. I'm excited!
 
I'm interested in how you built the temp probes. I'm working on a similar type of project and need all thee ideas I can get.
 
Here are some pics of the thermowells I made. I made two of them out of 1/8" NPT male pipe plugs. I used stainless tubing that's about the same diameter as a Corny dip tube to protect the sensor wiring/pigtail. The sensors are DS18S20's.

First I milled pockets into the back of the plug - a somewhat deep blind hole for the sensor, and a shallower one to hold the tubing. Two appropriately sized drill bits would be just as effective.

scaledp1030813.jpg


scaledp1030816.jpg


The parts fit together like so:

scaledp1030815.jpg


scaledp1030817.jpg


I silver soldered the tubing in place using flux coated 45% silver solder.

scaledp1030818.jpg


I wired the sensor with a length of phone cord and used JB weld to hold the cord in place.

scaledp1030819.jpg


The thermowells I built using this method are installed and working in my steam generator and boil kettle. Here's a picture of a slightly different one in my mash tun. It's made from a thermowell from www.mcmaster.com given similar treatment as the ones above, including a piece of the same tubing at the sensor end to improve response time (the thermowell had very thick walls). I TIG welded the tip of the tubing and silver soldered it into the thermowell.

scaledp1030820.jpg
 
This didn't work.

You're talking about hiding the little red triangle, right? I wonder if I have a different version of steelseries.js? My copy is on my laptop at work. I'll dig it out tomorrow and post it if you want to take a look at it.
 
Yuri,

Thanks for the quick overview on how you built your temp probes. Now I think I can come up with something similar for my rig.

Thanks!
 
I'm going to do a 1wire brew very soon! I test ran the rig tonight.

The DS2438 is extremely easy to use if you need a DA converter. I'm using one to read the output of an MPX4250 pressure sensor on the steam generator.

DON'T use parasite mode for DS18S20 temp sensors. In that mode, they get wildly inaccurate as temperatures approach or exceed 185ºF (85ºC). I wish I'd known that from the start. I need to rebuild my sensors at some point.

Also, using 4 conductor phone wire will not suffice if you don't want to use parasite mode. The USB dongle's power output is on pin 1, which is not present in RJ-11 jacks and connectors. You could rig a custom crossover-like cable to overcome that limitation and still use 4 conductor phone wire, but it seems there is a bit of a standard in 1wire devices, and you risk damaging a pre-built device, should you ever add one, by creating your own wiring standard.

Overall I'm very happy. My scripts are extremely simple at this point, and my webpage displays all sensor data correctly. There are a few loose ends to tie up, but I could (and might) brew beer tomorrow.
 
I might add that for those of you on the cheap, don't forget that you can also build a serial interface for the DS18S20.

r100_1715.jpg


If I recall (it's been 5 years) I got the circuit off "martybugs" or some such.

Found it: http://martybugs.net/electronics/tempsensor/hardware.cgi

Was also using 'digitemp' to grab the values and stuff them in rrdtool, both of which are just an apt-get away!
 
I was wondering how to control temperatures from a computer. I have what I think is an absolutely *GROUNDBREAKING* idea I wanted to do that would require this. So this thread is interesting.

But at the same time, it's a bit discouraging for me. I know a lot about certain areas of computing (far more than anyone I know IRL, especially in areas such as networking, hardware, building/Modding, etc), have done SOME programming with some basic languages - but the most "capable" being vb/vb.net... so yeah, that says a lot right there. I may have dominated everyone in my 12th grade programming class, but I ended up with over 100% only because the bar is apparently set very low so that they don't fail 80% of the class (it seems people took these classes thinking it'd be a breeze since they use computers every day for IMing, email, etc).

I used an even more basic "learning" language called Turing and did basic (sequential) text reading & writing to file and even some basic controlling of a diorama (lights, motors, etc, through the parallel port), though I doubt that simple method of powering different devices by controlling output on each pin would be sufficient here. Heck that even reminds me of controlling "robots" via Lego Logo back when I was 12 :D

But I digress. I'm feeling discouraged because I'm not even able to make heads or tails of even the stuff in the OP. My Linux experience amounts to some VERY basic SSH interaction with a server, and even then I've probably forgotten it all.

So I'm wondering how I can learn everything necessary to do this. I can learn pretty quickly in the right circumstances, but don't even know where I can find the information to get to where I want to be in a reasonable amount of time. Heck, I'm not really convinced I WILL be able to get this, which is the main reason this thread has me down a bit. I've done pretty well in university, and even graduated high school ranked #1 in my year (and that's including the rest of my classmates in the gifted program), but you'd never know if you saw me in class, as I'm the kind of person who needs constant clarifications, and who asks questions about nearly everything just in order to be able to frame the information in a way that can actually make sense to me. Rote memorization was always useless for me (and I was really lousy at math until I figured this out) - even in classes like calculus, I only excelled because I'd waste a ton of my teachers' time explaining "why" things were (if I didn't understand immediately), and so on tests and exams it was okay that I couldn't memorize formulas and procedures, because I'd be able to logically work them out (in the exact manner that you'd logically work things out while programming, actually.)

Anyways, I know that may seem like a lot of unnecessary information, but I'm hoping that maybe somebody will have the kindness not to simply TL;DR it, and maybe have an idea as to how I can learn what I need to learn:

All I really want is just to be able to parse times and the corresponding temperatures from a text file, and either use it to set a thermostat, or have the program itself act as the thermostat. The rest of this project is stuff I'm already capable of doing, but I'm convinced that this idea will have some serious legs if I can get a proof of concept up and running.

Despite my lack of experience with Linux, it will probably be a better idea in the long run, as I'll need something that can run very stable and, ideally, never need rebooting.
 
Don't get discouraged, and don't get tripped up on the OS. You can read DS18S02 sensors from an MS box too (I think there is an MS-DOS version of the "digitemp" program to read them, if memory serves). It's just not as cool. ;)
 
Nice, interesting to see the water/steam mixer in operation without the "steam" music you get with steam injection into standing water. Any plans to try wort heating with that setup?, or just use that mixer for sparge water heating.
 
I use it for sparge water and mash temp maintenance. If there's pressure left at the end of the day, I use it to accelerate getting the wort up to a boil. I don't think it's going to be practical to use it for boiling, but maybe I'll come up with some sort of steam jacket or coiled element using recirculating superheated water.
 
Exactly. I'm guessing you're using a different version. It appears there are several available.

Here's a link to what I've been using. It's a zip file that has the steelseries code and a hacked up version of the html file you posted earlier in the thread. I also added a mash and boil timer to it.
 
Nice work guys! At least some of you are having fun - I've been getting slammed at work and no time to play. :(
 
Back
Top