Wednesday, December 19, 2012

Back on the Rails

Holidays seem to be my train time. I did a train show in April and a merit badge clinic in September and that is about it. I have gotten excited about the new Raspberry Pi Linux computer, and plan on using it to control my layout instead of the two Arduino microcontrollers I use now.  There were are a lot of things that I hacked together to get the layout working, and I've long wanted a chance to do it over, simpler and cleaner.

My first step is designing a new control board. This will basically have an Arduino brain (Atmega 328) and two L293D H-bridge controllers. That isn't much of a departure from how it currently works, except it collapses several separate modules on to one board and will be able to control the engine and turnouts itself, or interface with another computer (say a Raspberry Pi)!
Perhaps my biggest leap in simplicity is in the turnout control. In my prior amateur stumbling, I ended up using a transistor to control a relay to control Ken Stapleton's switching circuit (times two!). I burned up two Atlas under-table switches figuring out that Rube Golberg setup. I guess that happens when a 5 volt guy starts trying to control 12 volt systems.  I've determined you could do the same job with several two-dollar, high-power MOSFET transistors, or (drum-roll please) a L293D H-bridge. There are two of these on the Adafruit motor control shield I'm currently using, capable of powering two DC motors each, of which I'm currently using exactly one half of one. A single H-bridge, with some diodes, can control both turn outs! It works, and I've only burned up one resistor and two cheap transistors.
The prototyping and testing is done, and the board is laid out and sent off for manufacture. See if you can tell the difference between my board and Lady Ada's motor shield. That is Open Source Hardware for you. She provides all the design files and I just stripped it down and built if up the way I wanted, complete with a  Wii nunchuck adapter! I just have to wait six weeks for it to come back from China to see if it works as advertised. If it works, I'll post my designs on line for others to use as well. So it goes.

Tuesday, December 11, 2012

Recreational Statistics

At our Ward's Christmas party this year, they had a large jar of Hersey's candy kisses and we were asked to guess the total number. The closest guess to the actual number got to take them home. I remember reading a story about how in such situations, that the average of all the guesses would be closer to actual than the winning guess, a sort of accuracy through consensus thing. Here was my chance to test that out, so I volunteered to check the answers.

We had 72 guesses cast, and as we went through them, I could see the average would be low because some of the smaller kids had unrealistic guesses like 8 or 20. One kid wrote "there are 0 kisses in the jar, but some candy kisses". Funny, and true, but no chocolate for him. The winning guess was 454, which was about 8% higher than the 417 actual pieces. Robin had the next closest guess and was quite disappointed.

Days later, I plugged all the guesses into my magic bit box to see what the statistics said. The average, or mean, as I predicted was very low at 208. That indicated an abnormal distribution, which a histogram quickly confirmed. Somewhere in my reading, I came across a tidbit that said the median would be a better statistic to use for a skewed distribution. Sure enough, the median is 407, or about 3% off actual, and much closer than the winning guess. So I guess with a little quibbling about the use of mean or median, the story was right.

I tracked down the story, and it is from a book called "The Wisdom of Crowds", and involves guessing the weight of an ox at the county fair. I'd rather have chocolate.

Fun Facts: Hershey's Kisses were introduced in 1907, but the term "KISSES" wasn't trademarked until 2001. Hershey makes more than 60 million kisses a day. Candy kisses that is.

Sunday, December 2, 2012

A Dress for the Ages

Rachel made a dress for a ball she was going to with a friend. She picked out the pattern and the fabric and had it finished in about a week.
If you haven't heard of steampunk, think Jules Verne, or more modernly, Levianthan by Scott Westerfeld. It is Victorian techno sci-fi.
We talked her in to wearing it to church and she got a lot of compliments.
 Just amazing. Can't wait to see what she tries next!