Thursday, October 9, 2008

Apert

  • I've been working on various projects but none of them is to the point of being documentable. But I feel like I should update my blog so it doesn't look like I'm dead. So...here I am. I'm a Montharian. (For explanation of this and the post title, see next item)

  • I'm "reading" Anathem and it's really great so far. I "read" The Name of the Rose a few months ago and had the idea of scientific monastics then, so I'm a little cheesed off that Stephenson beat me to the punch (not that I was going to write a book, but now I can't talk about how cool it would be without sounding like a fanboi). I've seen some complaints about the made-up words, but I don't think that's really fair. For one thing, a lot of the words like "fraa" and "reticule" aren't made up, they are just less common. For another, shut up.

  • Is it just me, or is the YouTube subscription system completely broken? My concept of that list on the front page is that they are supposed to be new, unwatched videos from my subscription list. Instead, they seem to show a random selection of new videos from my subscription list, watched or unwatched, and only one from each subscription. So if, say, New Scientist puts out 3 videos in between visits, I only see the latest one. Why isn't it more like an RSS feed? Or maybe I should use an RSS feed for it?

  • Weight loss is still on track to reach my goal by Christmas. I'm such a dork I even wrote a program to calculate some stats, including what day my current trend will have me finishing at. 12/24/2008 so far.

  • One of the projects I'm not ready to post about yet involves some electronics running outside. I wasn't comfortable having it plugged in, so I went with a large, rechargeable battery. After getting everything working, I realized
    1. The motors weren't powerful enough
    2. but they were still drawing too much power to allow the battery to last very long
    3. and I bet the battery won't work well in the cold
    Sooo....yeah. Back to the drawing board for at least part of that.

Tuesday, September 16, 2008

Wooo

  • I cracked 50 lb of weight loss today. I'm still on track (±ε) to reach my original goal by Christmas. It also happens to be, as of yesterday, 10 lbs in 100 days, or almost exactly 350 calories/day.
  • Pursuant to that, I have made a breakthrough in food reduction technology. One of my favorite meals is...undocumented on this site?! WHAT. Anyway, it involves guacamole. The problem I've had is that I need to make enough to use up an entire avocado, which now that my metamabolism needs fewer calories is a little too much. Avocado turns brown if you look at it funny, so I can't put the excess in the fridge. I also can't throw it away because of the starving children in Africa. However, it turns out to freeze just fine. So now I can make M/Nths of a recipe which not only vastly reduces the hit points but also means I only use M avocados every N days.
  • I'm trying to embed a microcontroller into a project that I'll describe more later. All I know is Arduino, so I'm going with that. (I guess I could just use the Atmega chip or however that works, but baby steps, people.) The basic Arduino is a little unwieldy for this, but last night I finished soldering and testing the Really Bare Bones Board. And besides being much smaller and breadboard-compatible, it's also much cheaper because it pushes some of the cost of the unit into a one-time-purchase cable.
  • Number One Son, age 9, is trollering me. He just found out about HTML and has made a couple of pages. (With random size changes and font colors, naturally.) He keeps calling the .html file a "program".

Wednesday, September 10, 2008

New Control Structure Considered Useful

We have a large data processing problem at work. Basically, we get thousands of items every day and have to figure out which ones go together. The only way to know if they go together is to try them. Some items may not go with anything, some may fit with a hundred or more other items. The one nice thing is that once we've found 3-5 items that go together, we can zip through all the other members of the group.

The problem is finding those 3-5 items. Choosing every possible combination of 5 would take too long. Choosing every combination of 3 is fast enough, but leaves a lot of extras. The simple solution is to first try all the combos of 3, then try all the combos of 4 on the remainder, then try all the combos of 5 on the remainder of that. The smaller and smaller pile makes the larger and larger choices feasible.

My boss, who is a competent practical programmer, suggests we have 3 procedures: One that does a 3 nested loop, one that does a 4, and one that does a 5. Like this (in Tcl):

set items {apple orange banana grape strawberry}
set count 5

for {set i 0} {$i < $count} {incr i} {
    for {set j [expr $i + 1]} {$j < $count} {incr j} {
       for {set k [expr $j + 1]} {$k < $count} {incr k} {
         set string [lindex $items $i]
         lappend string [lindex $items $j]
         lappend string [lindex $items $k]
         puts $string
       }
    }
}

That's just the 3 level loop because the other two look almost the same. The 4 and 5 level loops are identical except for having additional levels. As a programmer who values elegance over readability, the phrase "identical except for" is a red flag. Why have 3 separate procedures when all you are adjusting is a single parameter? What I need is a new control structure that is basically a for loop but lets me control how many nested fors there are.

Tcl makes it easy to create new control structures. Here's the control structure definition:

# Usage:
#  indexcount - how many items are being chosen
#  itemcount  - how many items are being chosen from
#  indexvar   - variable to hold current combination of indexes
#  body       - code to execute for each combination
proc chooseloop {indexcount itemcount indexvar body} {

    if {$indexcount > $itemcount} { 
      error "More indexes than items"
    }

    if {$indexcount == 0} { return }

    set indexes {}
    for {set i 0} {$i < $indexcount} {incr i} {
       lappend indexes $i
    }

    set maxindexval [expr $itemcount - 1]

    while {1} {
 
       # make new body that sets indexvar first
       set newbody "set $indexvar {$indexes}\n$body"

       # do this iteration
       uplevel 1 [list eval $newbody]

       # find incrementable index
       set found no
       for {set i 0} {$i < $indexcount} {incr i} {
          set index [lindex $indexes end-$i]
          set thismax [expr $maxindexval - $i]
          if {$index < $thismax} {
             set found yes
             break
          }
       }

       if {!$found} { break }

       # increment this index and set all following ones
       set incrindex [expr ($indexcount - 1) - $i]
       set precedingval [lindex $indexes $incrindex]
       for {set j $incrindex} {$j < $indexcount} {incr j} {
          lset indexes $j [expr $precedingval + 1]
          set precedingval [lindex $indexes $j]
       }
    }
}

Now to get my 3 level loop, I can call like this:

chooseloop 3 5 indexes {
    set str ""
    foreach index $indexes {
       append str "[lindex $items $index] "
    }
    puts $str
}

In order to do 3, then 4, then 5, I can call like this:

for {set i 3} {$i < 6} {incr i} {
    chooseloop $i 5 indexes {
       set str ""
       foreach index $indexes {
          append str "[lindex $items $index] "
       }
       puts $str
    }
    puts "--"
}

The output of that last one is:

apple orange banana 
apple orange grape 
apple orange strawberry 
apple banana grape 
apple banana strawberry 
apple grape strawberry 
orange banana grape 
orange banana strawberry 
orange grape strawberry 
banana grape strawberry 
--
apple orange banana grape 
apple orange banana strawberry 
apple orange grape strawberry 
apple banana grape strawberry 
orange banana grape strawberry 
--
apple orange banana grape strawberry 
--

Monday, August 18, 2008

Forming Acrylic Mirror

I think all this information exists in previous entries, but it's nice to have all my knowledge, however little that is, dumped into one spot.

Heat forming acrylic (aka plexiglass) is pretty simple. Just get the temperature up around 220°F and it's pliable. I put it into the kitchen oven. Don't rely on the oven temperature, though, use something with a probe to tell if you've got the real temp. For one thing, you can put the probe right down where the mirror is, not just floating around in the air inside the oven. Also, when I was researching this I found some warnings about fumes. I think that's only if you overheat because I never smelled or sensed anything. Maybe I've silently shortened my life by 20 years.

I tried a couple different methods of using a form. The first couple tries were "open-faced," meaning I laid the acrylic on top of something and counted on the weight of the material itself to cause it to sag into the form. It isn't really heavy enough for that, so I moved to a two-part form. It takes longer to heat that way because of the mass of the form itself. Another disadvantage of this method is that you have to be able to force the mirror into shape before you heat it, which means no 2D curves (like a bowl, if you see what I mean). Actually, you probably could do that by putting the acrylic sheet between the halves of the form and then weighing the top part down. Like the open-faced method, but with extra weight. Drill a hole in the form so the temp probe can sit right on the acrylic.

The above should give pretty nicely formed acrylic sheet even in complex shapes. Unfortunately it's totally unworkable for acrylic mirror. I'm not sure if it's the acrylic or the mirror backing, but the heat stresses the material such that you don't get a smooth reflection anymore. For a while I thought it was imperfections in the form, but various experiments ruled that out. (You can get bumps and ridges from a rough form, though, which can be eliminated by loosening the form a little or by lining the form with some kind of bumper material. I used a sliced up silicone baking sheet.)

Also: I never got far enough to have this problem, but eventually you'll run out of space in the oven. Multi-part forms? Some other heating method?

The curve I wanted wasn't 2D, so how about cold forming (aka "bending")? I have not yet determined the point at which the acrylic cracks or deforms. I haven't even determined if there's some point short of complete destruction where the mirror breaks down, a la the heat deformation. It seems to be pretty sturdy and stable, but then I'm not making tiny radius curves. If you imagine bending a yard stick, that's about what it seems like, or maybe a little stiffer. Put another way: I have a square of acrylic mirror that's 2'x2' bent into a curve about the same as the side of a 55 gallon drum and I haven't see any problems with it. (This is the 1/8" thick stuff. There's also a 1/4" thick stuff that I've never tried.)

The trick with cold forming is that you have to hold it in place somehow. Even drilling a hole through the acrylic will deform it, although only in the immediate area surrounding the hole. I started with a sandwich method--cutting two parts and then cramming the mirror between. That works, but you have to have some method of securing the bread of the sandwich that doesn't involve drilling through the mirror. Also, you cover up some portion of the mirror surface.

Of course, you can drill through the mirror, but in that case why even have the top piece of bread? That's what I switched to: Put the mirror on an open-faced form and drill a few well-placed holes to secure it down. Don't overtighten, because the force isn't distributed over a wide area like with the sandwich, so the local area can get quite deformed. Maybe a reason to have the top piece of bread after all. Or maybe just some rubber washers or silicone baking sheet for padding.

You can't get too fancy with this method, but for a single, relatively gentle curve it works great.

Wednesday, August 13, 2008

Massively Unparalyzed

  • I think I'm out of the summer diet doldrums. I suddenly realized that if I stayed focused, I could meet my original goal by Christmas. I have to lose 1 lb every 10 days, which seems pretty reasonable. That's just ~350 calories/day. This is the same rate my overall history has been up til now, so as long as I keep, or *cough* get back on, that average I should be good. (I say "original goal" because after I meet that goal I think I'm going to go an additional 10 lbs. But I'll have to see how things stand when I get there.)

  • I needed to sense sunlight vs shadow and I'd read somewhere you can do that using an LED somehow. I got that working but they aren't made for that and so it didn't meet even the low standards of this application. Some photoresistors, even at RadioShack's redonk prices, were only $3 and work so much better.

  • Also needed, or at least wanted to evaluate, pulleys. McMaster-Carr's site is so awesome, why can't my local hardware store (or even Lowe's) have a website like that? Or McMaster-Carr have an outlet near me.

    That said, my local hardware store fits an amazing depth and breadth of stuff into their store. I don't think there's been a single thing I couldn't find there that I was able to find at Lowe's, in the fields the LHS covers. (i.e. they don't sell appliances at all, so obviously they have a smaller selection of dishwashers.) And the reverse is not true--I've found things at the LHS that Lowe's didn't have. And they manage to fit all this stuff into an area that's probably literally no larger than the area devoted to just cash registers at Lowe's. Like, how is it possible that my LHS has a 9 ft2 caribiners + pulleys display right next to the pumps I need (though are still more than I want to pay)?

    Oh and the staff actually know where things are and how to use them, unlike at Lowe's.

    I guess what I'm saying is, local hardware store:Lowe's::small European country:US. It may be a little more expensive, but the service and selection are great.


  • How can I completely waterproof a wooden structure? How about sunproofing? Like, is it going to get baked and shrunken on one side? Probably somebody already knows all this stuff. No wonder people just build with metal. Oh wait, how about PVC? Does that degrade in the sun? Oh and it's hollow, so you can put wires in there....HMMMMM

  • I was going to have an entry in here talking about all the things I suddenly (as of this morning!) have to do, but I can't even spend time enumerating them!

Monday, August 4, 2008

Paralyzed by Obstacles (i.e. whining)

(throughout this entry substitute "can't find at a reasonable price" for "can't find" and "free or under $40" for "reasonable price")

The next stage in the parabolic solar collector thing is to have the fluid circulating. I want to have it run through the collector, then down a hose into a tub of water and then back. Measuring the heating rate of the water will give me a better value for the power.

For this, I clearly need a pump. And can I find a pump? Clearly not. For simplicity, I think I want one that has garden hose fittings on both ends. Sump pumps usually have that on one end, but the other end doesn't have any fitting at all. (Maybe I could disassemble one to find out, but I can't find any to do that with either.) I bought a drill pump for like $6 but it was too wimpy to be useful.

Not that it has to be that powerful. According to the back of my envelope, I only need about 60 gph in the worst case. Typical sump pump numbers are 10x that. I could probably do it myself by putting a squeezable diaphragm inline and stomping on it. What a lot of work, though.

But I have feelers out on craigslist and freecycle, so in the meantime how about something else? I know, I can try to make a much larger stirling. What'll I use for the piston? Oooh, brill idea: a cut off bike pump!

Take 2: And can I find a pump? Clearly not.

Maybe I'm just too cheap. Or maybe I haven't figured out the right workaround. Or maybe I'm asking for too much. All of these questions (plus a couple other things I'm stopped on but aren't worth describing) has my brain in vapor lock. I am unable to move on anything.

Saturday, July 19, 2008

Stirling Walking Beam

I made a Stirling engine before, but it wasn't "real" in the sense of "having traditional engine parts, like a flywheel and crankshaft". Also, it would be pretty difficult to scale that one up or extract power from it as is. So this is my first regular ENGINE engine. (This is called a "walking beam" engine--many other configurations are possible.)

One reason I built this one was to prove to myself that I really understood how they worked. For that reason, I designed this all myself. Not that there's SO MUCH there. Also, there are tons of videos on YouTube that are identical to mine.

It's be really awesome to scale this up. Like with an oil drum for the displacer cylinder. I'd start that right away, except not only do I not have an oil drum, I'd need access to machine tools to make the power cylinder.

Tips

  • With the power piston shaft and displacer piston shaft mounted on the same point, getting distances right is a little tricky. It's a big parallelogram this way. Make them separate next time. Maybe even on a rotating collar so the phase angle between can be modified.
  • If the shaft tiepoints have a lot of play in them, the engine works jerkily if at all (because all the motion is taken up in using the play).
  • I think I overdid it on the height and underdid it on the width. Could have used a little angle-reducing distance on the piston shaft. Alternatively, shorten the stroke.
  • The flywheel is a little heavy. The momentum should carry it through the compression stroke, it shouldn't have to be barely sucked in.

Tuesday, July 8, 2008

New Results

Latest solar trough configuration:

A few details:

  1. Those are just simple, band-sawn parabolic arches. The mirror is attached with velcro. Works awesome. Ly.
  2. I suspended the mirror from the pipe thinking that would keep the focal length constant while allowing simples changes of elevation. Why do I always go straight for the complicatedest solution in the universe?
And data from same:

The highest temp on there is almost 140°C. That's over 280°F. According to my rough calculations, the four steepest upward slopes indicate powers in the range of 20-25 watts. (Some of those dropouts are me messing around with the setup, some are cloud cover. Also, I later discovered that true solar south is like 15 or 20° east of where I've been pointing.)

Two big changes from the last run, other than the already-mentioned one of shortening the excess pipe.

  1. Painted the pipe flat black.
  2. Used a laser pointer to adjust the focus. I mounted a frosted glass square (I happen to have a bunch I bought for just such a use as this) at what I thought would be the focal length. Then I stood back and aimed the laser pointer in a roughly perpendicular way and looked where the point fell. This really needs a System to keep it perpendicular, but anyway I was able to determine that my focus was off by over an inch.
I'm thinking the Mark III will be the last iteration. Pointing in the right direction, and simplifying the pointing a little, may let me add another 10-20 degrees to the peak but that will be about as far as I can go with these simple materials and using an open-air design.

Friday, June 27, 2008

Belated Mirror Squeezer Results

I did one "live" run of data collection from the parabolic mirror squeezer, but after I did it I realized there was a major problem. The pipe was much longer than the mirror width, so it overhung. Too late, I realized that this meant there was unheated oil in there, making the temperature measurement invalid. And I don't even know what direction the error was worse in, since the overhang could also act as cooling fins. Anyway, here's the graph of the results:

It looks very similar to the original run in a hotbox:

One major difference: Check the x-axis. The parabola run is at least 4x steeper.

Anyway, if I get some sun this weekend I should be able to re-run with more accurate results.

Tuesday, June 17, 2008

Potpourri

  • The diet hit a plateau. I'm down by 43 lbs from when I started, but in the last 30 days it's only changed by .5 lb. Looking at the chart from a year ago, I think I see a pattern. It was going down very slowly in May/June 2007, too. Looks like maybe 3 lbs in 60 days.

    There's probably two things going on. First, every year I imagine early summer weight loss should be easy. "Winter hibernation pounds just melt away naturally!" Second, a lot of good, fresh food shows up at the store.


  • I used to listen to Pandora at work. The advertised feature, discovery and laser(ish) targetting of your tastes, worked great. The problem was that the selection wasn't so great. I was down to about 30 songs that they just endlessly looped for me. Then I switched to Last.fm. The targetting isn't very good, but the selection is pretty huge. Exhibit A probably says more about how out of the loop I am for just now finding this, but still: Pretty hilarious (Lyrics)

  • And speaking of nerds: Do you like math? Do you also like mechanical devices? Then you will probably love How Round Is Your Circle. It's filled with mechanical ways to make, or approximate, mathematical functions, such as for linkages. The main problem with the book is that it's too short. It should really be a set of volumes so he can better explain each item. (Video teasers).

  • I have dismantled and cannibalized the Squeezer for a much simpler version of a parabolic trough now in production. Stay tuned!