Knitting!

April 22nd, 2008

And now, for something a little bit different: knitting! Actually, come to think of it, knitting isn’t all that different from my normal subject matter. It is definitely under the “Making Stuff” umbrella of topics. And Craft magazine is almost like Make magazine…

Anyway, the point is: my wife knits. A lot. And she has started channeling her creative energy into a knitting site with the goal of teaching people to knit. She’s starting with a couple articles showing how to make a baby blanket and a hat. The plan is to supplement this with instructional material on knitting basics, more patterns, etc. (Actually, the instructional material would already be up except that to do it right really requires video, which takes a bit more time than writing). Her site is at yanaknits.com. If you have an interest in knitting, drop by.

Springtime Flowers

March 31st, 2008

It’s springtime and flowers are coming out! To celebrate, we went hiking at Henry Coe last weekend. The park is at its most beautiful this time of year, with green hills and lots of flowers. The weather was cool (bordering on cold) and a little damp. There was dew on the grass & flowers and it lasted all day in the shade.

We went in from the main entrance and hiked to Frog Lake, along the Monument trail. I really like the top of the Monument trail. There’s a spot where the hill opens up and has some tall pine & oak trees. It was very quiet except for the wind blowing in the trees. From the top, the trail descends down to Frog Lake. Anywhere else, this would count as a steep descent, but compared to some of the other trails at Henry Coe, this one is only a moderate descent. We forgot about the park’s tendency for steep trails and didn’t bring our hiking poles; we’ll want to remember them next time.

Frog Lake is a little reservoir with a few dead trees sticking out of it. I think this was the smallest lake we’ve been to at the park (not counting the small water ponds that are so valuable in the summer). From here, we hiked up to Middle Ridge and headed east. This trail alternates between open oaks forest and cutting through thick brush . The Manzanita trees are truly impressive. Normally a small bush, the specimens here are full-blown trees.

After hiking along the ridge we took a right turn and crossed the creek to start climbing back to the park headquarters. By this point, our knees were definitely starting to feel all the climbing and descending we had done, and we were ready to be back at the car. To cap off this nice springtime hike, we had the most beautiful clouds over Gilroy on the drive home. The sunbeams shooting through the clouds were beautiful, and lasted for quite a long time.

More Pictures

Element Explorer now shows melting & boiling points.

March 2nd, 2008

I just updated Element Explorer with melting & boiling point information. Just like with the previous data, there are some interesting patterns to see. Carbon stands out as having a much higher melting point than its neighbors, while mercury is much lower than its neighbors. Have fun exploring!

Mark’s Pocket Technique for Learning a Foreign Language

January 31st, 2008

I’ve been working on learning Russian, and trying to pay attention to what works (and what doesn’t work) as I go along. The biggest thing I’ve noticed so far is that I really need to expose myself to Russian every day if I’m going to make any progress. I’ve come up with a way to do this which I’m calling the Pocket Technique. The basic idea is to always have some kind of study material in your pocket so that whenever you find some free time, you can study.

Items you will need for the Pocket Technique:

  1. A Pocket
  2. Flashcards
  3. iPod Shuffle

A Pocket

Fairly self-explanatory, you put the other two items into the pocket. I suppose you could use a purse or a backpack if you wanted to, as long as you always have it with you.

Flashcards

Flashcards are an easy way to increase your vocabulary. The key is making sure they fit in your pocket. I cut a 3×5″ card into 4 pieces. Don’t bother trying to keep all the cards together on a ring. Just make a big pile of them, jam a handful into your pocket, and you are good to go. Now anytime you have a few spare moments, pull out some cards and look at them. Walking to the bathroom? Look at a card. Waiting for someone to show up for a meeting? Out comes a card. Walking to your car after work? Time for a card. The beauty of this is that even though you might only look at a few cards before you have to put them away, you’ll find yourself thinking about the words that were on them for the next couple minutes. There are literally dozens of opportunities to look at the cards during the day, so this can add up to a decent amount of time.

iPod Shuffle

Flashcards are good for learning new words, but to learn how to put sentences together, to learn the flow of the language, I found that audio lessons were essential. With an iPod Shuffle, it is really easy to have hours of audio lessons in your pocket at all times. (Obviously other music players will work, but they must fit in your pocket!) Get some instructional CDs (I like the Pimsleur Russian CDs) and put them on the iPod. Now stuff it in your pocket, and find a chunk of time during the day to listen. Unlike the flashcards, this only seems to work if you actually devote a block of time to it. Listening to 90 second snippets throughout the day doesn’t help much; I found that listening to a single 30-minute lesson in one sitting worked infinitely better. If you commute, that’s an obvious block of time when you could be listening to the lessons. Breakfast might be another good time. If you go to the gym regularly, that could be your time.

The Single Most Important Part of the Pocket Technique

Like I said at the beginning, the most important tip I’ve found is that you have to spend time with your language every single day. This is really, really crucial if you want to make progress. Every time I took a couple days off, I’d start forgetting words. Then, when I started studying again, I had to struggle to remember these words (even though I knew I had learned them before). This wasn’t any fun at all, made me feel stupid, and the lack of progress really killed my motivation. In contrast, when I spent time with the language every day, I could feel the momentum. I wasn’t forgetting words (which made me feel smart instead of stupid), and it wasn’t nearly as frustrating. So, my advice is to never skip a day.

Tried it?

Hey, if you try doing this, leave a comment and let me know how it goes. Or if you have another favorite approach, share it in the comments!

Getting Started with AVR Microcontrollers

December 7th, 2007

Trying to get started with AVR microcontrollers, but bewildered by the sheer number of options? So was I, a short time ago. It took several weeks of reading before I felt like I understood how everything fit together. I’ll write it down and hopefully save you a couple of weeks.

(A short aside: if the rest of the post makes it clear that AVRs are too much for you, consider getting an Arduino. They have an AVR chip in them, but are easier to use.)

First, let’s look at what a complete setup looks like:

  • AVR chip
  • The rest of the circuit
  • Hardware programmer
  • Software to run the programmer
  • Compiler toolchain for your language of choice (assembler or C)

AVR Chip

There’s a huge spectrum of options in the different AVR chips. Don’t worry though, they are all fairly compatible in terms of learning how to program them. They differ in how much memory they have, how many fancy peripherals (like ADCs, UARTs, PWM generators) they contain, what package they come in, and of course how much they cost. You just need to pick the chip that has the right combination of features for your application. If you just want to play around, I’d suggest getting one of the fancier AVR chips, like an ATmega168. Then you’ll have plenty of features for whatever you want to try.

Atmel has a nice product grid that lets you quickly compare the different chips.

If you really need a specific feature for your project, be sure to double-check the datasheet and make sure there isn’t some little gotcha waiting there. Lots of features share pins or internal hardware, or have unexpected restrictions, so you need to understand the datasheet. For example, the timer and PWM generator may share the same counter internally, or one of the output pins might be shared with a pin used by the programmer.

Here’s a suggestion for saving a lot of time: Start with an over-powered chip. Sure, those 8-pin chips are cute, but they don’t have very many peripherals or memory. When you realize you need a 2nd UART which you don’t have, or that you really need 256K more memory, you’ll be sad. Instead, start with one of the fancier chips and use the extra hardware to get your project done sooner. Then, if you still want it to run on a smaller/cheaper chip, you can start optimizing your software and writing bit-banging routines to replace the peripherals.

ISP Header

The only AVR-specific part of your circuit is an ISP programming header. This is where you plug in the programmer to download your software onto the AVR chip. It is really easy to build a small ISP adapter that plugs into your breadboard. I explained how I built one here. I suppose you could also just jam wires into your breadboard, but that would be messy.

You’ll want a solderless breadboard to prototype your circuit in (later, once it is perfect, you can move it to perfboard or a PCB, but until the circuit it perfect you’ll be changing it a lot so you want to start on the breadboard). You need some kind of power supply. I built one of these on the corner of my breadboard. You could also use batteries, or the +5 line from a USB connection.

Programmer (Hardware)

This piece of hardware is how you get your programs onto the AVR chip. There are a lot of options, but many of them are outdated. What you want is a USB programmer that does In-System Programming (ISP). Examples:

Whatever one you get, you need to be sure that it will work with your programming software.

Programming software

You need software to control the programmer (confusingly, this software is also occasionally called a programmer). There are a bunch of different pieces of software to do this but the most common 2 seem to be AVR Studio and avrdude. Both are free. Avrdude supports a ridiculous number of different programmers, but you probably want to double-check and make sure the one you are about to buy is supported.

Compiler toolchain for your language of choice (assembler or C)

You can program the AVR in either assembler or C. Since we want to pick the easy road, that narrows it down to C. As far as I can tell, all the different IDEs and tools end up using avr-gcc under the covers. So, you need to get the avr-gcc toolchain:

  • Windows: WinAVR
  • OSX: OSX-AVR
  • Linux: For Ubuntu, you can get slightly outdated versions from apt: apt-get install binutils-avr gcc-avr avr-libc

Where to Go From Here

Ok, you’ve collected all your hardware & software. Now you need to put it all together. Fortunately, there’s already a lot of great information out there on how to get started with blinking some LEDs. Here are some links to get you going:

SparkFun’s tutorials
Piconomic Design’s tutorials