Sunday, June 14, 2009

Twittering BBQ

My barbecue has its own Twitter account. If you want to follow along when I smoke some brisket or fish, hit up http://twitter.com/lukesbbq. Below is a description of how I set this up.


This is my Brinkmann "Gourmet" Electric Smoker. It is a decent piece of kit in stock form, but it does let the internal temperature climb too high quite often. The heating element is an unregulated 1500W electric element that is simply "on" all the time. On a warm day, this can bring the smoker temperature above 250F, too hot for proper barbecuing. I set out to cure this issue by controlling the power to the heating element in order to regulate the temperature of the smoker.

The easiest way to do this is to cut power to the heating element when the smoker temperature exceeds some preset limit, and turn it back on when the smoker cools off. I accomplished this using a relatively expensive solution, but it's what I had laying around.

Measuring temperature
The first step is to monitor the temperature in the smoker. I had purchased a pair of digital thermometers with probes that are meant to be inserted into your meat all the time.

Taylor makes a variety of digital thermometers that all use the same stainless steel temperature probe (seen in the package on the left). These thermometers are available at many outlets (I found mine at Target and a local grocery store) and come in a number of models at different price points. The cheap models use the same stainless steel probe with 4' silicone cord as the more expensive thermometer/timer units. The probe itself contains a thermistor, a resistor that changes its resistance based on its temperature. This thermistor can be wired into a Wheatstone bridge to produce a voltage that varies with the temperature of the probe. I elected to monitor the temperature by building a Wheatstone bridge with 3 resistors (47k ohm) and the probe as the fourth leg. I powered this bridge with the 5 volt supply provided by a National Instruments USB-6008 Data Acquisition Card. I then read the voltage from the thermistor bridge using one of the analog input channels (in differential mode) on the USB-6008.

Basic wheatstone bridge schematic


In the final version I ended up using three temperature probes, so I put three Wheatstone bridges on the little perf board below. The output from each of the three bridges is run to a separate analog input channel on the USB-6008. To get the temperature probes out to the BBQ, I made extension wires that run from the perf board to the patio, where the temperature probes plug in and get inserted into the BBQ.




The output of the temperature probe/wheatstone bridge setup needed to be calibrated in order to produce a temperature. I did this by placing the temperature probes in a beaker of water alongside an alcohol thermometer. I slowly heated the water, watching the thermometer temperature and recording the voltage output from the temperature sensor. By plotting these data in Excel, I produced a relationship between sensor voltage and temperature in Fahrenheit using a 3rd order polynomial. This is accurate to better than 1 degree F over the range of 0 to 212F. Each of the temperature probes from the three different models of Taylor digital thermometers is interchangeable, since they all use the same thermistor in the probe (they have a resistance of ~166k at 0F, and around 50k at room temperature).

Controlling the heater
Now that I know the temperature in the BBQ, I can now use the same USB-6008 DAQ to control the power to the heating element in the BBQ. This is accomplished by using a digital output line from the USB-6008 to control a relay that supplies power to the heater. The TTL digital signal from the USB-6008 by itself is not sufficient to power a relay though, so the TTL signal is first fed to a ULN2803 Darlington array. The ULN2803 takes a digital signal from the USB-6008 and switches power from a 12V power supply to drive the coil of a relay.


The relay control board can be seen in the background next to the wheatstone bridge board. The 12V DC power controlled by the ULN2803 is fed to a 2-gang electical outlet box that houses a solid-state relay and a 120VAC electrical outlet, seen below.








The 2-gang box holds a Kyotto KD20C75AX solid state relay. This unit can be controlled by a 4-32V DC signal, and will happily control a 120VAC load of up to 75 amps peak current draw. The 75A peak rating might be overkill for what should be a 12.5A load from the heating element (1500W/120V = 12.5A), but the relay definitely gets hot to the touch running this load.

The electrical outlet on the right side of the 2-gang box is wire to an extension cord that runs to the mains power. Instead of wiring this extension cord directly into the outlet, I ran the hot leg through the solid state relay to control power to the outlet. By doing this, the outlet (and anything plugged into it) are switched on and off by the USB-6008. As shown above, I plug in an extension cord to run out to the BBQ.


The view inside the BBQ shows a roast with the temperature probes inserted into it for this test. Normally one of the temperature probes is mounted so that it hangs in the air in the upper portion of the BBQ, monitoring the air temperature. The other two probes can be put into whatever I'm cooking.

The program
With all of the hardware setup, the last piece of the puzzle is the software that will control everything. I used Labview 8.2 to build a simple program to monitor the temperatures and control the power to the BBQ.

The program monitors air temperature several times per second. The current air temperature is compared to the upper and lower air temperature limits set in the upper right of the control panel. When air temperature exceeds the upper threshold, power is cut off to the heating element. When air temperature drops back down below the minimum threshold, the heating element is turned back on. The thermal inertia in the BBQ is sufficient that you don't need to factor in any sort of hysteresis in the program to prevent the heater control from flipping on and off too quickly. The program will also save the temperatures once a minute in a text file should you want to replay the whole cooking endeavor at a later date.

The basic program worked fine, until I saw a post by Jarrett Byrnes at I'm a chordata! Urochordata! describing his newfound ability to post to Twitter from within the R statistical language. It occurred to me that this might be useful for the BBQ, so I went hunting for an implementation in Labview. That led me to a NI Developer Zone Community post about posting updates in Twitter. Unfortunately the code posted there only works in Labview version 8.6 or later, but there was enough information in the example schematic to write my own Twitter update vi. After integrating this into my BBQ control program, I can now have the BBQ post updates to its Twitter account at 30-min or hourly intervals, and send an additional notification when one of the meat temperature probes exceeds a chosen temperature (i.e. >160F).


The twittering (tweeting, whatever) BBQ control program


The Twitter results. The format changed through time as I refined the formatting.


While a twittering BBQ might seem silly, this does act as a proof-of-concept for my plans to integrate a Twitter updating feature in some of my laboratory experiments that run for days or weeks. The Twitter update is extremely easy to implement (see the "Send_Twitter_update.vi" below), at least until Twitter starts requiring a more secure authentication procedure. This can be used to send regular updates to your cell phone via SMS to show that things are running properly or to send alerts when some variable goes out of bounds. The Twitter update vi could certainly use improvements, particularly with how it responds to errors or connection timeouts (it doesn't do anything right now), but the basics are there.

The BBQ control programs and sub-vi's necessary to run them are provided here. They were developed with Labview 8.2.1 and DAQmx 8.9.

The first two vi's will do the basic temperature monitoring, BBQ control, and data recording. The second vi (thermistor_read.vi) contains the parameters for converting voltage to temperature. Those parameters are specific to my setup, and need to be changed for other wheatstone bridge and temperature probe setups.
BBQ_temp_regulation_proto_v4.vi
sub-vi: thermistor_read.vi

The Twitter-updating BBQ control is:
BBQ_temp_regulation_twitter.vi
sub-vi: Prep_Twitter_update.vi
sub-vi: Send_Twitter_update.vi

The "BBQ_temp_regulation_twitter.vi" needs "thermistor_read.vi" to run in addition to the two Twitter-related vi's. If you only want a vi to post updates to Twitter, "Send_Twitter_update.vi" will do that on its own. Just supply it a message, a username, and a password.

Thursday, May 14, 2009

Mussel spawning

I made this little animation a few years back when messing around with getting Mytilus californianus to spawn in the lab. Obviously I was successful at some point.

Tuesday, April 28, 2009

MAGIC isn't real? How can this be?

Someone warn David Copperfield, because the cat's out of the bag: MAGIC isn't real. Maybe this is all one elaborate hoax propagated just to create amusing headlines, but a Korean research team has had a 2005 article in Science retracted by the journal. It turns out that the paper describing their technique, given the acronym MAGIC (magnetic-based interactive capture), was based on missing and/or fabricated data.

Wednesday, February 11, 2009

Equation numbering Word 2007

So I can find this later: setting up a custom equation in Word 2007 that will generate numbered equations with the equation centered on the page and the equation number in parentheses on the right margin.
Office Word Team Blog

Monday, February 02, 2009

Antibodies

FYI for the three people in the world that might care about this. I finally got around to asking Affinity Bioreagents what happened to their MA3-001 Hsp70 antibody that was so effective on various molluscs. It was discontinued in 2006. The info from the customer representative:

"I checked our product files and was able to find information on the monoclonal antibody to Heat Shock Protein 70, the unpurified ascites product MA3-001. This product was discontinued in early 2006 because at that time production was not able to recover good, active antibody that recognized HSP70 by our in-house Western Blot. Because after several attempts we could not produce good product, we were forced to discontinue this clone. At this point we do not anticipate bringing this product back into our product portfolio."

Abandon all hope...

Friday, January 16, 2009

It turns out that you can detect western blot bands tagged with chemiluminescent reagents using a light-tight box and an SLR camera. The first picture below is a Canon 40D digital SLR fitted up against a gel imaging rig. Usually there would be a small digital camera sitting there, and the rig would provide ultraviolet trans-illumination to get enough light to see bands in an agarose gel. In this case I just laid my nitrocellulose membrane on the gel stage, closed the door, shut off all the lights in the box, and clicked off a 1:30 minute exposure on the Canon (f/2.8 ISO3200). The membrane was incubated in GE ECL Plus reagent, which proved bright enough to produce the blue bands in the second picture below. ECL Plus provides peak light output around 440 nm, which gives the bands their blue color.



This is certainly easier than exposing and developing x-ray film, and arguably cheaper than buying a high-zoot western blot digital imaging system from a manufacturer. This could be accomplished with any light-tight box; it certainly doesn't require the fancy gel imaging rig shown above. A shorter camera-to-membrane distance and a faster lens would allow for shorter exposure times (the lens on the camera here is a Sigma 50mm f/2.8 macro, but a cheapo Canon 50mm f/1.8 might be perfect).

Friday, January 09, 2009

Oh dear god...

Apparently cabin fever starts to set in around the start of winter here in Nahant at Northeastern University's Marine Science Center, and weird things start getting posted on the internet as a result. Two videos have started making the rounds (Shifting baselines blog ), one by our own Dr. Long and the other by a group of the Three Seas program graduate students.

"You can have what invert you like"


"Put your box on the rocks"

Monday, November 17, 2008

How high is my field site?

A couple of useful links for figuring out your field site elevations relative to the tidal datum and nearby National Geodetic Survey benchmarks:

NOAA Tides and Currents

You can use the search box at the top of this page to find your local tidal station. If I enter Monterey CA, it takes me to the Monterey Tidal Station page:
Monterey Station ID #9413450

If you click on the "Datums" link on the left-side menu, it takes you to the datum information page for this tide gauge:
Monterey Station Datums
This lists the relative heights of several things, such as Mean Lower Low Water (i.e. the zero tide level), and the height of the station relative to the North American Vertical Datum (NAVD88). These two bits of information are potentially useful, since it tells you the difference between the NAVD88 and zero tide level at this locality. Now if you know the NAVD88 height for another NGS benchmark (say at your nearby field site), you can relate the height of that benchmark to the zero tide level. Over relatively short distances (a few km) in areas without complex bathymetry that messes up the tidal range, you can feel relatively comfortable extrapolating the NAVD88-MLLW difference (NAVD88 is 0.041m below MLLW at the Monterey tide gauge) to your local benchmark. In a place like Monterey, where the tidal range is more or less the same around the peninsula and Monterey Bay, this approximation should work. If your field site was at the end of a long inlet with a tidal amplitude that was substantially damped relative to the tidal range at the nearby tide gauge, this approximation would fail.

If you know the difference between NAVD88 and MLLW, the next step might be to figure out the elevation of your local NGS benchmark. One handy tool for determining this is the NGS's Survey Control Map:
NGS Map
(note that this doesn't currently work in Firefox, but does work with Internet Explorer 7).


That link opens up a map that you can use to zoom in on your field site. When you get zoomed in to your area of interest, click on the "Display Stations" button on the right side of the map. This will overlay the various benchmarks in the area and pop up two more windows, one of which will contain a list of all the benchmarks in view.
In the popup window that lists all the benchmarks, you might find it useful to uncheck the box that says "Always append new". Then go back to the main map and choose the thing that looks like a triangle from the tool menu on the left. You can now click on individual benchmarks on the map, and they will pop up in the info window.


If you then click to highlight the benchmark, and hit the "Get Datasheets" button, you'll get a text datasheet with all the station info for that benchmark. This includes the latitude/longitude and usually an elevation relative to the North American Vertical Datum (88).

In this case, you can note that the NAVD88 elevation for this benchmark is 6.84 m. Since we determined earlier that the difference between NAVD88 and MLLW in Monterey is 0.041m (the NAVD88 zero height is slightly lower than MLLW), the elevation of our benchmark above MLLW at this site is ~6.80 m. In other words, if we descended 6.8m down the shore from the benchmark, we'd be at Mean Lower Low Water. This can allow you to take measurements relative to this fixed benchmark on land over the years without having to do the usual song-and-dance of running down to the current water level, measuring a height, and then trying to guess at what the current tide level was at that time based on tide tables. The benchmark provides a stable reference point that you and others can come back to year after year to make new measurements.

You might want to save the "Pid" number for you benchmark for later reference. In this case it was GU3971. You can use this to quickly retrieve the datasheet for the site in the future using this NGS webpage:
NGS Datasheet PID form

Some other potentially informative/useful sites:

Info and definitions on tidal datums:
Tidal Datums info at Tides and Currents, NOAA

A software tool for converting between vertical datums and among various geoids:
VDatum
VDatum user's guide

Lastly, when looking up the Mean Lower Low Water datum, don't overlook the Tidal Epoch that MLLW is based on. The epoch is explained at the Tidal Datums page listed above. In short, the zero tide level (Mean Lower Low Water) is re-adjusted every 19 years or so. This is done to account for long-term changes in sea level due to a number of factors including sea level rise or local geological processes (isostatic rebound from glaciation for example). We are currently using the 1983-2001 National Tidal Datum Epoch, which went into effect around 2003. Therefore it's not going to change for quite a while, but if you're working with older studies that were referenced to MLLW, the absolute position on the shore may have shifted between then and now. The change in the height of MLLW is specific to a given tidal station, so it is useful to not only note the epoch you're referencing (NTDE 1983-2001) but also the tidal station that your MLLW level is based on, i.e. (NTDE 1983-2001, Monterey, CA).

Tuesday, August 19, 2008

A relatively cheap, relatively water-resistant CCD camera housing



My study on barnacle feeding habits (Marine Ecology Progress Series v.349 p:227-234) required a relatively small video camera system that could be deployed in the intertidal zone and withstand submersion during high tide. The goal was to leave the camera deployed for weeks on end. Power would be supplied from dry land, and the video signal would be sent back to dry land via cable to minimize the need to access the camera housing directly. I eventually ended up leaving the camera deployed in the field for over three years, with just a few interruptions to redeploy it for new projects.

I based the equipment around a small black and white CCD video camera, the Watec WAT-502A (since superceded by the WAT-502B). This is a 1/3" CCD sensor chip in a small package (~2" long, ~1.2" height + width, plus the added length of a lens) that is powered by a 9V DC input, and outputs a standard definition video signal over composite video cable. It has a fairly common CS lens mount. The camera is very sensitive in low light, and is sensitive in the near-IR wavelengths as well, so that you can illuminate an area with IR light at night and still get a usable picture. The newer model is even more sensitive in low-light conditions. The specs for the camera:




The housing I built was based off of a standard 2" PVC plumbing pipe tee. I bought clear pipe for the bling factor. I glued a 2" male slip to 1.5" female threaded adapter into each leg of the tee to allow the use of 1.5" threaded pipe plugs as end caps.



For two of the caps, I drilled, tapped, and mounted a nylon liquid-tight cord grip in the center. The cord grips, which come from McMaster-Carr, are fairly water tight. I used the McMaster part number 69915K62, which will accomodate a wire diameter of 0.08" - 0.24", and uses a 3/8" NPT male thread to mount into the pipe cap. One pipe plug would allow the power cord for the camera to enter the housing, and the other pipe plug allowed the composite video cable to exit the housing and run back to dry land.


The camera was mounted in the third leg of the tee. I machined a custom holder that gripped the camera body and could then be threaded in to the 1.5" NPT thread in that leg of the tee.


The camera holder was threaded far enough in to then allow me to screw in a pipe plug to the same 1.5" thread. This pipe plug had a hole drilled through the center, and a counterbore on the outside face. The counterbore held a round piece of clear Lexan for the camera to shoot through. The Lexan window was glued into place with standard 2-ton epoxy. Lexan (aka polycarbonate) is preferrable to regular acrylic because it withstands scratching and impacts better.

The picture above was taken after several months of deployment. The center of the Lexan window is still clear and scratch-free.

All screw fittings were backed up with some Plumber's Goop polyurethane sealant to add another layer of sealing. The power and video cables were standard household stuff, but I jacketed them in vinyl tubing to withstand abrasion on the rocks.

The entire housing was mounted in the field (see first picture above) by first bolting a mounting plate to the rock. A set of 4 stainless steel band clamps then wrapped around the base plate and the camera housing. This allowed the housing to be rotated in one axis for final positioning.


This system was used in a few variations over the years, including the barnacle feeding study mentioned above. In some of the pictures shown above you can also see the ring of infrared LED's that I used to illuminate a patch of rock at night. This proved to be extremely effective for recording during nighttime low tides, though it would be less useful underwater because the near-IR wavelengths attenuate so quickly.

Some footage from the barnacle feeding study:

More explanation of what you're seeing here can be found in this older post.

Wednesday, June 11, 2008

Another thing I wish I would have known about six years ago

NOAA Coastline Extractor

This is a page that will generate a line drawing of a section of coast that you're interested in. Very handy for making maps and figures. You just specify the lat-lon area you're interested in, and it will return a data file for use in Matlab or ArcGIS etc, and a line drawing that you can save and use.

I found this through a page at Wood's Hole/USGS with a number of handy scripts for Matlab
Main page
including
the air-sea toolbox in particular.

An alternative option is this whole package:
M_map by Rich Pawlowicz