« February 2009 | Main | April 2009 »

March 21, 2009

Electronics 101

After getting an inquiry about making 100 MintyBoosts (which eventually did not pan out), I started doing research this past weekend to see if I could actually do it. Because the guy wanted an older version that you can't buy printed circuit boards (PCB's) for anymore, the big challenge would be getting those made. All of the other parts (resistors, capacitors, inductor, microchips, etc.) seemed to be available. I knew that Ladyada, the inventor of the MintyBoost, had a lot of files available for download and didn't seem to mind sharing her design. And given her incredibly detailed instructions on how she developed the project and how someone could make it, I figured I would just have to follow the instructions.

Turns out it wasn't quite that simple. On her downloads page she had the current design and a couple of the earlier ones available, but not the v1.2 that I wanted. But even so, the designs are in an electronic format made for the CAD software (Eagle), but not made for production. For that I would need Gerber files.

I found a page at Hackaday that talked about how to convert files in Eagle into Gerber files for a PCB fabricator. That was pretty useful and looked like I could do it. So I downloaded Eagle's software and tried it out.

One thing Ladyada did to get a better deal on circuit boards was she combined two boards onto one. One side of the board has rounded edges, so she put the flat sides back to back and got oval boards. Then she cut them in half for two boards with rounded edges once she received them. But her Eagle file only had one board in it. I spent a while trying to figure out how to make a copy of that board before I finally realized that the free version of Eagle does not let you do this.


I was able to create the Gerber files by following the Hackaday instructions, plus further instructions they referenced about using a CAM file at Sparkfun to create the right format of Gerber files.

Once the Gerber files were made, Hackaday recommended checking the Gerber files in a Gerber viewer. There is a free one called Viewplot, so I downloaded it, and as far as I could tell, it seemed to look okay.

With the Gerber files created and checked, I went to the same company Ladyada had used, Advanced Circuits, and found out I needed to put the files in a zip archive first. I didn't have a zip program on my computer so I tried to download Winzip, which we have at work, but you are supposed to pay for it, so I wound up with FreeZip. I uploaded the zipped archive of files to FreeDFM which is run by Advanced Circuits to check the circuit for problems. It didn't recognize the file extensions, so I had to tell it which file was for what (one file is for the holes that need to be drilled in the board, plus separate files for the top layer and bottom layer that trace the wires, the solder pads, and the writing, 7 files in all). I think I should have stuck with the built-in CAM files of Eagle. I also had to fill in values for about 20 different parameters of the circuit board like material, colors, tolerances, etc. I tried to use defaults plus Ladyada's web page had an image of her price quote that had most of the parameters listed. It then generated a report saying I had a ton of errors relating to width of silkscreen print (doesn't seem like a big deal) and my wire paths (could be a big deal), but the software automatically corrected everything.

The checking software also generated a quote for how much it would cost to generate different numbers of boards. I could get 150 boards for $3.79 each ($568.50). I figured I would need to order some extras in case I messed some up. The next lowest choice was 50 boards for $10.82 each ($541.00, only $27 less). Ladyada's writeup said that the quote did not include a $150 price for setting up the production run, a one-time fee that would not apply to subsequent orders of the same board. But I think the price now does include that because it said the setup fee was $0.00.

What would be really helpful is if I could take Ladyada's setup at this company and re-order 120 boards (or 60 if she has 2 boards per piece). Then I would know that it would work (wouldn't have to go through all of this business of creating and uploading Gerber files) and wouldn't have to pay a setup fee again. I left a message on Ladyada's message boards to see if I can get the v1.2 board design and she said that she didn't have the design files and suggested I recreate the Gerber files.

Anyway, the end result is I feel somewhat confident that I could order the circuit boards for v1.1 and I told the guy I could do it. Whether the boards would really work (did I have the right version of the board design file, did I create Gerbers correctly, did I choose all the right parameters?) and whether they would be cut to the right size (Ladyada's came from the factory with the rounded corners) would be another issue.


March 18, 2009

Trailing Stop

I'm not all that sophisticated an investor and mostly I am in mutual funds for the long-term. But I do buy stocks and have been kind of successful selling stocks when I get to a 20% gain and buying more share if they fall 20%. To do this I use a lot of limit orders. If I buy a stock at $100/share, I can put in a sell order that day for $120/share and a buy order for $80/share. If the price falls 20% I automatically buy more. If it goes up, I automatically sell. I like this because it keeps me from getting greedy and I don't have to watch the market all day (or at all).

I bought some Goldman Sachs like this and when it went down 20%, I bought more, which I then sold when it went back up. Goldman has been on a yo-yo, so I've been able to buy and sell three times for a 20% profit each time. But I didn't reach a 20% gain on the original shares until recently. My intention was to hold on to GS because I felt like its long-term outlook was very good and it could make a lot more than 20%. Still, it could also zoom right back down. Today it was up quite a bit and I'm into the 30% gain range. I didn't want to sell if it would go up some more, but I don't think I want to allow it to get below my 20% gain mark either.

So for the first time I am using a "trailing stop". This sets a sell price a certain amount below the current price and the sell price adjusts upward as the stock price goes up. For instance, today GS was up to $105/share. So I entered a 5% trailing stop meaning if it goes down 5%, I will sell (basically at $100). However if the price were to go up to $110, the new sell price would be 95% of that, $104.50. If it goes up steadily forever, I will never sell. But if it goes down 5% at any time, the shares will sell. They could sell tomorrow.

What's worse, if the stock market futures go down tomorrow morning before the market opens, Goldman Sachs might open at $90/share and, because that is at least 5% below my target price, the shares will be sold instantly at $90.

So there is risk all over the place. First, there is a risk the stop could trigger below my set price. Second, there could be a 5% blip downwards tomorrow before the stock goes back up again, and I would have sold and missed the rebound. Third, I could have sold the stock today at $105 and been done with it. So if the stock sells below $105, then I haven't really gained anything at all by using a trailing stop. If I can somehow beat that price, then I might become a fan of trailing stops.

If the price goes up another $10 or so, I could change to a 10% trailing stop so that the shares wouldn't sell on a volatile day.

I'll let you know how this works out.


March 15, 2009

Pruitt-Igoe

A couple of years ago I rented a neat movie from Netflix called Koyaanisqatsi. It is a collection of video footage set to music by Philip Glass (who also wrote Akhnaten which I wrote about in January). There are no words, just a series of video footage of various things, often time lapsed or slow-motion, (rockets, traffic, clouds, factories) set to different instrumental pieces. When I was at the library once last year, I saw the soundtrack was available to be checked out, so I took it home. It's classic Glass, very repetitive, great music to set a mood. Since doing that movie in the early 80's, Glass has done a number of other soundtracks for movies including The Truman Show, The Hours, The Illusionist, and Kundun.


Anyway, the movie title comes from a Hopi Indian word that means "life out of balance" or "crazy life" and the movie focuses on man's busy domination of the planet. One particular segment was of buildings being blown up. There were a whole bunch of these ugly high rises blowing up one after the other. It was a huge complex of them. The song is called Pruit Igoe and is one of my favorites on the CD which I recently bought for myself (not that I would copy a CD from the library, especially since it had annoying skips on it). In fact, one thing that got me interested in the music again was hearing a Philip Glass song during a commercial for Watchmen. It sounded familiar and certainly a lot of Philip Glass music sounds very, very similar, but in fact it was Pruit Igoe.

Ordering the CD I got interested in the original movie again and read on Wikipedia about the real Pruitt-Igoe, a public housing complex in St. Louis built in the 50's with federal assistance. You can read all about it at the link, but it was a totally massive failure: a failure of design and execution, a failure of social engineering, and a dismal financial failure. It consisted of 33 11-story buildings. Due to desegregation, it was mixed race, and when the white people found that out, they all moved out. It was never fully occupied before becoming a haven for crime and vandalism. The architect said later "I never thought people were that destructive." By the way, he also designed the World Trade Center. Less than 10 years after opening it was recognized as a tremendous failure and had very few people living there. By 1972, less than 20 years after first opening, they started blowing up the buildings. By 1976, it was completely gone. Some said it was literally the death of modernist architecture.

The movie went into none of this since it had no words. They just used stock footage of the buildings blowing up and set it to pretty music. The whole movie is like that. I think maybe the attraction of the movie was people liked to smoke pot while watching it, but it was kind of fun just to watch as it unfolds. Some of the footage is dated, but some of it is really interesting, and of course I liked the pretty music. Eventually the filmmaker made two sequels, which I haven't seen yet.