Monday, May 31, 2010

Stopping the BP Oil Spill

Being from Texas, I have been distraught watching the environmental disaster that the Deepwater Horizon Oil Spill has become.  Being also an engineer, I can't help but start brainstorming ideas for how to fix the problem.  Below is a copy of a proposal I have submitted to the Mineral Management Website for technical proposals - it will be interesting to see if I get any response and if so what it is.  I highly encourage others that have ideas regarding stopping the spill or ways to manage the clean up to submit proposals.
While British Petroleum has tried several methods to mitigate or stop the flow of oil from the submerged vestiges of the sunken Deepwater Horizon offshore drilling platform, to date none have been successful.  It is believed highly likely that the relief wells being drilled now will permanently terminate the flow, but it is expected that this operation will not be complete for at least 4 more weeks during which time the size of the spill will double or more.  Below I roughly sketch out a stop-gap measure for significantly reducing the flow of oil form the well head by super-cooling the riser pipe using readily available and inexpensive liquid nitrogen.  British Petroleum most likely already has much of the infrastructure required to do such an operation and assuming the deep-water operations are successful the probability of a significant reduction in flow is high.
Brief Background

Crude oil and two-phase crude oil/gas mixtures have a very strong viscosity dependency on temperature.  At lower temperatures (especially below 0˚F) the viscosity of crude oil and its mixtures increase very rapidly.  As can be seen in the figure I generated below and to the left, the mass flowrate of a fluid through a pipe at constant pressure drop is a very strong function of the viscosity of the fluid flowing in the pipe.  Next to it is a plot of viscosity vs. temperature for a two-phase mixture of light crude and natural gas (as the flow coming out of the Deepwater Horizon wellhead is) at a bunch of different pressures.
Figure on left shows mass flowrate dependency on viscosity of fluid.  Figure on right shows the strong dependence of viscosity in oil/gas mixture on temperature (Right figure credit: Lyons, William C., and Joseph Zaba. Standard Handbook of Petroleum & Natural Gas Engineering. Houston, Tex.: Gulf Pub., 1996. Print.)

If one can control the temperature, and thus the viscosity, of the flow of crude from a well the flowrate can be reduced dramatically.
The Proposal

Using common and relatively low cost industrial materials, components and techniques, a cooling jacket can be applied around the broken riser in order to significantly lower the temperature of the oil flowing from the well.  This will increase its viscosity and lower the flowrate in an accelerating feedback loop:
Several companies make clamp-on liquid nitrogen collars for freezing fluids in pipes.  They are off the shelf cryogenic components:
Cryo-lator pipe freezing collar (courtesy

An alternate method would involve pumping liquid nitrogen directly into the well head below the break in the hope of forming hydrate and extremely thick crude “sludge” that would plug up the riser, slowing or haulting flow:
This method would likely also be worth considering although it would require somehow breaching the riser pipe and installing a leak-tight connection to a very high pressure liquid nitrogen line which could be problematic at these depths.
Required Equipment
  1. Large, clamp-on liquid nitrogen circulator for the riser pipe.  This would probably be a custom component manufactured for the size pipe being used at the sea floor.
  2. Long stainless steel or cryogenic-quality aluminum pipes to transport liquid nitrogen from the surface to the sea floor.  Stainless steel or aluminum are required for cryogenic liquids as they don’t become brittle at low temperatures.  It is likely that much of the plumbing BP already uses is stainless steel so they probably have this available.
  3. Large cryogenic holding vessels for liquid nitrogen.  These are readily available from gas suppliers such as AirGas and could be plumbed together in a large array on a barge.  Alternatively, a cryogenic transport ship for liquid natural gas (LNG) could be filled with liquid nitrogen instead, storing huge amount.
  4. Large cryogenic pumps.  These are commonly used in industry for moving large quantities of liquid nitrogen and liquid oxygen.  They are also very commonly used in the petroleum industry so chances are that BP has ships with these already installed.
  5. Capable deep water ROV’s to install the collar and associated plumbing on the riser.  BP has already been using such devices to try their other fixes.  They should be capable of this operation.
Potential Problems

  1. The single largest reason why this proposal may not work is the two-phase nature of the flow coming out of the well.  Gas mixed with liquid behaves very different than pure liquids and some analysis would need to be done to show that cooling this mixture would reduce flowrate significantly.  It is likely that it would - the plot shown above for temperature vs. viscosity is for a methane/crude mixture with specific gravity .7 and it can be clearly seen that the viscosity is still greatly affected by temperature.
  2. Getting liquid nitrogen to the ocean floor a mile beneath ships requires a well insulated pipe.  Fortunately, this will happen naturally as ice forms on the pipe once liquid nitrogen begins flowing.  Initially only gas will reach the ocean floor as liquid nitrogen boils in the pipes, cooling them down.  This is actually beneficial as well since it will dry out the entire nitrogen circuit making internal ice build-up unlikely.  As the pipes cool and ice forms insulating their outer walls, the liquid nitrogen will stay in a liquid state to deeper and deeper depths until it reaches the sea floor.  Getting to this point will take time and significant amount of liquid nitrogen, but it is an extremely cheap substance as it is made of air.
  3. The ice buildup on the pipes could provide structural problems for them.  Ice is less dense than water so it would provide a buoyant force trying to pull the pipes upward.  Analysis would have to be done to show that the pipes are strong enough to withstand this.
    While there are some potential pitfalls with this proposal, it seems to have enough merit to at least warrant further analysis by those in charge at BP and the federal government.  It is my hope that by writing this white-paper, someone will take notice and at least consider this as an option.

    Monday, October 12, 2009

    It's Alive!

    I've made a lot of progress since my last post.  You'll have to read for the long version, but the trailer is that the CNC gantry router is now semi-operational and has been used for an actual project.  Here's how it looks as of last night:

    Operable 3-axis gantry router in my garage

    Yes, it's still a bit of a mess with wiring all over the place.  You know the old joke such-and-such is the technology of the future and always will be?  There should be some corollary related to cleaning up a  project once its working and begging for new features ("Cleaning up is the next step and always will be?").
    The astute observer will notice a few changes since the last post.  The long 3rd axis which I have designated "Z" is now mounted securely to the overhead gantry and the router is mounted to it.  The especially astute observer will also note that the router mounted is not the $22 harbor freight special I mentioned in my last post but a $80 DeWalt.  I'm sure no one saw that coming. More on this later....

    Shot of the mount location for the Z-axis

    Mounting the Z axis required a little custom hardware.  As can be seen in the picture above the carriage on the X-axis consists of a flat piece of stainless mounted to the linear bearing below and to the ball screw nut via a bracket on the right (viewing from the front of the machine).  Since the picture I have removed the tall upright piece of aluminum with the big rectangular hole in it along with the black chunk attached to the back of it.  This left the flat piece of stainless with two threaded holes in the top to mount the Z axis with.   The 3rd axis already had a nice custom-milled mount with two screw holes on the bottom so all I needed to connect it to the X axis carriage was a an angle bracket.  Since the 3rd axis is so long and heavy and this joint is fairly critical to the stiffness of the machine, I decided to make this bracket out of 303 stainless rather than aluminum.  I know, probably massive overkill but I have had bad luck with small threads in aluminum stripping anyway and making this block out of stainless solved this problem as well.

    An angle-bracket only an engineer could love

    I realize it is probably difficult to visualize how it all fits together.  The bracket shown above sits on the flat stainless steel block attached to the x linear bearing.  There is one hole barely visible on the left side of the base of the bracket which is where one of two screws go to attach it to the flat stainless piece. The two holes on the vertical face are threaded to receive screws that penetrate through the 3rd axis mounting bracket.  Anyway, the details aren't terribly important - here's how the assembly looks together:

    3rd axis mounted on gantry.  The ball screw which is vertical in the picture is actually the x-axis and the third axis is mounted to the left.  You can see the angle bracket shown in the picture above right in the middle of the picture.  The 3rd axis mounting bracket is the black anodized piece immediately to the left of the angle bracket.
    Once the third axis was mounted I had to attach the router to its carriage.  Attaching to the carriage is relatively straightforward as it has 4 threaded holes.  There are a million ways one could hold a router.  I think the solution I came up with is a very good combination of simplicity and rigidity:

    The router mount

    What you are looking at is an aluminum plate with 4 mounting holes, a 90 degree V-slot on the left half and 4 slots for hose clamps.  Hose clamps are really good at holding round things (like a router housing) and the V-slot functions both to align the router body vertically and to "dig in" a little to keep it from rotating.  When the two hose clamps are tightened down, the router is held very securely.  The four counter-bored holes on the right are for attaching the mount to the Z-axis carriage.

    So I originally designed this mount for the cheapo harbor freight roto-zip tool I bought for $22.  I made the mount, put the rotary tool on and started cutting.  After breaking 3 small diameter drill bits trying to drill in a PCB, I took a closer look.  I rotated the bit in the tool slowly and to my horror saw the end wobbling back and forth by as much as 1/8".  My first thought was that the collet was no good so I went to Home Depot and found that the Roto-Zip brand collets do in fact fit in the Harbor Freight knockoff but the runout was as bad or worse.  So pulled the bit and collet out, whipped out a small dial indicator and indicated the inner surface of the collet holder on the tool.  It was about .007" out of concentricity which doesn't sound bad, but is if you consider that this will be multiplied the further out the tool gets.  Then I put the collet in with a tool and measured the runout on the tool.  Same order when considering that I was measuring further from the probable axis of the eccentricity - something like .010-.012".  Then I tightened down the collet nut and the runout went to .038".  So it appears that either the nut or the bearing tapers on the collet is terribly non-concentric on this tool and when you tighten it down it just goes to hell.  Rather than screwing anymore with the stupid I think, I just went to Lowes and bought a $80 DeWalt laminate router.

    DeWalt laminate router mounted in the holder

    The one saving grace of the Harbor Freight tool was that the motor section of it was cylindrical.  Good luck finding a new consumer-grade handheld tool resembling anything close to a pure conic-section these days.  Thank Apple or Ideo or someone but every damn tool I looked at had some big "ergonomic" bump or groove or taper or curve which made holding it mechanically hard.  The DeWalt was the closest but but it's body was still tapered towards the cord-end.  In order to get it mounted with no significant angular misalignment, I clamped the mount plate down on a mill, threw a 1/4" dowel pin the router tool holder and ran it back and forth under a dial indicator.  Initially there was about .8 degree of misalignment, but by shimming the cord-end up with some stiff EPDM rubber, I was able to get this down to less than .1 degree.  I also measured the runout of the tool holder with the same 1/4" dowel pin. At a distance of about an inch from the face of the collet nut, the runout is less than .002" - pretty darn good.  Unfortunately it only has a 1/4" collet so I had to get one of those stupid 1/4"-1/8" adapters for the little tiny 1/8" cutters I bought.  The runout was worse with the adapter, but still a huge amount better than the harbor freight tool.  And the result was that I was able to drill PCB's!...

    This was the first thing I cut so I had everything turned down a lot - rapid is slow, feed is slow and I had the router running on 24VDC from teh power supply to keep the speed (and noise) down a bit.  But it worked!

    The drilled PCB

    I did have a bit of trouble getting the step/in ratio dialed in on the different axis'.  Apparently whoever designed the machine decided it would be a good idea to use 10mm pitch lead screws for the Y and 3rd (my Z) axis but a .2 inch pitch for the X-axis.  The combination of metric and imperial screws made my head hurt for a few minutes and resulted in a few misaligned holes in the above PCB, but I think I have the issue ironed out now.  I don't know what kind of masochistic designer mixes imperial and metric, but note to self - don't do it.  I got the general feeling in looking at the design of the machine this started as that the designer had never touched a machine before but was probably real comfortable plugged into a  CAD station for 8 hours a day.
    So high off my first success I embarked on cutting something.  I threw in the cheap, dull and wobbly (yes harbor freight) 1/8" end mill I bought and double-stick taped some balsa wood down the the laminate table I made.

    Results are not terribly bad considering the tool.  I switched to a somewhat better small diameter tool and cranked up the feed rate a little.  The result was noticeably better:

    Cutting a balsa circle on a cnc router

    Finally I decided to do something a little more complex.  The EMC2 website has a very good list of open-source CAM codes.  I have always wanted to try the Inkscape GCode converter plugins so I downloaded the python scripts, threw them in my Inkscape Extensions directory and fired up Inkscape.  It took a little tinkering to get some of the python dependencies right on my Inkscape installation since it includes a lot of pre-compiled shared libraries that I had elsewhere on my system.  Suffice to say it was a slightly aggravating, but not harrowing by any means, experience.  Since GCode is all lines and arcs, the GCode export script will only export paths made of line segments.  So you have to make sure to convert text to paths and bezier paths to line segments only (which is documented on the Inkscape GCode page).  Here's what I came up with:

    And here's the result:

    Text engraving using Inkscape for Gcode generation

    Not bad for a first evening of routing!
    The next project (aside from cleaning up wiring of course, ::cough::) is to build a speed control for the router.  To quote my friend John Lawler, the router sounds like a million souls dying when running at full power.  And there are probably a lot of situation where you want a) lower speeds and b) regulated speed control.  Definitely if I decide to try milling some aluminum on the set up.  So the PCB shown drilled above is to do PWM control of the router motor with an AVR Mega32.  I still need to figure out a tachometer scheme for the router motor and one thing I am a bit intrigued by is the techniques described here, here, or here.  The idea of using brush commutation EMI to measure speed occurred to me but of course was not unique and a search on Google Scholar turned up the links above.  I may just try it...

    Sunday, September 27, 2009

    Building a table-top CNC router

    I've been looking for a project to do in my spare time for a while now and the one I've always had on the back of my mind is a 3-axis gantry CNC router. A CNC gantry router would be a really nice tool to do things like cutting and drilling PCB's, machining small aluminum parts and for my wife to surface jeweler's wax with. At work I used EMC2 and some Probotix stepper controllers and stepper motors to retrofit one of our small lathes. It turned out great, was a pleasure to do and ignited an even greater hunger for CNC machinery in me.

    A shot of "the thing" after I had taken the imaging mechanism off the X-Y gantry

    What finally catalyzed my initiative to begin was a gadget I found at a surplus warehouse in Morgan Hill, CA that was both a huge bargain and about 80% of the hardware I needed to build the thing! I'm a little bummed I didn't take a picture of it before I began stripping it down because it was a pretty interesting contraption that I think came out of
    some kind of optical inspection equipment. But you can see a crappy picture of it post-partial-tear-down above.

    It consisted of a 2-axis stepper/ball-screw gantry with a high quality computer vision system camera mounted to it facing downward. The camera was pointed through a slotted aperture with about 30 red SMD LED's all around it to illuminate the subject. The whole camera assembly could be swiveled 90 degrees with a rotary pneumatic actuator (so really a 2.5-axis gantry or something). A third stepper/ball-screw axis was separately attached to the base and had a pneumatically actuated gripper to grab whatever was to be inspected I suppose. I imagine the thing came out of an electronics quality control machine in a fab somewhere here in Silicon Valley, but that's just speculation. So here's what I got for my $200 bucks:

    1. 3 good quality Pacific Scientific unipolar stepper motors
    2. 3 working Centent CN0162 microstepping stepper controllers - kind of an old design but those babies were like $500/each new 10-15 years ago.
    3. 3 ball-screw linear axis assemblies with high-quality linear bearings. Ball screws, for those that don't know, are wonderful for CNC because they have almost no backlash. Essentially all high quality CNC machines use ball screws.
    4. A rigid custom-machined aluminum gantry attached to a ~24in x 20in 1/2" aluminum base
    X-axis ball screw

    Centent CN0162 Microstepping controller (1 of 3)

    In addition, I can get about $150 on e-bay for the camera (which I have no use for right now) so the out-of-pocket cost to me was about $50.

    The thing that really blows my mind about this thing is how much money was spent making it
    initially. Ball screws aren't cheap and all of the sensors and other components are extremely high quality. The whole thing is made of custom milled aluminum parts bolted together. You can see at least 8-10 of these parts on the separate 3rd axis to the right. I did a rough tally of the 3rd party components in the device and I got a number in the $4000-$5000 range. With all the custom machining on top of that, this thing cost somebody $10k+ to build.

    Anyway, I mentioned earlier that I had used EMC2 at work retrofit a lathe. The EMC2 LiveCD makes installing it on an old computer brain-dead and the only downside I can see is that you need hardware with a parallel port. In looking around the web a bit I noticed that the hard-core machine retrofitters all use EMC2 for control while the hobby/tinkerer/Arduino crowd are much more attracted to RepRap software and controls. I imagine this is due to the respective origins of the two projects but it's a bit unfortunate because I see some replication of effort between the two projects. Yes, RepRap is a FDM system and EMC2 is a general purpose machine controller, but I've seen at least one project (RepRap Cartesian Bot) doing 3-axis router control with RepRap. I actually really like the new RepRap control architecture but I chose to go with EMC2 because:
    • I'm familiar with it
    • I already have stepper controllers that will be easy to integrate with a parallel port interface
    • It will run a full-featured G-Code program (the RepRap's G-Code interpreter is fairly limited as far as I can see)
    • The AXIS interface to EMC2 is extremely nice and customizable using Python
    The eventual goal of the project is to have a full functional 3-axis router that is versatile enough to cut anything from foam to aluminum and is robust enough to do some real precision work.

    Progress To-Date

    The first thing I set out to do was strip the machine of everything I didn't need for the router and get it set up in my garage with the computer that would be controlling it (my wife's ancient HP from college).

    The setup

    EMC2 is very well setup for stepper motor control has a nice GUI tool called stepconf wizard for setting up the parallel port I/O and relevant timing for the stepper controllers.

    Stepconf wizard. Credit AXIS website.

    The Centent controllers have optoisolators on the step and direction inputs and while I suspect the parallel port would have been able to drive them, I went ahead and used a ULN2803 darlington array to drive the optoisolator LED's. The anodes of the optoisolator LEDs are tied to the 5V supply and the step and direction inputs are connected to the cathodes making them ideally suited to be driven with an NPN transistor array such as this.

    Schematic of parallel port output buffer

    After a bit of tinkering and one fried 7805 voltage regulator, I got the all three axis of working with EMC2.

    The prototype wiring. The ULN2803 and 7805 voltage regulator are both soldered to the prototyping PCB on the right. It will be cleaned up later...

    Just for the heck of it I taped a permanent marker to the gantry and used it to draw the EMC2 AXIS logo. It came out surprisingly well considering the marker was not held very well and the cardboard was flexing in the middle.

    Worlds worst pen-plotter

    Check out the video...

    The next step is to make a rigid mount for the third (Z) axis on the gantry assembly. The third axis is pretty heavy as it exists now and I'm a little concerned about whether the XY axis will be able to control that much momentum. If worse comes to worst, I can machine off a lot of the material on the Z axis or even shorten it a bit to make it lighter.

    The z-axis is a heavy beast

    I spent a long time thinking about what to use for the spindle. On e-bay you can find some high power water-cooled router spindles but they're a bit pricey and, because they are 3 phase, require a variable frequency 3 phase drive. A water cooling system is not the end of the world, but it adds complexity. Dremel tools are often used, but they're probably underpowered and possibly not up to machining aluminum. I was at Harbor Freight the other day and saw this "Electric Cutout Tool" for $25. They also have a small handheld router for $22. Now I'm not saying that these are any more up to serious cutting than a dremel tool, but the cutout tool has a 1/2 hp motor in it and for $25, how can you go wrong?

    The $25 harbor fright, I mean freight, special. What could go wrong??

    Once I finish mounting the 3rd axis to the XY gantry, I will work on mounting the cutout saw. Because the saw uses a universal motor, doing speed control with a microcontroller should be fairly straightforward. I'm planning to use an AVR to do feedback speed control using speed set points from EMC2. I will probably used rectified PWM control rather than phase delay AC control in order to get better control properties and higher torque. I may even make the control board Arduino compatible... but we'll see. More on this little sub-project later.

    Sunday, December 9, 2007

    RF Nikon Remote Shutter Release

    Nikon digital SLR's have become very popular as of late, and deservedly so.  They are wonderful cameras.
    I recently purchased a D40x which I am utterly happy with and have had great fun taking some really wonderful pictures with it so far.  The one disappointment I have had with it is the inability to trigger the shutter remotely in a simple way.  I am frequently involved in rocket testing and there is a fundamental conundrum with getting good pictures of a rocket motor firing - the camera wants to be close, but you don't!

    A 250lbf. rocket firing.  You can imagine what the 14,000lbf.
    one we will soon be testing looks like...

    Having looked into it a bit, it seems that few of the new digital cameras are easy to trigger remotely easily.  When I say easily, I mean 

    Here's the phone jack, when you complete the circuit the camera begins taking pictures.  When you break the circuit, it stops.

    If it were that easy, I could just run a 2 conductor wire out to my camera with a switch on the other end.

    Nikon sells their ML-L3 infrared remote trigger which, while inexpensive, requires you to be standing in front of the camera at relatively short range (<10m)>

    So I set out to build something better and the first thing I found is that there are others who have had similar ideas...

    Jan Wagner cast his in epoxy and referenced Big Mike's page on the protocol.  Big Mike even has AVR (my favorite) source code up.  Unfortunately I planned on using the ATTiny15 rather than the ATTiny2313 that he used and since the tiny15's internal RC oscillator runs at 1.6mhz only, I would have had to re-write a fair amount of his delay code to get it going.  Instead I decided to just re-implement the protocol from scratch, which really isn't very difficult.  My code simply repeats the IR command every 65ms or so as long as one of the input pins on the AVR is held at logic high.  It also flashes a visible LED to indicate it is transmitting.  My source code is here.

    Anyway, rather than having the thing hard-wired, I wanted to make it RF trigger-able so that I don't have to worry about stringing wires around every time I want to take some pictures.  I found this very nice little module at  $19, good range, two transmitters in case I loose one and (as it turns out) very simple to hack.
    The device is designed for automotive operation so the main switching
    relay in it has a 12V coil.  That is all well and good except that it is kind of a pain in the butt to get 12V in a small device without some kludge like 8 AAA's, two 9V's or one of those expensive little 12V remote batteries which would probably last all of 5 minutes holding the relay open.  Luckily, when I received the device and opened the receiver up, it was beautifully simple and easy to mod:

    The receiver consists of a 5V regulator, a radio module (the little board perpendicular to the main board), a decoder IC, a switching transistor and the aforementioned relay.  The radio and the decoder IC both are 5V devices so the 78L05 regulator simply takes the 12V supply and conditions it for these two components.  The switching transistor is used to power the 12V relay using the 5V logic level signal from the PT2272 decoder IC.

    But I have no desire in using the relay at all and it is the only component that needs 12V so I simply desoldered it and the switching transistor leaving me a nice clean 5V logic level interface and a voltage regulator so I can use any supply I want > about 6V.

    Note that the board is clearly marked where the ground wires are soldered and the connection labeled "IN" is the 12V (or now anything > 6V) supply.  My AVR IR transmitter requires a 5V supply and a 5V logic level signal to tell it when to become active.  I pulled the 5V supply off the back side of the circuit board along an easy-to-access trace associated with the 12bit coding of the PT2272:

    Note the white wire soldered along the far right side of the jumpers.  This is the 5V supply rail from the 78L05.  If you are confused about which trace, follow it from the 78L05 itself.  I soldered a 9V battery connector directly to the "IN" pin and one of the "GND" pins on the board and the modifications to the receiver module were complete:

    I soldered this to the AVR board, crammed it all in a RadioShack plastic project box with the LED, the IR LED, the battery connector and the blue antenna wire sticking out and it is finished.

    Here is a picture I took from about 100 feet away:

    I believe the range is significantly further than this as long as the antenna is well unfurled, but I haven't tested the theory.

    Monday, September 17, 2007

    Across this line you do not!

    what a dork:

    was that his wife? surely not. as things turn out he was not the only dork at the nextfest. one group had brought an amphibious car that ran on tank treads and looked more like the doodles from some 6th grader’s notebook from 1956 than a serious transportation scheme. another group had set up the robots that you have seen in commercials building cars since 1985 to play vinyl records. another quantum leap. a japanese team had built a door of perhaps 32 sticks on either side of the door which met in the middle of the entranceway and could be retracted into either side of the doorframe. apparently sensors would determine how wide the person entering was at 32 discrete points and then open the sliding sticks the appropriate amount. this would, in theory, leave a "you" sized hole to walk through as you marveled over the wonders of modern technology. however, more often than not it would leave one bar extended at balls level, leaving the test subject to shimmy through sideways while praying to god almighty that the stick behind him did not slide shut, impaling him on the bar never retracted. maybe my understanding of the world is just a bit off; maybe these are pertinent technological developments. maybe that was his wife.