Skip to content

bytemaster0/Microcontroller-LogicAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArduLogic

8-channel logic analyzer firmware and desktop capture application, implementing the SUMP protocol. Works with the included Python app and any other SUMP-compatible client (sigrok / PulseView, OLS client, etc.).

Supported boards

Board Max sample rate Capture buffer Input voltage
Arduino Uno R4 WiFi 1 MHz 4 096 samples 3.3 V and 5 V
ESP32 Dev Module (WROOM-32) 5 MHz 16 384 samples 3.3 V only

ESP32 Dev Module (ESP-WROOM-32 / ESP32-S)

1 — Install the board package

In Arduino IDE: Tools → Board → Boards Manager → search esp32 by Espressif Systems → Install.

No BSP patches are needed. The on-board CP2102 or CH340 USB-to-serial chip works with pyserial out of the box.

2 — Board settings

Setting Value
Board ESP32 Dev Module
CPU Frequency 240 MHz
Upload Speed 921600

3 — Flash the firmware

Open firmware/ArduLogicESP32/ArduLogicESP32.ino, select the port, click Upload.

If the upload fails, hold the BOOT button on the ESP32 board while clicking Upload, then release it once "Connecting…" appears in the log.

4 — Wiring

ESP32 GPIO pins are 3.3 V only. Applying 5 V will damage the chip. Use a level shifter (e.g. TXS0108E) or a resistor voltage divider for any 5 V signal source.

Standard 38-pin WROOM-32 dev board layout. The eight channel pins are on the left side (GPIO 13, 14) and right side (GPIO 16–22):

        ┌─────────────────────────────────────────┐
  GND   │ ○                               ○       │ 5V
  3V3   │ ○                               ○       │ GND
   EN   │ ○                               ○       │ 23
   36   │ ○                               ○       │ 22 ◄─── CH7
   39   │ ○                               ○       │ TX
   34   │ ○                               ○       │ RX
   35   │ ○                               ○       │ 21 ◄─── CH6
   32   │ ○                               ○       │ GND
   33   │ ○                               ○       │ 19 ◄─── CH5
   25   │ ○                               ○       │ 18 ◄─── CH4
   26   │ ○                               ○       │  5
   27   │ ○                               ○       │ 17 ◄─── CH3
   14   │ ○ ◄─── CH1                      ○       │ 16 ◄─── CH2
   12   │ ○                               ○       │  4
  GND   │ ○                               ○       │  0
   13   │ ○ ◄─── CH0                      ○       │  2
        │                  [ USB ]                 │
        └─────────────────────────────────────────┘

  CH0 ── GPIO13    CH4 ── GPIO18
  CH1 ── GPIO14    CH5 ── GPIO19
  CH2 ── GPIO16    CH6 ── GPIO21
  CH3 ── GPIO17    CH7 ── GPIO22

Connect a GND pin on the ESP32 to the ground of the signal source.


Arduino Uno R4 WiFi

1 — Install the board package

In Arduino IDE: Tools → Board → Boards Manager → search Arduino UNO R4 Boards → Install.

2 — Apply BSP patches (one-time, required)

The R4's native-USB CDC stack has two bugs that prevent communication with pyserial on Windows. Apply the project's patches before flashing:

python scripts/apply_bsp_patches.py

This backs up the originals as .orig files and copies the fixed versions in their place. To restore the originals at any time:

python scripts/apply_bsp_patches.py --restore

After updating the board package via Boards Manager, re-run apply_bsp_patches.py — updates overwrite the patched files.

3 — Flash the firmware

Open firmware/ArduLogicR4/ArduLogicR4.ino, select Tools → Board → Arduino UNO R4 WiFi, select the port, click Upload.

4 — Wiring

The R4 tolerates both 3.3 V and 5 V logic on its digital pins directly — no level shifter needed.

  Arduino Uno R4 WiFi          Signal source
  ───────────────────          ─────────────
  D2  ──────────────────────── CH0
  D3  ──────────────────────── CH1
  D4  ──────────────────────── CH2
  D5  ──────────────────────── CH3
  D6  ──────────────────────── CH4
  D7  ──────────────────────── CH5
  D8  ──────────────────────── CH6
  D9  ──────────────────────── CH7
  GND ──────────────────────── GND (shared with signal source)

Desktop app — ardulogic.py

Requirements

Python 3.10 or later.

pip install pyserial PyQt6 pyqtgraph numpy

Launch

python app/ardulogic.py

Connecting

  1. Plug in the board and wait a moment for the COM port to enumerate.
  2. Click Refresh Ports and select the correct port.
  3. Click ▶ Capture.

The app sends a SUMP QUERY_ID to identify the device, then QUERY_META to read the board's actual maximum sample rate and buffer size. If you select a rate the device cannot achieve, the app automatically caps it and shows a note in the status bar — so the time axis is always correct.

Sample rate

Rates above the connected device's maximum are capped transparently:

Rate R4 WiFi ESP32
100 Hz – 500 kHz
1 MHz ✓ max
2 MHz capped → 1 MHz
5 MHz capped → 1 MHz ✓ max

Sample depth

Depth R4 WiFi ESP32
64 – 4 096
8 192 – 16 384 capped → 4 096

Triggers

Choose a Channel and Level (High / Low) in the Trigger panel. The firmware waits up to 10 seconds for the condition before capturing. Set trigger to None (immediate) to capture without waiting.

Cursors and measurements

Two vertical cursor lines appear after a capture — yellow (A) and blue (B). Drag either one in any trace; the status bar updates live:

Cursor A: 12.340 µs  |  Cursor B: 56.780 µs  |  Δt = 44.440 µs  |  f = 22.504 kHz

Zoom and pan

Action Result
Scroll wheel Zoom X axis (time) at the cursor position
Click and drag Pan left / right
Zoom to Fit button Reset view to show the full capture
Right-click on plot Reset axes on that trace

The Y axis is locked — waveforms always fill their lane cleanly regardless of which trace you scroll on.

Channel labels

Type a name in the Channel Labels fields (e.g. CLK, MOSI, CS). Labels update the waveform display live and are included in CSV exports.

CSV export

Click Save CSV… after a capture:

time_s,CLK,MOSI,MISO,CS,CH4,CH5,CH6,CH7
0.000000000,0,0,1,1,0,0,0,0
0.000001000,1,0,1,0,0,0,0,0

sigrok / PulseView

Both firmwares report a standard 1ALS SUMP device ID, so PulseView detects them automatically:

  1. Connect to a device → Driver: Openbench Logic Sniffer & SUMP compatibles
  2. Interface: Serial port → select the board's COM port, baud rate 115200
  3. Click Scan for devices

PulseView's full protocol decoder library (SPI, I²C, UART, 1-Wire, …) works out of the box.


Project layout

ArduLogic/
  firmware/
    ArduLogicR4/
      ArduLogicR4.ino         Firmware for Arduino Uno R4 WiFi
    ArduLogicESP32/
      ArduLogicESP32.ino      Firmware for ESP32 Dev Module
  app/
    ardulogic.py              Desktop capture application
  bsp_patches/
    renesas_uno_1_5_3/        Patched core files for arduino:renesas_uno 1.5.3
  scripts/
    apply_bsp_patches.py      Applies / restores the R4 BSP patches

Troubleshooting

"Unexpected device ID" on R4 WiFi
Run python scripts/apply_bsp_patches.py, then re-flash. The patches fix two bugs in the Renesas USB CDC stack that prevent pyserial from communicating on Windows.

No ports listed

  • R4: check that the USB cable carries data (charge-only cables have no data wires).
  • ESP32: install the CP2102 or CH340 driver for your OS if the port doesn't appear.

Capture times out
A trigger condition that never occurs causes the firmware to wait the full 10 seconds before giving up. Switch to None (immediate) to test without a trigger, then re-enable it once the signal is confirmed.

ESP32 won't upload
Hold the BOOT button while clicking Upload; release when "Connecting…" appears in the Arduino IDE log. This is required on some ESP32 boards to enter flash mode.

About

A logic level analyzer that uses an ESP32, Arduino Uno R4 WiFi, or Arduino Pro Micro as the data source. Python application for display.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors