mini Logic analyzer on AVR Microcontroller
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.
Schematic of the circuit.
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).
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)
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.
PCB (55×65mm) and components placement.
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.
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
PCB Pricing: https://jlcpcb.com/quote
News on theme: