Thursday, January 28, 2010

This one's for Richard

Richard! Look at the chart!

Fair warning: this is going to be one of those posts that rambles on and on with little to do with beer and a lot to do with technology.

My troubles with getting multiple Maxim DS18B20 temperature sensors working reliably with my Arduino Duemilanove microcontroller and my CAI WebControl board have been noted here many times. I think I may have finally figured out what was causing my problems. As with most things I resolve, it turns out to have been equal parts unreasonable expectations and learning curve. Rather than backtrack through all the previous postings I think it would be easier to describe what I have arrived at compared with what I had hoped to achieve, and then explain how the differences have arisen through this journey.

As of this moment, I have the following configuration working:
  • Arduino with 3 "parasite mode" probes connected via 1/8" mono phono plugs, two of which are using 50' headphone extension cables with the other simply on its 6' base lead, with one 50' probe on a separate digital input pin from the other two.
  • Arduino temperatures are displayed on the 2x16 LCD connected to the board and printed to the serial port. The temperatures are collected about every 6 seconds or so as the display loops (not interrupt driven).
  • WebControl with 1 "active mode" probe connected via 1/8" stereo phono plug and using a 50' headphone extension cable.
  • WebControl temperature reading collected remotely over Ethernet using its CGI capability, then stored and charted using RRDTool.

The graph to your left shows a thumbnail of the last hour of the WebControl-attached probe's reading of the ambient temperature in the garage. Clicking the chart will take you to a page showing a larger version of that graph and some graphs showing more historical timespans. The traces start about 10:30 PM on January 27, 2010.

What I had hoped to achieve, at various times during this escapade, included
  • Multiple probes on the Arduino with 50' extensions (at least 3 and as many as 7 or 8).
  • The Arduino providing on-demand updates via its serial port and a web service on another host.
  • The Arduino managing temperatures in the kegerator and fermentation chamber, activating an SSR to cut the compressors on and off as needed.
  • Multiple 50' probes on the WebControl (which is alleged to support as many as 8 DS18B20 devices).
  • The WebControl using its digital logic feature to manage the temperatures in the kegerator and fermentation chamber via SSR.

The principle sticking point in most of these scenarios has been getting the probes to work reliably, and that's where today's ramble will focus.

I selected the DS18B20 digital thermometer for the probes because I didn't want to mess with managing A/D conversions with something like the LM34. There are numerous working examples of DS18B20 to Arduino projects all over the Internet, and the Arduino home page even has links to a predefined library for handling the DS18B20's 1-Wire interface. The promise was simple: multiple DS18B20s, which can exist in a bus structure because they're independently addressed, without fear of signal degradation or need of op-amp amplification due to run lengths of sensor cable. Maxim (who purchased Dallas Semiconductor, the originator of the DS18B20 and 1-Wire) claims distances of 300m or more for the 1-Wire bus. How could this possibly go wrong?

Chasing Resistance is Futile

Well, the first place it could go wrong is with basic topology. The Maxim IC application note on reliable 1-Wire networks is very clear that the "star" (hub and spoke) network layout is the most difficult to arrange reliably. Maxim describes the issue as one of reflections and mismatched impedances causing clashes among different devices on the bus when a star topology is used.

I must have read that document a dozen times before it finally sunk in. One of the major contributors to my challenges has been my desire to have multiple probes attached via a single digital bus point, creating a star topology. This was much more evident (in hindsight) with the work I did with the WebControl board than the Arduino. I have written about some of that work already but the short version of my problem was lack of reliability. I could, at various times, get one, two, three, or no probes working with the exact same wiring configuration on the WebControl board. It didn't occur to me until very recently that the problem was the impedance issue introduced by the star topology I was wiring.

What finally tipped me off was something I read later in that application note regarding the use of stub drops off a single long line connecting the DQ of all DS18B20s in a long bus. The note talks about the optimum length of said stubs as being under 3m. Suddenly it occurred to me that the majority of time that I had anything working, all the run lengths were individually less than 3m long, so essentially I had a zero-length long line with a handful of stubs. Things went south when I added the 50' extensions to one or more lines.

I had spent hours chasing line resistance as the cause of this problem, thinking that the power supply from the board wasn't able to source enough current to overcome the resistivity over the length of the cable. I came to realize I was seeing the reflectivity issue instead. That's how I have ended up with the three probes on the Arduino on separate digital inputs and why I have cut down to a single probe on the WebControl board. I now have only one device on any given bus, so there's no cross-talk and reflection among devices. Each of the buses supports a 50' combined length of probe and extension, providing me with the maximum flexibility in configuration.

How does that fall short of expectations? The main issue is pinout. Three's about all the digital inputs I have to spare on the Arduino after all the pins that are used to support the LCD display are accounted for. (I know the analog pins can be used as digital inputs too, but I don't want to give them up just yet.) It would have been much better if I could have run the probes off one pin. The WebControl is more problematic, as it has a single port purpose-built to support DS18x20 devices. I am approaching this as meaning I can use one of my probes reliably, or set up a more conventional long-line with drops. The long-line strategy would be good for relatively fixed device measurements, so I may yet do that, but for now I'm going to concentrate on just the one probe and leave the other 7 the board supports as undiscovered country.

I promise to post some schematic drawings of the final configuration of this stuff soon. In the meantime, enjoy the chart showing the ambient temperature in my garage.

Sunday, January 17, 2010

Channeling Pedro Cerrano

Unlike Pedro, I don't hit the straight ball very much, because it's not just the bats that are afraid when I step into the batter's box. Like Pedro in the playoff game, however, I'm pissed off (albeit not at Jobu). I'm beginning to think there's some sort of cosmic conspiracy to undermine my confidence in my technical abilities.

I spent this weekend cleaning the garage so I would have a place other than the dining room in which to work on my automation projects. This afternoon, I finally cleared and lit a place on my workbench(!) where I can prototype circuits and solder and do all the stuff I need to do to finish the temperature monitoring and control system I have been working on. I proceeded to assemble a probe from 50' of Cat-5 cable in the expectation of moving the project forward.

Interestingly enough, once I had a place to work in the garage, my soldering skills improved (why, I don't know). I got the DS18B20 attached to the cable the first time and tested the new probe along with the two that were working previously.

Here's where the Cerrano situation comes into play. I cannot get the WebControl board to recognize all three probes every time it powers on. Sometimes it will only see the original two, sometimes it won't see any. If I remove the original two probes it recognizes the one on the Cat-5 cable. Sometimes it will see the Cat-5 probe and one of the two others.

I'm unable to figure out why things are so inconsistent.  I'm sure it's due to either (a) my own idiocy or (b) some issue with the Vdd power on the probes. Maybe I'll switch the probes back to the Arduino and see what happens.

Kegged: 091103 Por Favor Keg #2

So I finally got around to kegging the second carboy of the Por Favor batch I made back in November. It's been patiently biding its time for about 6 weeks. I put it into the cooler about two weeks ago to cold crash and clarify it. Today I kegged it, and I noticed from the start of the racking process that the beer was clearer than usual. I didn't take a gravity on it.

Since the beer was already cold I went ahead and carbed it. I can definitely tell the difference between this portion and the beer that came out of the other carboy a month ago. The flavor is much smoother, and I don't sense the yeast overtone that was apparent (to me) in the other keg.

I guess this is a lesson to be learned - beer tastes better if you let it condition for a while instead of rushing it to serving. I need to adjust my production schedule (and equipment) to allow for more aging for each batch. What that likely means is that I will need more kegs and carboys because they won't come available as frequently as they do now.

Sunday, January 10, 2010

2010 From the Consumer's Perspective

My last post outlined Fork and Hay's 2010 objectives from the supplier's point of view. As in real life, however, all those goals are useful only in the context of consumer satisfaction: you can make the most consistent, high-quality products in the world, but if they're not what the consumer wants, they're not going to sell. Well, to be fair there's no selling going on at Fork and Hay Brewing (DO YOU HEAR ME ATF AND IRS? I'M NOT SELLING BEER), but the idea is the same: if the people who are the potential consumers of my batches don't like them, I will have wasted my effort and money in producing them.

What does the Fork and Hay consumer want? I said before I don't like looking backwards, but as I see it there are only two ways to determine what products to make: see what was popular in the past and make more of that, and do market research to determine what the people in your target market want and figure out how to provide that. (I know that's a simplistic way to look at it but, as some of you have heard me say, the only time I ever spent in the business building in college was when the Brewmistress and I would use their dial-up terminals to play Adventure on the campus mainframe - at that time the engineering building only had card punches and readers. XYZZY FTW.)

If we take a quick click on the ads...sorry, did that come out in print?...I mean, a quick look back at what Fork and Hay produced and how long it took to get it consumed, we should have some idea of what was popular in the past:

"Geordie" family: 50 gallons brewed, consumed
Por Favor: 20 gallons brewed, 10 consumed, 10 serving
Half Wit: 5 gallons brewed, consumed
Gayle Bait: 5 gallons brewed, still serving since October
Honey-Brew List: 5 gallons brewed, scrapped
Coldwater 420: 5 gallons brewed, consumed
Shaun of the Dead: 5 gallons brewed, serving

Clearly this tells us a few things:

  • I like the Geordie recipes and Por Favor
  • Honey-Brew List was a disaster
  • Half Wit and Coldwater 420 were enjoyed by other folks
  • Gayle Bait isn't a disaster but it's not knocking the crowd's socks off

What does it really mean? It's obvious that I'm the primary consumer of my work, which isn't news. Given that, planning for the new year should be pretty easy - keep the keg pipeline full of Geordie Boy and Por Favor. The problem with that plan is that it doesn't account for the other significant use case for my beer, which is serving friends and family during various gatherings.

For this year, I need to be thinking pipeline for some significant events: Spring Break, St. Patrick's Day, Scotty's graduation, and the Fourth of July are those most impending. The people who will be around the house during that time are a mixture of "serious beer" drinkers (some of whom are also serious "beer drinkers") who have already exhibited an interest in the richer recipes like Por Favor and the two flavors that Tim commissioned, and casual beer drinkers who seem to gravitate toward lighter brews. The challenge before me for 2010 is to determine what I can make to satisfy the casual drinkers, because personally I'll be satisfied to keep drinking Geordie-Boy and Por Favor.

Note: at no point in this discussion do I intend to be demeaning to those whose tastes aren't like mine. I'm not trying to stand in judgment of people who like lighter beer than I do. It may come out sounding pejorative but I don't mean for it to.

I had intended for Gayle Bait to be the principle beer that I could offer the casual drinkers, but so far it hasn't really taken off. I'm not sure why. However, I think that it has some of the characteristics that are likely to appeal to this demographic:
  • It's light in color
  • It's fizzy
  • It's not too hoppy
  • It's clear
Not coincidentally, those features happen to describe the main characteristics of the most popular commercially available US lagers.Thinking back on last Fourth of July, when my available offerings were Half Wit, Coldwater 420, and Geordie Ale, the most popular beer among the casual crowd was Half Wit. Geordie Ale was too dark and Coldwater 420 was too hoppy. Half Wit was light, fizzy, and had a mild flavor, even though it was based on a witbier and therefore was somewhat cloudy. It seems clear (no pun intended) that this is an area I need to try and master in the upcoming year. I can repeat the Half Wit recipe, and I think I can do it in a way that adds some flavor but doesn't risk the unfortunate consequences that the Honey-Brew List batch encountered.

So what do I do? I think that I am on solid ground by planning a 10 gallon batch of Half Wit for readiness by St. Patrick's Day. That should carry my light and fizzy inventory at a sufficient level to hold me through Scotty's graduation in May, and give me time to replenish before the Brewmistress's annual domination of the Indian Springs Fourth of July Celebration dessert contest.  However, I'm really not satisfied with that response. Am I really going to have to start lagering before I can make everyone happy?