World’s Simplest Logic Analyzer for $5

Today’s post documents my recent hack that may just be the world’s simplest logic analyzer. More accurately, it is a circuit consisting of a 74HC126 quad buffer chip and R-2R resistor network (eleven 330 ohm resistors) that acts as a D/A converter, enabling one to analyze four logic lines with a single channel digital oscilloscope and $5 in parts!

With the circuit described below and an entry level USB scope like the PicoScope 2204, bursts of data can be captured at 10 MSps (million samples per second), and continuous capture rates of 2.5 MSps are possible, the length of the capture only limited by your PC’s memory. This is obviously much better than recently covered Bus Pirate’s 1 MSps for 4 ms!

Even higher throughput can be achieved with better scopes, although the A/D conversion requires several consecutive samples at same logic level, which means that a 100 MHz scope with 200 MSps capture rate should generally be able to analyze logic operating at ~40 MHz speeds. At such speeds, a fast buffer chip and D/A converter is naturally needed as well.

Above you can see an example of SD card traffic analyzed using my circuit – the full capture was 10 million samples which enabled me to capture all the traffic generated by my SD tutorial project without any additional triggering. Read on for details of the hack. A lot of effort has been made to keep the material very accessible and informative to electronics beginners, too. In the end of the article, source code for PicoTech 2000 series is included, and it can easily be adapted for any scope that can transfer captured waveforms to PC (in the simplest form by reading waveforms from a CSV file).

How It Works

Basic idea is to connect 4 logic lines to a D/A converter, that will transform the binary 1/0 values (represented by VCC and GND voltage levels, respectively) into a 16-step analog waveform. Because input lines cannot be directly connected to the R-2R resistor network that is used to do the D/A conversion, a 4-line buffer chip is used in between to provide high impedance inputs that do not interfere with the logic being analyzed.

Continue reading World’s Simplest Logic Analyzer for $5

Handy Pinout Reference Sheet

Just thought to share a quick tip today. I’ve noticed that when doing work with AVR MCU’s, I’m using ATtiny2313, ATmega88 and ATtiny45/85 for 99 % of the time. I got tired of opening the Atmel data sheets every time when swapping a new chip into a breadboard, so I constructed a real cut’n’paste reference sheet by gluing the relevant portions on a piece of rigid cardboard:

I even used a piece of paper to mark the 6-pin header pinout, it’s a real time-saver! And thanks to the cardboard back, it’s easy to keep below my LCD monitor and pull out every time I need it. Additional idea would be to leave some white space around the pinouts and laminate it with clear contact paper, so I could doodle project-specific notes with a water-based marker and clean it after I don’t need them anymore!

Oh, and as you can see, I’m using a Mac this time to do some flashing. I installed the excellent Crosspack for Mac from Obdev guys. It’s a streamlined way to install avrdude and avr-gcc on a Mac, and now I can take my electronics hobby with me when I’m traveling. :)