Kegserver Resurrected!

Well after being offline for probably over one year, it is back up again.  There are many reasons why it has been so long (primarily a hard drive crash), but mostly because I lost access to it from work when I switched ISPs.  In any case, I finally spent a few hours rewriting the site in Rails 4.0, yup upgraded from Rails 2 to Rails 4.  In addition, I refactored the code, primarily because I created the initial version before I had any clue how Rails is supposed to work.  So, now I am a little more MVC savvy, and I shrunk my controller and fattened up my model.  Rails is counter-intuitive that way–typically models are skinny, but in MVC land you want a fat model.  So after moving it all to the model and having the controller merely spit out a jpeg dump from a lot of back end work by rmagick, we are back online!

My next step is to add date/time to the pic so that I know when it last updated.  I’ll also have to make sure we don’t put our leftovers on the keg anymore, because then I’ll think there is more beer left than there actually is!

Cheers!

 

Kegserver and Code

I’ve posted all the code needed to run this on github.  You can find it here: https://github.com/sshamilton/trackakeg/

The kegserver script that does the updates is in the main directory with the rails.  I run it using the daemon in linux, and it works quite well.  If you do not see the keg on the left of the page then my computer is off.  I don’t have it on an ups yet, so a power outage will take it down.

One thing I’ve noticed over time is that the strain gauge gets  a little out of whack, and I have to recalibrate the scale.  Other than that, it has worked for over a year now!

 

Kegserver is back up

Well it has been a long time since I posted, but I just wanted to give an update to this project and the stirplate project.  The kegserver was having a lot of trouble after Christmas.  It turns out the old Pentium D computer it is on was completely clogged by dust on the heat sink for the CPU.  I guess that is what you get when you build it  yourself and you don’t include a filter before the fan.  So apparently it was overheating and shutting down.  I also had some DNS trouble with DynDNS, which is a great free service as long as you make sure you are updating every 30 days or so.  They apparently no longer support the domain I was using, so I had to change the DNS it was on.  In any case, it is now back on line, and currently showing how much Captain Lawrence Double IPA is in my fridge.  Yes, I know–it isn’t homebrew, but hey–it is WAY to cold in NY and too frozen outside to boil a 10 gallon all-grain batch like I normally do.  So as any good homebrewer, I found the best local microbrew, and bought a 5 gallon keg of it.

On the stirplate, I do owe the new design.  We created one for Cub Scouts and it is great.  I will post pictures and a diagram of how it works soon!

Cheers,

Stephen

 

Beyond Maker Faire…

Maker Faire was AWESOME!  What a crazy event that was.  I am proud to say that the Track A Keg received an Editor’s Choice Award. :) 

The interesting thing was the coolest display I had was not either of the projects that I submitted!  It was in fact the Yeast Stir plate.  While I always thought it was about functionality, the visual affect is pretty cool, and it attracted a lot of attention.  So, for all those who saw it, I am going to not only post how I built the one I had, but I’m going to work on a way cooler one that hopefully will be published in Make magazine someday. 

In any case, the short rundown is this: 

Items required: Cigar box (or equivalent), computer fan (12v or so), old cell phone charger (voltage close to computer fan), switch (if you want to turn it on and off), stir bar (google it–Science supply stores and homebrew stores sell them), hard drive magnets–the rare earth magnets found in the arm of the inside of an old hard drive, and if you want to control the speed, a rheostat will work.  I had an LM371 voltage regulator to keep the current up as well, but this may not be necessary if you don’t want to control the speed as much.

Mechanics Inside the Vortex Stir Plate

Inside the stir plate

Glue the rare earth (hard drive) magnets to the fan, put it in the cigar box, and see how much distance there is between the top of the box and the magnets.  You may need to add something underneath the fan to raise it so that the magnets are close to the top, but not touching.  The closer they are, the better the magnetic field will be.

Once you have done that, you can connect the fan to the cell phone charger, which will make the fan start up.  You do need to have the vase (I got mine from Wal Mart for about $5), water, and stir bar in place before you start it.  If the fan runs too fast, it may cause the stir bar to fly off, and rattle on the side.

More to come–I am going to look at finding parts that will work without the regulator, and also post the regulator circuit for those interested in controlling the speed!

 

Track a keg Phase II

Keg level on the LCD

Keg level on the LCD

Well the LCD that I got was easier to set up than I anticipated!  Special thanks to Limor for that–she posted all the code and wiring diagrams I needed, so I had it up and running in no

My Favorite Quote

My Favorite Quote

 time.  I’ve posted some pictures of what I quickly did (less than 30 minutes including Ardunio software download!)  The only thing left is if I can get the Arduino to talk to the Xbee so that I can remotely send LCD updates.  Once that is done, pushing pint updates to the display will be trivial!

I quickly made a program that displays my favorite quote, and then shows the keg image.  That image is a snapshot of my keg scaled and converted to fit on the 128×64 LCD matrix.  Totally Cool.

 

My Virtual Keg is now online!

Live Keg View

Well it has been a busy week, but today I finally got a few minutes to set up the whole thing!  It is all working.  I am going to spend the next month or so (scraps of free time I can find) to work on the software some.  I would like to do more with imagemagick and rails.

The past few days were quite inspiring as I got a chance to go to the Next Hope!  It was fantastic, and I got a chance to meet all kinds of interesting people!  I also hung out at the Adafruit table with Limor and Phil, and bought some more equipment for the next phases of this project (LCD, Arduino, and accessories I needed).

So (drumroll)  Here it is, the Virtual Keg.  I have a Hefeweizen on tap now, and as you can see it is less than 1/2.  Wow.  had no idea that it was so low.  I guess this is why I made this thing in the first place!  :)  Good thing is I have a pale ale in the fermenter, and of course another 5 gallon of Hefeweizen, but that is reserved for the Supt’s boat cruise with the EE&CS department, so I can’t count that.

If the image doesn’t display, it probably means my crappy server is down.  It is an old home built machine running Linux, and it seems to run fine in the house–so maybe it is my crappy internet uplink.  Either way, if it shows, you are looking at the realtime (within 10 seconds) level of my keg!  Wooohoo!!

Cheers,

Stephen

 

Great News!

See me at Maker Faire!

Sample Generated Fill Line on a Keg

Wow–This past week has been phenomenal!  Not only significant progress has been made on this, but the project has now been accepted into the Maker’s Faire! 

After figuring out that I needed a differential op amp design (the scale has two outputs, one that increases voltage as pressure is applied, and one that decreases), a friend of mine, Chris Lowrance, helped me change out a few resistors to get the range that I needed.  Now it appears it might be specific enough to detect one pint down, so maybe I can call it a Pintometer! In addition to the hardware, I’ve been a little busy with Ruby On Rails (which totally rocks!), and found a neat plugin call RMagick that allows me to graphically draw the fill line on the keg.  I am about one week away from probably even including it on this site.  Next step will be to make it Iphone Friendly, and maybe stick a temp guage on the circuit as well.  

 Check back in a week for more news, and hopefully a live keg!

Cheers,

Stephen

 

Xbee Wired to the Scale

X-bee wired to the scale

Here is the latest version of the wiring of the scale to the X-Bee.  There will hopefully be one more revision to get better accuracy, but this is the first full fledged working model.

 

Kegserver.py

I’m not at all a python expert, but I got it so that the results are pushed to the MySQL database, which I plan to have a frontend on.

Currently my range is not what I want, but not too far either.  It is 750 on a full keg, and 674 without a keg on the scale.  It will be around 680 or so on an empty keg–I haven’t tried it yet–by the end of this project I probably will have empty kegs though!

Here is the code so far:
from xbee_api import *
import MySQLdb

################################################
class myXbeeApi(XbeeApi):
#make the database connection

def onData(self,pkg):
db = MySQLdb.connect(host=”localhost”, user=”keg”, passwd=”", db=”keg”)
#get header for IO data
if pkg["code"]==0×92:
#print “Samples %s-> %s” % (pkg["data"]["mac"],pkg["data"]["dsamples"])
#Eventually this will go to a database or text file or something.
#print “Samples %s” % (pkg["data"]["dsamples"][0])
#Convert it to decimal.
decimalvalue = pkg["data"]["dsamples"][0] * 256 + pkg["data"]["dsamples"][1]
print “Keg value = %d” % decimalvalue
#Prep to put into database
cursor = db.cursor()
#Get the last value
cursor.execute(“select * from weights order by sampletime desc limit 1″)
result = cursor.fetchall()
for record in result:
lastweight = record[0]
#got the last weight, so comapre and insert into the database if different.
if decimalvalue != lastweight:
cursor.execute(“INSERT into weights values(%d, Now())” % decimalvalue)

elif pkg["code,"]==0×97:
print “Remote AT %s-> %s [%s]” % (pkg["data"]["mac"],pkg["data"]["cmd"],pkg["data"]["status"])

################################################

api=myXbeeApi(“/dev/ttyUSB0″,9600)

 

First good working version!

After learning from some great people I work with about Op Amps, I finally have a good working version.  Special thanks to LTC Tim Schmoyer who helped me while he was on leave and passing through.  He simplified my circuit, and had a decent working version on the 2nd of July.  I took what he started, and improved on it by making it all work off of one power source.  It turns out that I needed a differential amplifier circuit since I had two leads from the scale that varied voltage in opposite directions.  I’m not getting the range I hoped for, but I think this can be improved by changing out the resistors.  I hope to do that soon.

I’ve also got the software updated so that it saves the value obtained from the weight of the keg to a database–now this is more of my territory, so I should hopefully have a graphing website working as well.

I’ll post the Python code in the next post.