Friday, September 5, 2008

Improved Blinkenlights

My AVR-fu is slowly improving.

I'm now using the AVR-PG1B programming cable I ordered from SparkFun, along with a DB9 cable and a breakout board that adapts the 10-pin AVR ISP header to a single-row 6 pin header, which then plugs into my breadboard with a cable and gender changer from Digilent. Very nice, works like a champ. (Note: avrdude calls this programmer "ponyser".)

I constructed a circuit interfacing the attiny2313 with an ICM7212 7-segment LED driver. So far, I only have 2 of the 4 supported digits wired, but it works nicely. Here's a photo (taken again with a very crappy camera) of the whole mess:



There's still plenty of room on the breadboard for another IC and a few switches, which are needed for my crazy top-secret project.

Tuesday, September 2, 2008

Blinkenlights success!

I couldn't wait for my AVR programming cable to arrive from Sparkfun, so I decided to build a parallel cable.

Long story short: it works. I used the pinout suggested by http://www.bsdhome.com/avrdude/, which in avrdude is the "bsd" programming device. Although that site suggested 1K resistors in series with the signals from the parallel port (to protect it from current flow from the AVR circuit), I couldn't get the device to program successfully with them in place. So, I just used wires :-)

For the cable, I soldered 5 wires of an 8-wire ribbon cable to the DB25 connector, and crimped a 16-pin socket-style connector onto the other end. I don't know exactly what those connectors are called, but they're designed to fit into an IC socket. That makes them nice for breadboards, which can't really accept dual row (IDC) headers directly.

For the program, I used the code from Elliot Williams's excellent (no, inspiring) piece on cheap AVR programming. I didn't build his development board/programming cradle (did I mention that I hate soldering?), but I used the same circuit.

Here's an amazingly crappy digital photo of the circuit and the programming cable:


Dave Babcock and Greg Link helped me put the whole thing together. It's really nice working with actual engineers :-)

Sunday, August 31, 2008

Where to buy LEDs

While on the subject of electronics, here are some good places to buy LEDs:

MPJA (www.mpja.com) - you can get 100 LEDs (red, green, or yellow) for $1.95. But, there is a $15.00 minimum order. I bought a breadboard from them recently, and the order was filled quickly, so they seem like a pretty reputable establishment.

Jameco (www.jameco.com) - item number 334052 is an orange LED that is $2.20 for 100. Other colors are more expensive, however. I've bought stuff from them in the past, and they're reputable, but their website is kind of a pain to use.

The discrepancies between what different places charge for an LED - a plain vanilla component if there ever was one - really amaze me. At Sparkfun, you pay $0.35 for a green one and $0.50 for a red or yellow. That's right, more than 10 times more expensive!

AVR microcontroller stuff

I'm pretty close to having the parts I need to start my crazy AVR microcontroller project. (Note to self: in the future, don't order parts from Thailand if you want them to arrive in a timely fashion :-) At the moment I'm just waiting for a programming cable, then I'll be off and running. I was originally going to build a programming cable, but after reflecting on my lack of soldering skills, I decided this wasn't a great idea. The one I ordered (from Sparkfun, good place to buy AVR stuff, BTW) was the AVR-PG1B, which connects to a serial port on your PC, and allegedly is supported by avrdude. I also ordered a nifty little breakout board which adapts the 10 pin AVR ISP connector (2x5 pins) to a single row of six pins which can be plugged into a breadboard. I'll need to get some help soldering it, however.

While waiting for the programmer to arrive, I've been poking around the 'net looking at various AVR tutorials. The best one I've come across is at Sparkfun:
Beginning Embedded Electronics
There's a bunch of stuff at the beginning about building a power supply circuit using a 7805 voltage regulator, but you can save that effort if you have a good switching 5V wall wart power supply. Digilent has a good one (part number SWPS). They also have a nice cable for getting the output of the power supply to a pair of leads (part number COAXPOWER). Beware though: the ends of the leads are tinned with solder, so you don't want to stick them directly into a breadboard, lest bits of solder flake off and cause shorts. A terminal block solves this problem nicely.

When I get some blinkenlights working I'll post a picture.

Friday, August 22, 2008

The rest2web template of awesomeness

Now that classes are starting again, it's time to create course web pages. As I mentioned earlier, I'm using rest2web to generate most of the course web pages.

One really nice feature of rest2web is that the template page (used as a basis for all generated web pages) can contain arbitrary chunks of python code. One thing I noticed about my site design was that the sidebar (containing navigation links) was nice for index documents, but distracting for "leaf" documents such as assignment descriptions, lecture notes, etc.

So, I put in a few lines of code to check the page being generated (available from the pagename variable: see the rest2web template documentation) to see if it's an index page, and if so, suppress the sidebar. I needed to futz a tiny bit with the CSS styles, but overall it was an extremely easy change.

My CS 200 page shows how the generated sites look. Given how much easier it is to author reStructuredText documents than HTML, I think I'm getting awfully close to web content nirvana.

Feel free to use/modify/steal my rest2web template and CSS stylesheet files.

Tuesday, August 19, 2008

Thinkpad X61 Tablet

I'm now using a Lenovo Thinkpad X61 Tablet as my main computer at school. So far, I like it a lot. I'm dual booting Windows XP and Kubuntu 8.04. I was able to get the tablet functionality working, with automatic screen rotation (nifty!), using information on the following web page:
http://www.krizka.net/2008/02/13/thinkpad-x61-tablet-automatic-screen-rotation-under-linux/
If you look down at the comments section, there's some information on running on Kubuntu (KDE) instead of Ubuntu (Gnome).

You have to have the "hdaps_ec" module loaded. I put it in my /etc/modules file.

You also have to edit /etc/X11/xorg.conf. Here's a link to the one I'm using (caveat emptor):
http://faculty.ycp.edu/~dhovemey/thinkpadX61t/xorg.conf
Finally, the "autorotate.py" script has a regular expression bug (fix is in the comments). Here's the fixed version:
http://faculty.ycp.edu/~dhovemey/thinkpadX61t/autorotate.py
The stylus is not calibrated terribly well, and the Debian/Ubuntu folks somehow forgot to include the utility that calibrates it. However, it works acceptably. I used the Xournal program to jot some notes, and while it's not exactly like writing on paper, it's not bad at all. I may try to use this in class rather than writing on the whiteboard.

Thursday, August 7, 2008

gschem vs. kicad

I have officially given up trying to use gschem. I can place components (and even create new symbols), but I have had no success connecting pins with wires. It is possible that I am an idiot, but I don't think I have to go too far out on a limb to claim that gschem isn't the most user-friendly of programs.

Fortunately, there appears to be a nice alternative called kicad. The problem of parts I need (e.g., ATtiny2313, ICM7212) not being in the default symbol library is still an issue, although some web searching did eventually turn up symbols for the parts I needed.

Update: I was able to connect VCC on the ATtiny2313 to +5V! I'm going to tentatively say that kicad rocks.