Saturday, May 19, 2012

Productively Slacking Off

We all slack off.  I'm actually amazing at getting things done - despite the fact that I slack off nearly all the time. Remember how I was supposed to write about developing for microcontrollers?  Yeah I didn't do that (yet). Wanna see what I did instead?

This is an awesome... uh... thing?
You might be wondering what this thing is.  Well, do you know what this thing is?

It's a hookah!
It's a hookah!  It's also called a water pipe.  This is because the bottom is filled with water and a pipe coming from the top extends beneath the water level.  On top is a clay bowl filled with shisha - tobacco mixed with flavored molasses. Popular flavors include rose, mint, plum, apple and my personal favorite: guava.  Lit coals are placed on top of the shisha and drawing air through the hose causes the shisha to be (theoretically) nicely and evenly burned to produce pleasant smoke.  Hookah started in India and moved across Iran and into the Middle-east before it broke out into the world at large.

Hookah used to be one of my favorite vices.  But nowadays not so much.  Tobacco is bad for you no matter how you smoke it - simply filtering the smoke through the water in the bottom of the hookah doesn't reduce any of the carcinogens to any level that could be considered 'safe'.  Plus I started to just not enjoy it.  I tried as hard as I could to get a great hookah going.  I ditched self-lighting coals - the chemicals on them tasted horrible.  I used natural, less-processed coals despite the fact you need to light them on a range burner.  They tasted better and produced better, fuller smoke.  The only problem is that they get so hot that they burn the shisha under them badly and quickly.  Or the air flow would be so bad they don't really start burning well at all and none of the shisha gets burned at all.  That's wasteful.  A good, well lit and packed hookah can be enjoyed for maybe an hour.  My typical experience these days is either everything burns up in 15 minutes and produces acrid, thin and disgusting smoke, or everything remains unburned and no smoke is produced at all.

I don't enjoy that at all.  The hot coals are theoretically good, but they require adequate air flow and some method to moderate the heat they produce..  That thin layer of tin foil separating the shisha from the coal typically has many small holes that produce good air flow (if the coals aren't blocking them completely) but don't moderate the heat at all. There are metal plates that can be used instead of or with the foil to provide a somewhat larger measure of heat moderation.  The problem with them is that they are thin and have large air holes in them.  Thin means they provide a low level of heat moderation and large air holes means that air flow isn't directed around the coals to keep them lit. 

In short, none of the available solutions is very effective. 

As an engineer I feel I can't let this situation stand.  How difficult can it be to create some sort of metal grate that will distribute the heat of a burning coal while still providing good air flow - and additionally providing some means to ensure the coals don't slide off the bowl and leave burn marks in your carpet - such as this:


Well hard is it to design something like this?  I'm an electrical engineer, so I don't really know anything about, well, I'll make a list:
  • Materials - What kind of metal will have good thermal conductivity and has high machinability characteristics but not produce, say, any poisonous gases when exposed to the heat of a lit coal? Where do I even buy all this material?  Aren't there a lot of different options?
  • Machining - How is such a thing as this made? I've seen a CNC mill, but I don't own one, know how to use one, or even know what sort of information I need to give someone to be able to make something using one. What sort of tolerances can I expect?  Can I design something with .01" dimensions and expect that it will come out right?
  • Cost - How much will this be?  How do I make it less expensive? 
In short, I don't know a whole lot.  So, I start with what I do know.

I have three different hookah bowl types.  I want this thing to sit nicely and securely inside the bowl and not move around.  So, first step, measure the inside diameters of each of the bowls so I can figure out what sort of lip I need to design into them.  For measurements like that you need every engineer's best friend:

If you don't own one of these, buy one.  I'll help, clicking on this link makes me happy: 6 Inch LCD Digital Caliper with Extra Battery and Case  My favorite part about that one: the supplier is 'Generic'.  I love China.  You can measure anything with these very accurately.  Saves your life when doing anything mechanical.  They're great for PCB work - particularly for drawing your own footprints. 

So this starts me off with at least some idea of what I need to make.  Let's start drawing something.  I could go old school and start off with pencil and paper but this is the 21st century.  We have computers with CAD software - but which to use?  I've never had to do any mechanical design like this before. 

Lucky for me I've been at this a while.  I can't even remember where I heard of it first, but I knew that eMachineShop.com existed.  It's something like PCB123 or ExpressPCB but for mechanical parts.  They provide you with free CAD software that is capable of:
  1. Drawing out what you want to make
  2. Generating a 3D rendering of your design (very useful)
  3. Deciding what machines/processes would be suit your widget
  4. Presenting you with a list of materials with information on machinability, typical uses, cost and other information as well as making limited recommendations about which materials to use for your design.
  5. Calculating the cost and delivery time for your part right from the program.
  6. Placing an order for your part.
eMachineShop.com handles most of the hard stuff - ordering material, machining it, finishing it and shipping it to you.  The software takes some getting used to, but since I have a limited mechanical design background (let's hear it for growing up on a farm and... playing with Legos!).

I eventually decided on a design that looks a lot like the picture above.  It will be made from 316 stainless steel (the same type as is used in pots and pans - that should be pretty safe) and fit three different bowl types.  On the inside there are ridges that the coals sit on top of.  In the troughs of the ridges the holes will be drilled.  These holes in the troughs allow air to flow freely over the coals - the holes will never be completely covered by the coals because the coals can't fit into the trough.  This fixes the airflow problem.  The bottom plate is about a quarter inch thick still - this will spread the heat out and not just burn the top layer of shisha to cinders.  And the walls are an inch and a half high to prevent coals from falling off (and helps to block drafts).  Overall I'm rather pleased. I think I could use about 3-5 of these as a prototype - I'll hand some out to my hookah-smoking friends and get some feedback.  So how much will it cost?

Oh, only $500 for three of them?  Well, at prices like that I might as well get a dozen eh? Now don't get me wrong - I think this idea actually has product potential.  I'm up for investing in a prototype if there's a payoff, but no matter how many units I pretend to buy (I went all the way to 10,000 units) the cost/unit is still around $30.  I'd have to sell it for around $50 and for that cost I wouldn't buy it.  Something has got to give.  Perhaps I can talk to local machine shops and see if I can get cheaper machining?

This isn't a bad idea - there are plenty of local machine shops.  I hate calling people, so I use email.  I narrowed the list down to about five that I actually liked.  What was my criteria?  Basically, how amateur their web page looked.  No, I'm not joking.  Places that talk about machining parts for the space shuttle?  No thank you.  Places that talk about making awesome chrome instrument panels for your motorcycle?  Yes please.  Places that discuss ISO 9e8 quality processes and micron-level attention to detail?  Sounds expensive.  Places that have pictures of  bearded men wearing leather gloves inhaling metal shavings? Now you're talking my language.  Places that say they'll work with you and specialize in prototype production runs?  Yes!  Look, I'm an amateur, but I'm not unprofessional and I'm not looking for a disreputable machine shop.  I'm looking for the one that will understand my plight the most - forgive my crazy unrealistic demands, help me decide what materials are safest, hold my hand through the difficult and unknown process of machining metal.  I'm in unknown territory and I'm looking for the people that will have the most patience and tolerance of a difficult designer meandering his way through a low-profit job.  I'm looking for someone humble and helpful. 

Luckily, the eMachineShop software can produce DXFs, and from what I understand about mechanical design, that's a thing.  So I proudly send off my DXF, acting all professional with my talk of what materials and processes to use (entirely cribbed from the eMachineShop software mind you).  And they get back to me very quickly!

'Uh, we don't really use DXFs, can you give us a PDF drawing or something?'

'Do you have an STL file?  Or maybe a PDF with measurements?'

'Can you maybe draw it out... and send us a PDF?'

What?!  Don't these people realize that we're in the 21st century?!  That's practically the future!  Fine - you know what?  My dad taught me how to draw things out, I have graph paper, I've seen mechanical drawings and I know how to measure.  So bring it on!

I printed out a cross-section from the eMachineShop software, sat down with my ruler and mechanical pencil and started marking out measurements.  And boy, was it a mess.  My design was absurdly over complicated.  I had angles other than 90 degrees all over the place (but they looked pretty!).  I had about fifty different measurements to mark when only about 4 of them actually mattered.  I just plain didn't align anything to anything else - wherever I had the choice to line up two lines I just didn't. It didn't matter - the software made it seem like all design decisions were equal and it's all getting built by machines anyhow.  If the Design Rule Check doesn't complain, who cares?

But now I was dealing with people.  People who would have to do more work to handle my absurd design.  People I would actually have to talk to.  Most importantly - people I asked for help.  Who might criticize my design.  I wanted to try extra hard to do the best I could - you know, to avoid embarrassment.  There will probably be plenty of that anyway given how little I know about mechanical design.

So I go back to the drawing board.  I have my important dimensions, so I start with those, but then I start aligning everything together to make it a more organized, simpler mess than before.  I also do a bit more research into materials and find some interesting information. Did you know that aluminum is less expensive than stainless steel?  Heck, most things are less expensive than stainless steel.  More importantly, anodized aluminum is used in cookware - high heat tolerant and still people-safe!  And wouldn't you know it - eMachineShop offers anodizing services and there are several local shops that will too.  Now, with the less-complex design and different materials even the eMachineShop price per unit at 100 units is about $13.  This is much more lucrative to sell.  Plus, anodizing aluminum means you can color the metal.  Everyone loves color and everyone loves choosing colors - very customer-worthy.  Aluminum also cuts down on weight, which cuts down on shipping.  It's a win-win-win situation.  Here's the revised, simplified design:

Look at that lovely handwriting!
I'm still waiting to hear back from everyone, but at this point I don't care if local places are less-expensive than eMachineShop.com - it's all pretty good.  I can even buy material easily - you can buy aluminum stock from Amazon.com!  If Amazon doesn't have it, McMasterCarr does - they're basically the Digikey of mechanical components and materials.  This summer - one way or another - my beta-testers and I will have a product in our hands.  If it's worthwhile, look for this on Kickstarter some time after.  I'm hearing a lot of interest just around the water cooler.  I'm told hipsters will love it. 

So, for any electrical engineers wanting to try their hand at mechanical design, here's some bullet points to get you started:
  • Get a good set of digital calipers
  • Sketch everything out on paper to start with (use pencil, not pen)
  • Minimize the complexity of your part by minimizing the number of measurements it takes to describe it
  • Use the eMachineShop software for help with manufacturing processes and materials and a quick price-check
  • Use Google to look for local machine shops - they've been nothing but helpful to me so far and potentially less-expensive than online shops
See you on Kickstarter!

Sunday, May 6, 2012

Scientific Zombies

I used to think of lots of big ideas back in college.  I'd think of things like 'Hey, let's use genetic algorithms to evolve a fuzzy logic model of a person's psychological makeup so that we can simulate what would REALLY HAPPEN in a zombie epidemic scenario!  For science! And to watch a bunch of dots on a screen run away from other dots that are zombies!  Realistically!'

Yes, that was a real project I had.  That was the goal anyway.  A friend and I convinced a teacher to give us credit for a semester-long special project where we created  a project titled "FUZZY DECISION MAKING IN A CELLULAR AUTOMATA-BASED EPIDEMIC DISEASE SIMULATOR".  At least that's what the cut and paste from the abstract says.  Yes, abstract - we presented this at a real symposium where real people (presumably professionals) nodded their heads and clapped.  Now of course we didn't say it was a zombie attack simulator - we instead chose a real disease (you know, to promote actual science instead of awesome science).  But they thought the idea had merit!  I wasn't boo'ed off stage at an event where people are supposed to say smart things.  I must have said smart things!

I know what you're going to ask next.  No, we didn't finish it.  Not finish it finish it, but we had both parts of it.  He could simulate the airborne dispersal of a disease and its incubation in people and I created a person who could have his own little day:  When he's tired, he slept.  When he was hungry he would either go home to eat if he was feeling antisocial or poor, or to a bar to eat if he was lonely.  When he ran out of money he went to work - not exactly a perfect model, but for an automaton that basically just implemented the first three layers of Maslow's Hierarchy of Needs it showed some very human behaviors.  I not only said smart things, I think I did a few too. 

I don't think I can say smart things anymore.  Pretty sure I can't do them either.  Not unless sitting on the couch watching Law and Order is a smart thing (geez, way to ruin my life Netflix...). Have I lost the knack?  Hey, you don't know if you don't try right?  So as a big idea pops into my head I think 'I wonder if anyone else has done this - if they haven't, I could get rich.'  Let me tell you - if one thing can get me away from Law and Order it's a whole crapload of money.  I'm just sentimental like that

Let me explain the idea.  One of the problems with linear controllers is that their performance becomes much worse the farther you move away from the operating point for which they were designed.  The operational range of a linear controller is conversely tied to performance: smaller range - better performance, larger - worse.  This is because plants tends to look more like a perfectly linear systems the smaller your operating range is.  The more linear your plant is, the easier it is to control - but only within that range.  If you can prevent the system from operating outside that range then you're fine.  But no one is going to accept a solution that can perfectly control a piston - as long as its maximum extension is no greater than 1 inch.

We can't avoid trying to span a wide range of operating conditions with a single linear controller, but we always want better performance.  How can these two be reconciled?  My Big Idea is to use two linear controllers optimized for different operating points in the wider operating range and use a fuzzy logic controller to combine the outputs from both into one controller that has better performance over the whole operating range. When near either of the two operating points the fuzzy controller would largely cede control to the appropriate linear controller, but if it is operating between them the fuzzy logic controller would combine the outputs of both to some degree.   Using two controllers in this fashion would theoretically give better performance over that wider range if you can tune the fuzzy controller to provide a smooth transition between the two controllers.  So has anyone figured that out?  Was it a smart idea?  Do people like me?

Truth is I have no idea.  I started Googling and  found this.  It's very interesting but I can't at all tell if it's what I wanted to do.  Is it just me or were textbooks always this hard to read?  No, don't answer.  If they were engineering textbooks then yes, they were always this hard to read.  Teachers were just as difficult to understand, had the same propensity to stare off into space, to offer unhelpful explanations or simply not offer any at all.  And we were the ones being graded.  It mattered to us that we could understand those inscrutable papers and confusing textbooks.  Our whole purpose for being  in college was to leap those academic hurdles.  Or, I dunno just run right through them.  Whatever gets you to the finish line since (as we all know) 'C's get degrees'.

I feel like I'm not going to get anywhere with books like that and quite frankly I don't have to care anymore even if I really want to.  I have my degree so I'm off the hook.  But it does make me ask: who is right here?  Who is the smart one here?  Does my idea have merit?  Are those textbooks full of greek letters and dry mathematical drivel necessary, or is my frank yet wordy description above preferable?

I think the most fundamental question here is was our zombie simulator fake science one second and real the next just because we changed a few parameters in the disease model, wrote an abstract and slapped together some PowerPoint slides?  Was it because people nodded and clapped?  What if they were just being polite?  Why does polite clapping at a symposium make something more scientifically legitimate than a million 'Hells yes zombie attack simulator FTW!!!11!' comments on the internet?  Can't those comments be coming from scientists?  In fact I have a sneaking suspicion that if we had presented a zombie attack simulator at that symposium we would have had that exact reaction from the scientists present. And it didn't require foaming at the mouth about  epsilons and solution spaces and lots of other mathy jargon. 

Can't normal people have good ideas?  Ideas that smart people think are good?  Can't we explain them without trying to confuse one another?  With compassion and caring - compassion in that the person on the other side of your explanation is a poor person who probably isn't nearly as smart as you but is making every effort to try, and caring in that you do everything you can to help that person understand?

There is an amazing opportunity in this country (and possibly across the world) for individuals - hobbyists, lay-people, the proletariat - to contribute to scientific progress in a real way.  Never before have we had so many educated so well.  A college degree doesn't make you a genius but it gives you something - no matter what you studied.  It is far better than not having it and today more people have a college degree than ever.  Today, more people than ever have a computer - a computer that can calculate in hours or days what a computer fifty years ago could calculate in decades.  A computer that can look up almost any fact for you. The same programming languages that run aircraft and space ships are free for you to use.  Oh, you can't make an aircraft?  Yes you can (top three hits for 'kit aircraft' on Google).  It's expensive and I'm sure time consuming, but saying it's impossible?  And who's going to tell you you can't build a space ship.  These are things that hobbyists are doing.  There's more support than ever now to do whatever you want.  Maybe you want PCBs made?  Or you need help having mechanical parts fabricated? Oh, but where will you get funding for all of these amazing ideas?

The barriers to doing things that matter - like real science and technology - are lower now than they've ever been.  But you still have sides.  On one side you have hobbyists trying everything they can as hard as they can, filled with questions and looking for a place to make a real, helpful contribution to something greater than themselves.  On the other you have symposium-goers.  People who focus on publishing in peer-reviewed journals, double-checking results, navigating scientific political squabbles and generally becoming known and respected.  But these two sides are not in opposition to each other.  Both have the same goal: scientific progress and the betterment of mankind.  The only difference is in their temperament (and how much they get paid). It's not a question of real science vs. fake science.

As we go forward the ability of hobbyists and other scientific lay-people to contribute to scientific discussion will have nothing but positive benefits for both sides.  Professional scientists should take steps to make their research more accessible by anyone with a passing interest.  But we must not think that science can be handled by hobbyists alone.  The rules of process that seem stifling to many hobbyists are a necessary part of the scientific method.  Hobbyists need to respect the scientific process because that is ultimately what keeps us honest. The best case scenario for everyone is not to choose sides and see which wins, but to respect the necessity of both while finding ways to work together for greater effect.