Saturday, August 22, 2009

Neat logic synthesis freeware

I was trying to minimize a boolean circuit for a project I'm working on, and I found a really nice program called Simple Solver:

http://home.roadrunner.com/~ssolver/index.html

You type in a truth table, and it spits out a boolean equation and/or circuit that generates the correct output. You can constrain the part types, which of course is very useful if you're using discrete parts (e.g., 74HC gates).

For the problem I gave it, Simple Solver found a solution using 4 NAND gates, which exactly fits in a single 74HC00. Sweet.

Simple Solver can also generate circuits using flip-flops based on user-specified timing diagrams, which is a feature I'm planning to investigate at some point.

Friday, August 21, 2009

Electronics stuff

I've been having a lot of fun playing with electronics this summer. I completed my AVR microcontroller project, which involved designing a custom circuit board and having it manufactured. More details soon.

Since I feel like I have a reasonable handle on working with AVRs, I'm currently taking a step back, and learning about low-level digital circuits - gates, flip-flops, etc.

Several important issues arise when building digital circuits:
  1. You need to have a power-on reset to get all of the stateful circuit elements into a well-defined initial state
  2. You need a clock source
  3. To understand what is going on in the circuit, you need a way of visualizing the logic levels at important points
I solved the first two problems by constructing a small circuit with six pushbuttons, using a switch debouncing circuit I found in the Microcontroller Idea Book. Each button controls a single output pin. A button press causes the output pin to go low, and a button release causes the output pin to return high. Since a 74HC14 Schmitt-trigger hex inverter IC is used, there are six buttons/outputs. A picture:


The thing at the lower-right with the two wires sticking out of it is a single-row header socket, which is very handy for allowing wires to be plugged into a circuit on the fly. I will spare you a picture of the underside, where you can see how bad I am at soldering things. In any case, the thing works, and is useful for generating both reset and clock signals.

I addressed problem number 3 (visualizing logic levels) using a pair of 74HC04 (hex inverter) ICs to control 6 LEDs. Each input is fed through a pair of inverters, where the output of the second inverter controls the LED. So, the LED is lit if the input is high, and is dark when the input is low. Basically, each input is a really simple logic probe. (I found out by experience that you can't use a 74HC output to both light an LED and also drive an input.) The only minor hassle is that you have to tie the unused inputs to ground, but that's not a big deal. A picture:


Here, the LEDs are showing the output of (one half of) a 74HC139 2-to-4 decoder driven by a 74HC74 dual D-type flip-flop used as a 2-bit counter. When the clock button is pressed, the dark LED (the '139 decoder has active-low outputs) cycles through positions 0 (left) through 3 (third LED from the right). The last two LEDs are unused.

Monday, July 13, 2009

AS1106/AS1107 LED display drivers

I've been using the max7219 to control 7-segment LED displays. They're nice, and easy to use, but they're expensive (around $10).

I discovered today that there is a cheap alternative: the AS1106 and AS1107 from Austria Micro Systems. They appear to be functionally identical to the max7219 and max7221, respectively. And, you can buy them from Newark for $4 in qty 1. Sweet.

I've ordered some samples, so we'll see how they work out...

Friday, June 26, 2009

Super-nifty perl script for cropping pdf files

I often need to include a PDF file in a LaTeX document. This works great if the PDF file has a reasonable bounding box, but most software exports PDFs as full-page.

I found a really great perl script that will crop a PDF by settings its bounding box to precisely enclose the PDF file's contents:

http://ctan.org/pkg/pdfcrop

I used it on a couple PDF tables produced by (gag) Microsoft Word 2007, and it worked great.

Thursday, June 25, 2009

Fun with 7-segment LED displays

Here's a circuit with an atmega8 hooked up to a max7219 7-segment display driver chip, with six 7-segment LED displays:


The max7219 is the chip hidden in the rats nest of wires :-)

There's a ds1305 RTC chip on the breadboard, but it's not connected to anything yet.

Cheap USB AVR programmer

I have been using a serial-port AVR programmer (the Olimex one you can buy from Sparkfun) to do AVR development, but my laptop doesn't have a serial port.

There are a number of USB-based AVR programmers, and they're not particularly expensive (e.g., the Atmel AVR-ISP mkII is $34 from Digikey), but being the cheapskate that I am I was looking for something really inexpensive.

I'm happy to report that I've found one that works very well, and is only $10:

http://alldav.com/index.php?main_page=product_info&cPath=5&products_id=24

I'm using it with Sparkfun's AVR breakout board to bring the programming signals onto a breadboard using a single-row 6-pin cable from Digilent. Here's a picture of the whole setup:


The programmer is the small green board on the left. The breakout board is the even smaller red board connected to the programmer at a right angle.

In the host OS, the programmer appears as a serial port (/dev/ttyUSB0 on my Debian laptop). The programmer type for avrdude is "stk500v2".

As an additional bonus, the programmer supplies 5V to your circuit, using the host USB port as the power source. I don't think it will source a lot of current, but it's certainly fine for a few ICs and LEDs. The circuit on the breadboard in the picture has an atmega8 and an LED.

Friday, May 15, 2009

The Xfce challenge

Every Linux (and BSD) user who is currently using Gnome or KDE4 should try Xfce for a week or two.

I've been using Xfce for a couple weeks now, and I can't get over how much more pleasant it is. It's simple. It's unobtrusive. It does what you want with a minimum of fuss. It starts quickly. It reminds me why I use Linux and not a certain commercial OS from a company in Washington state.

I'm now running Xubuntu 9.04 on my desktop machine at work, and I have to say, it's really nice. I take back some of bad things I said about the beta (which utterly failed to connect to any wireless networks on my laptop). The nice thing about having a wired network connection is not having to deal with the disgraceful gnome network manager.

One interesting note about Xubuntu 9.04 is that I have configured it to use nouveau instead of the proprietary nvidia drivers (because the restricted devices manager could not download the latter.) I installed nouveau from the package repository, which apparently doesn't give you 3D acceleration, but I don't care about that.

I had to learn about and futz with xrandr, but eventually I got it completely working with both of my monitors (which are both 1680x1050 widescreens). Here's my xorg.conf if anyone's interested:
http://faculty.ycp.edu/~dhovemey/linux/nouveau-dualhead-xorg.conf