In my efforts to divert myself from the ever present spectre of work, I’ve taken up a new hobby — digital electronics. It’s sufficiently different from software engineering that I can relax, but it’s close enough to building stuff that my creative urges are also satisfied.
My first (long-term) project is to build a set of USB-based rudder pedals for use when I flightsim. Of course, I’m having to start much smaller than that. I’ve started by picking up a BASIC stamp kit and a Atmel AVR AT90S2323. I’m working through the experiments/lessons detailed in the BASIC stamp kit and then recreating the circuits and solutions using the AVR. In order to do this, I first had to build a programmer for the AVR so I could get code onto it. As it turns out, that was pretty straightforward and this weekend I’ve made pretty steady progress through the lessons on both chips. So far, I’ve figured out how to write a 1 second, interrupt-driven timer and toggle a LED when an external interrupt is triggered. It may not sound like much, but it’s been quite gratifying to see it work.
If nothing else, my foray into the world of microcontrollers and electronics has brought me a deeper appreciation for the work that has been done at a hardware and operating system level in modern PCs. I took the prerequisite courses in college for understanding microprocessors and operating systems. But those classes seem very abstract now and shield you from much of the “real world” details that working with small electrical devices entails. Having to design a circuit and the corresponding software to deal with EM interfernce is a foreign concept to me. Determining how to create a timer on an 8-bit chip which needs to count up to 4 million before a second has passed is an exercise I would never have to consider in my day job. It’s a whole different way of thinking.
There’s still a lot to learn. I’ve managed to fry at least one LED and (I think) one of the microcontrollers I’ve been working with. Knowing when and where to put resistors is still something of a mystery to me. Thankfully, there’s a host of information on the Web for uninformed people like me — everything from bypass capacitors to pull-up resistors have lucid reasonable explantions.