กลับไปหน้ารวมไฟล์
interleaving-oscilloscope-get-a-nice-20khz-wave-with-uno-3debd0-en.md

I needed to setup a cheap kit - due to COVID-19 - for an oscilloscope for a basic physics course (LCR circuits) at a public-and-free university so that the students could work from home. Never having used an Arduino, but decided to go this way, I found the nice project of Veldekiaan. But, I needed to study resonances and L/R time constants for inductors that would plug into a small protoboard: thus I needed higher speed than his original project while keeping reasonable accuracy. I then modified his code (this project heavily borrows on his) and added an interleaving sampling at the fastest scale (100µs/div), reaching a 3µs time resolution. I also added a "Save Channel" option in his "Processing" sketch, so that the students could treat and fit the data externally. For the connections proposed the "Counter" does not work. The software implementation I made is a quick fix to get this working, maybe not portable, and certainly it is not optimized. This is my first post here and I do not have much time to logon here or answer questions: sorry. I may do that occasionally. But I think this is a nice extension of Veldekiaan's work that will be useful for many people.

Screen from the RC circuit shown.

EXPANDED TECHNICAL DETAILS

High-Speed Sampling Hack

Standard Arduino Uno sampling is too slow for 20kHz waves. This "Interleaving" technique pushes the hardware beyond its documented limits.

  • ADC Interleaving Logic: The Arduino samples the signal multiple times, but each time it delays the start by a tiny bit (a few microseconds). By stitching these "slightly shifted" captures together, it creates a much higher effective sampling rate.
  • Direct Port Manipulation: To achieve this speed, the firmware bypasses the slow analogRead() function and communicates directly with the ADMUX and ADCSRA registers, reducing processing overhead to near-zero.

Visual Output

  • Processing Display: The high-frequency data is visualized on a PC using Processing, providing a clear 20kHz sine or square wave display that would normally require mid-range specialized hardware.

ข้อมูล Frontmatter ดั้งเดิม

title: "Interleaving Oscilloscope - get a nice 20kHz wave with UNO"
description: "Based on a referenced project I implemented interleaved sampling for repetitive waves triggered at same point, achieving 3µs resolution."
author: "claudiolenz"
category: "Lab Stuff"
tags:
  - "oscilloscope"
  - "monitoring"
  - "education"
views: 11822
likes: 3
price: 2450
difficulty: "Intermediate"
components:
  - "1x Arduino UNO"
  - "1x AD9833 - DDS"
tools: []
apps:
  - "1x Processing"
downloadableFiles:
  - "https://projects.arduinocontent.cc/5b4763b5-8dee-4a41-841a-dc5a8d60d052.ino"
documentationLinks: []
passwordHash: "3c2067b0c31a5832d5aa1cc831a7bab0f10529c5cb14e7b4055be5605ba2aa65"
encryptedPayload: "U2FsdGVkX18rOoNGFxcsPJkmW112UtK1i2muwFNnU13jhLQfpABTKGuDPGditWuytT0iQpRwSbY8awXL9grfDgUFmQTjHbzWqFqoiySIbNI="
seoDescription: "Build an Interleaving Oscilloscope with Arduino UNO. Achieve 20kHz wave visualization using interleaved sampling and 3µs resolution."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/interleaving-oscilloscope-get-a-nice-20khz-wave-with-uno-3debd0_cover.jpg"
lang: "en"