mini Logic analyzer on AVR Microcontroller

Vassilis Serasidis

Introduction

This mini Logic analyzer is a tool for you to watch on LCD the logic transitions 0 or 1 of a digital data signal. A digital data signal can be found on the output pin of TSOP-1736 Infrared Receiver, on the Transmit and reveive pins of MAX-232 chip (RS-232), on Clock and Data pins of I2C data bus and many more electronic components. This circuit supports capturing for up to 400 kHz digital signals.

Миниатюрный логический анализатор на AVR Миниатюрный логический анализатор на AVR

Features

  • Capturing frequency - 400 kHz
  • Logic inputs voltage - up to +5 V
  • Power supply - Maximum 4.8V DC (4 x 1.2V recharchable batteries)
  • Liquid Display Crystal - 84×48 pixels
  • Capturing length signals: From 3.7ms for high speed signals, up to 36s for low speed signals

Schematic of the circuit.

mini Logic analyzer on AVR
Click to enlarge

The operating voltage of the circuit is 4.8V DC from 4×1.2V rechargeable batteries. Switch on the S1 to power on the electronic circuit. After the initial screens on LCD you will see a message that the Atmel AVR ATmega8 waits for a signal change on input pins. The AVR has 4 external pull-down resistors 33k (R2-R5) avoiding any unnecessary trigger on any input pin because of an external electromagnetic field or by touching accidentally your hand on any input pin. The Nokia 3310/5110 LCD works from 3.3 - 5V power supply. The problem is that the LCD's backlight works with Maximum 3.3V DC. So I put diodes D1-D3 to decrease the voltage from 4.8V to 4.8-(0.7×3)=2.7V that is the required power supply of Nokia's LCD. When you power ON the circuit, the LED1 is turned OFF. After the first trigger on any of 4 input pins, this LED is turned ON and the AVR starts capturing the data in to its internal RAM buffer (290 samples).

ATTENTION!!!

Do not use regular alcaline 1.5V batteries instead of rechargeable. The total voltage is 4 × 1.5 = 6V. This voltage will probably burn the LCD and the AVR microcontroller.

The softwar (firmware)

The data capturing process.

The data capturing process.

As you can see on Picture 5 the data buffer is constituted by 870 bytes (v1.00) 2 for the counter and one for the input pins information. In version 1.01 the data buffer was decreased to 256×3=768 bytes for increasing the capturing speed because the buffer size variable is 8 bit instead of 16 bit that I used before. The next byte calculations must be done according to the firmware version you use.

How it works? It is simple. After the power ON the AVR waits for a trigger pulse on any of 4 input pins. If a trigger pulse is detected the AVR starts counting the time is needed for the next trigger on any of the 4 input pins. The sample length is stored in a 16-bit variable named "counter". When this variable overflows, the status of the 4 input pins and the counter value are stored in the buffer and its address is increased by 3 (2 bytes for counter and 1 byte for input pins data). This process is been made until the AVR fills all the buffer bytes (870/3 = 290 samples or triggers). When the AVR fills the buffer, all the data are appeared on LCD as a graph. You can move the graph to the left ( button S3) or to the right (button S4) to watch the entire data sequence. If the data sequence is in a low speed you can shrink the graph (zoom out) with a 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 or 8192 ratio by pressing the S2 button.

Programming The ATmega8

Burn the ATmega8 with miniLogicAnalyzer.hex and select external crystal at the fuses section.

The fuses that must be set on ATmega8 microcontroller.

The fuses that must be set on ATmega8 microcontroller.

PCB (55×65mm) and components placement.

components placement for mini Logic analyzer on AVRВид печатной платы логического анализатора

History:

04 February 2012 (v1.01) - I did a re-compilation of the source code with AVRstudio-5 (version 5.0.2123) and I saw a much better stability of the captured signals. So, I put the source code and hex files for both AVRstudio-4 and AVRstudio-5 in the same v1.01 zip file.

03 February 2012 (v1.01) - Capturing speed was increased from 100kHz to 400kHz.

02 January 2012 (v1.00) - Initial version by Vassilis Serasidis.

Demonstration Video

Downloads

v1.01 Source code and hex file of updated mini Logic Analyzer - download

v1.00 Source code, hex file, schematic diagram, PCB and photos of mini Logic Analyzer -download

serasidis.gr

You may have to register before you can post comments and get full access to forum.
Fragments of discussion:Full version of discussion »
  • a simple scheme of the available components/ The device has a good good characteristics. Using 4 channels you can analyze different signals
EMS supplier