Scanalogic: the beginning!

Scanalogic: the beginning!

Here is one project we are really proud of, and we hope that its simple design will encourage you to build your own, and use the provided software to obtain your own logic analyzer for less than 10$. This device can help you in most of your projects, it’s an essential measuring device when it comes to digital electronics. Those pages will discuss all what you need to know to understand how it works, and build your own, and use it.

What is a Logic Analyzer?

You could read the definition on Wikipedia, but as you may already know, I have my way of explaining things to beginner!

I would say that a logic analyzer is a device used to view the voltage of “logic” electric signals that are usually too fast to be measured by a voltmeter. A logic analyzer it not exactly like an oscilloscope, as it cannot measure analog voltages. Actually, it can only measure the logic state of a signal, see if it’s a 1 or a 0. ‘0’ being Zero volts and ‘1’ being 5V (for classic TTL logic devices).

The main keypoint that makes a logic analyzer better than another is the sampling rate, or the maximum number of samples that can be recorded by second.

From a functional point of view, a logic analyzer records the states of logic signals, usually after some ‘triggering condition‘ is met, then, recorded signals are displayed on a screen for in depth analysis.

Introducing Scanalogic

Scanalogic is a simple, yet effective logic analyzer specially designed to be easily built by beginners, so that it can be used for debugging and analyzing their projects.

figure 1.A

It can be used at sampling rates as high as 4 Million Samples per second. It has only four channels, but that is more than enough for most hobby projects, further more, most communication buses nowadays have very few transmission lines, ranging from two to four, so decided four was more than enough.

Scanalogic is a combination of a hardware (figure 1.a) and software application (figure 1.c). As you will see later, the hardware is as simple as it can get: An ATMEGA16 micro controller and a NAND gate! The code to be loaded in the micro controller is provided at the end of this page.

figure 1.B

The hardware records the samples at the desired sampling rate, then send them to the PC application via the UART port of the microcontroller and the RS232 port of the PC. If your PC doesn’t have an RS232 port, as mine, you can still use a USB-RS232 converter cable, as shown in figure 1.b.

The software is made with visual basic. A zip file is included at the end of the page. It is compatible with windows ME all the way up to XP (or maybe Vista, can someone confirm?).

figure 1.C

The Scanalogic software controls the hardware (as you can see, there are no buttons on the hardware) It allows you to setup the triggering conditions, to start sampling, to receive sampled signals, display them, analyze them, and even store them for later analysis.

Building the hardware

There are no secrets held for the hardware, as the real power of this logic analyzer comes from the innovating source code, loaded inside the ATMEGA16 microcontroller.

figure 2.A

As you can see in figure 2.b, there are only a microcontroller, and a NAND gates IC and all of it resides in an old CDROM power supply box. The DB9 connector for serial communication is firmly glued to the box with an epoxy resin. The whole is powered from the RTS line of the RS232 connection (pin number 4), so there is no need for external power supply (but you may as well use any 5V power supply if your serial port cannot deliver the required current).

As you can see in the schematic below (figure 2.b), there are no level shifting IC like the MAX232, but believe or not, most if not 100% of current serial communication hardware is compatible with the approach below, where the signals are simply ‘inverted’, but not shifted to +/- 12V. (Originally, in the RS232 protocol, a logic 1 is represented with -12v, and a logic 0 is represented by +12V).

Pin 4 of the DB9 connector is used to power the device, as it rises to +12V (theoretically) when a communication is being carried out. The Diode D3 makes sure no negative power supply is applied to the device, and the 5.1V zener diode D4 prevent supply voltage from rising above 5.1 volts. Using the handshaking signals as a power supply is far from being my invention, it have been used in a lot of devices like mice and old external keypads…

figure 2.B

The probes are directly connected to micro controller. A better approach would be to add buffers to protect the micro controller but, for simplification, I didn’t include one.

The crystal oscillator X1 can be anything from 1Mhz to 16Mhz, but remember that the clock frequency of the microcontroller directly affects the maximum sampling rate, according to the following equation:

Max_Sampling_rate = Clock_frequency/4

That is simply because, the most efficient code I could ever write, needs at least four clock cycles to sample and store new signals.

D1 is simply a red LED, used to signal if the device is powered up and correctly functioning.

Download the hex file to be loaded into the ATMEGA16 for different crystal frequencies:

(Need hex files for other frequencies? request for it in the form in bottom page)

Downloading and using the PC side software

Scanalogic software, especially this first version is very simple and intuitive.

After you have plugged the Hardware, the configuration is simply made via 3 steps:

  1. Press F2 to chose the crystal frequency at which your microcontroller is running, and to chose the COM port to which the hardware is connected.
  2. Press F3 to chose the sampling rate.
  3. Press F4 to chose the triggering condition.

Then you simply need to Press F5 anytime to start the sampling. Note that if you chose a triggering condition, the sampling will only start when this condition is met.

Download the installation file for SCANALOGIC

I hope this article was useful. Any comments and further questions are welcome in the form below.


[PrettyFileButton path=””][/PrettyFileButton][PrettyFileButton path=””][/PrettyFileButton][PrettyFileButton path=””][/PrettyFileButton][PrettyFileButton path=””][/PrettyFileButton]


  1. Dan April 15, 2015 at 6:38 pm

    Same message : “Connecting to hardware… — FAILED! — Press F5 to try again”
    What are fuses & bytes for programming Atmega 16 ?!
    Thanks in advance ! Kind regards !

    • Dan April 16, 2015 at 6:57 pm

      SOLVED !!!
      I checked the supply voltage, provided by the serial port and I found it very small, about 2.4 volts. I powered schematic of external AC 5 volt stabilized and now everything works just fine !!! THANKS Mr.IBRAHIM KAMAL !!! Regards !

      • Dan April 17, 2015 at 3:50 pm

        LE : Fuses and bytes used (with 12 MHz quartz) = LFF ; H89.

  2. 12val12 January 14, 2015 at 11:22 pm

    I need decoding ~10Mhz spi
    main atmega16 worked at frequency 40Mhz(overclocked)
    Give me please hex file for uart speed 57600 ?

    • Ibrahim KAMAL January 15, 2015 at 9:41 am

      For that you need the ScanaPLUS, as it has a 100MHz sampling rate, and can easily capture 10MHz SPI signals.

  3. rom October 1, 2013 at 3:34 am


    i’m trying to build your wonderful device on ATMEGA16A, but always get
    “Connecting to hardware… — FAILED! — Press F5 to try again”
    Two XP/7 desktops with hardware com ports (loopback checked), avr programmed and verifyed, led shines! i’ve tryed with all 8-12-16 Mhz crystals with required hex, but result is the same: FAILED!

    please give me a direction, what else can i check ?

    p.s. or may be you can share source code and i’ll debug my problem step-by-step?

  4. tonich September 30, 2013 at 2:01 am

    Thank you very much for this usefull device !

    Can you please give us sources ??!

  5. Treehouse Projects December 24, 2012 at 4:50 pm

    Hi Ibrahim,

    Great project, I really could use this. Unfortunately, I am having a bit of trouble at the last step. I have tested my ATmega16 and ensured that the UART works correctly. I am using a 16 MHz clock speed. The problem I am experiencing is with the software. It connects to my COM port correctly (I am using MAX232 by the way), but when it tires connecting to the hardware, it says:

    “Connecting to hardware… — FAILED! — Press F5 to try again”

    I have tried several times, with no luck. I am running this on Windows 7, and the software, except for this problem, seems to be working great.

    Thanks buddy, looking forward to your response.

    • Treehouse Projects December 24, 2012 at 11:41 pm

      Some additional notes:

      – I am experiencing the same exact problem on Windows XP
      – The LED turns on, on PC0
      – I am using avrdude with the following command: avrdude -P usb -c usbasp -p m16 -U flash:w:LOGIC-ANALYZER-16Mhz.hex
      – I am drawing the power from a USB port
      – I am using an ATmega16 not 16L, which shouldn’t make a difference
      – The Scanalogic software detects and connects to the COM port successfully, but gets stuck when connecting to the hardware

      I’m truly baffled, and can’t figure out what the problem could be. I would really appreciate it if you could help me out. Thanks again.

      • Ibrahim KAMAL January 9, 2013 at 8:49 pm

        I am not sure if that’s the only problem, but here is one for sure:
        Page 1 of the datasheet says:

        Speed Grades
        – 0 – 8 MHz for ATmega16L
        – 0 – 16 MHz for ATmega16

        So the ATmega16L wont work with 16 MHz crystal!

        • Max August 25, 2013 at 6:33 pm

          Hello Ibrahim,

          I have the same problem as Treehouse Projects!
          Do you already fix this problem?

          It would be very nice i you could help me

  6. Ibrahim KAMAL November 1, 2012 at 11:33 am

    normally yes.. the idea is very simple, so any mcu should work..

  7. Ibrahim KAMAL November 1, 2012 at 11:32 am

    will try to find this and post it 🙂

  8. Ravi August 28, 2012 at 6:12 am


    Do you plan to come up with something similar based on PICmicro 18F2550? This is a 28 pins uC with USB and RS232.



    • Ibrahim KAMAL August 29, 2012 at 7:28 pm

      We’ve got many many many projects going on. certainly not with PIC, but we want to also invest in open source projects. Please keep following us 🙂

  9. Tomek August 27, 2012 at 9:13 am

    Any chance to get the source code for uC and Visual Basic ? 😉

  10. Phil Taylor August 12, 2012 at 11:13 am

    Hi Ibrahim,

    Excellent work.
    I would like to try this on a ATmega168 at 20 MHz and would be grateful if you could supply a hex file
    for this.


  11. sdfdskfjdsk May 23, 2012 at 4:47 pm

    Any way we could get some Linux software for this project?

  12. Marek Bogiel May 23, 2012 at 10:28 am


    Nice work, I’m impressed. I try build this analyzer myself. Unfortunately I am not familiar with AVR uP. When I try program Atmega16 I must set (or reset) something call ”fuse”. I have no idea what to do. Can you tell how to set this fuses? If you can, please tell everything about CKSEL0,CKSEL1, …., etcetera. Sorry for my bad english, but this is not my national language.

    best regards Marek

  13. mat May 19, 2012 at 6:09 pm

    Could you compile hex for Atmega32 / 16MHz and send me via e-mail:

  14. Geoff Gustav Stacey May 15, 2012 at 6:02 am

    Cpngratulations for a briliant design.

    I want to build, but mystified by 6 way Connector called ISP 31.

    Merci , G. Stacey

    • Ibrahim KAMAL May 15, 2012 at 9:29 am

      Nothing fancy about this ISP J1, it’s the ISP connector for the programming…

      • Geoff Gustav Stacey May 18, 2012 at 2:13 pm

        Thanks Ibrahim,

        So I get out my New AVG Programmer , (Marked S51 & AVG and with ////////////// USB connector )
        and examine the other end. The contacts are labeled J2 MOSI, nc, RST, SCK, MISO on one side. With VCC then four GND Pins.

        I have read somewhere both 6 pin and ten pins are standard — but I’m horrified if the sequence is not !

        I was hoping the connection from the DB9 (pins 2 and 3 ) connecting thru a Nand gate (wired as two inverters . .. Yes OK ! ). .. Hoping these Made a serial input (providing I used the correct crystal ) .. . down which I could send my programming data stream ! ?

        But no such luck !

        As a further check

        i’ll ask which is on the Programmer.

        Yours Geoff Stacey , DDP 1960/1961

Leave A Comment