Monday, June 27, 2011

Fun with sensors


A couple years ago I put together a kegerator and while draft beer at home is great, the project never felt complete. The system performed well but there were a couple of issues that would crop up from time to time. Mainly, figuring out how much beer was left in the fridge consisted of opening the door and pawing at the keg.  Besides this being unscientific, the act of opening the door would let all the cold air out and the compressor would have to crank to keep up. And speaking of temperature, it would be nice to have a good idea of how cold the keg is getting.

Scale for Fuel Gauge Measurement
Incorporating a temperature sensor was obvious. Though there are many different types so choosing wasn't easy. We'll get to that later. To make a beer fuel gauge I decided to tag team a couple different sensors to make as accurate a reading as possible. First I constructed a crude scale to house a couple force sensors I got from Sparkfun. To supplement the weight measurement, I added a Swiss Flow SF800 flow rate meter to the mix. You can never have too many sensors. I ended up not needing the flow meter for the fuel gauge but it got used when I wanted to know when beer was flowing or not. You'll see why that's important in the video below. I was reluctant to include the flow meter initially because I thought there was a chance if would disrupt the flow of beer and create more foam than usual. While this is the case, it wasn't significant enough to remove it.

I thought the temp sensor was a no-brainer but it turned out to be a little tricky. Idealy, I'd like to know the actual temp of the beer but since the keg is a sealed container, that is impossible. The next best thing would have been to simulate the keg with an approximate thermal mass and sense the temperature of that but I didn't have the space.  That and I had already decided to be lazy and use a board mounted digital temperature sensor instead. Couple drawbacks with that idea though.  Since it is soldered to the sensor control board, thermal coupling to said board is an issue and placement in the fridge cavity is somewhat limited.  And to get a reading that actually means something, placement is critical. Turns out that placing the board right under the fridge chill plate gave me some pretty accurate results when compared to a mercury thermometer. And it was a good indication of what the fridge's themocouple was reading since the compressor cycle and my temperature readings tracked almost exactly in phase. That's important because one day I may want to take over control of that cycle for tighter temperature regulation.

So now I want to display all the good data I'm getting.  I used cast iron pipe for my keg riser so I felt it was necessary to stick to that theme and go a little industrial with my display options. After an exhaustive search online, I finally came across the perfect meter housing from an early model Chevy. On ebay of course.  It was pretty beat up when I first got it with splotchy paint and some pretty rough edges. I was originally going to sand and paint the thing but ended up trying my hand at paint stripping instead. Peep the before and after.

Meter Housing Before and After
I'm gonna have to give credit to CitriStrip on this one.  It made short work of that old paint.  A little grinding here and polishing there and... well, I still had an empty shell.  That is until I modified up a couple analog meters to stick in there. 

Modified  0-5 Volt Analog Meter
They were a little small but hey, when life gives you a little space fill it up with light from an RGB LED I say. What would one of my projects be if I didn't throw some lumens at it. You'll want to check out the video for full effect.

I made four boards for this project. They are mostly unpopulated in the picture to the left because I like to test out the micro first before I finish them up. I'm weird that way. The board at the bottom went in the keg fridge and has circuitry to read all the sensors. It also manipulates the data into an easily read format for the display control board in the middle. That board drives the Tri-Color LED drivers and does a couple D/A conversion to drive the analog meters. The board on the upper left will eventually house a relay to control the compressor cycle and the board right next to that is a RS232 level shifter so I can divert the TTL level UART signal intended for the display board to a PC for debug purposes. Being able to save the sensor data off to a PC was also helpful when developing my display averaging algorithms.   

I never thought my kegerator was stupid before but it sure is smart now. If only if would help me brew beer too. I guess that's the next step.




2 comments:

Anonymous said...

Could you provide some details on the force sensing rig? I considered the same thing, but in the end went with an SF800 as well because I thought the force sensor wouldn't have single pour resolution. Great work.

Slaymetender said...

Nice work! Can you link to your schematics? I'd like to duplicate this for my own rig.