Arduino Nano 20KHz Pocket Sized Digital Oscilloscope.

by sainisagar7294 in Circuits > Arduino

12510 Views, 104 Favorites, 0 Comments

Arduino Nano 20KHz Pocket Sized Digital Oscilloscope.

mini_Untitled.png

Previously, I posted a tutorial on Raspberry Pi-Pico Oscilloscope. And that was a great success. Keeping portable options in mind, I found this pretty mini oscilloscope between thousands of pages of a Japanese website. We are using a mini-OLED 128X64 to display the signal waveform, Frequency, duty cycle. 4 tactile buttons are used to change the modes, Volts/Divisions, and time/Divisions. So, I tried this, and the results are here.

Note* This project is only for educational purposes and shows the capabilities of a 16Mhz 8-bit microcontroller board. This MCU Can support frequencies below 50KHz, so it can’t be applicable for commercial and professional uses. That way, the project can also be entitled POOR MAN OSCILLOSCOPE for me.

Supplies

Components used:

  • Arduino Nano
  • 128X64 OLED display
  • 100k,10k,820k,510k,12k resistors
  • 100nf, 7pf, 1uf ceramic disc capacitors
  • Tactile switch x4
  • Breadboard
  • Connecting wires

Arduino Nano/Uno:

audio signal.gif
mini_20220121_142435.jpg

Both the boards have the same 8-bit Atmega328p microcontroller to use any of them. This tutorial uses I2C communication to print the readings on an OLED display. Our microcontroller has 6-channel 10-bit ADC, 13 digital I/O pins, and an 8Mhz internal clock.

That's why I tried the project on breadboard first. I want to know the plus/minus points of this oscilloscope. This project is sponsored By JLCPCB, Pcb, code and circuit diagram to this project is given below. Download all Gerber file from here and Quote for PCB on JLCPCB just in $2, On first sign-up from here you will get worth $30 coupons to order PCB.

For PC: https://jlcpcb.com/SSR

For mobile phone: http://m.jlcpcb.com/ssi

Features:

  • Single-channel -20Khz bandwidth
  • Onscreen- Volt/Div and Time/Div
  • Duty cycle monitoring
  • Small 0.96-inch I2C
  • AC/DC measurements option
  • Mode changing, Hold state features
  • Low battery consumption
  • Portable and pocket-sized


Display:

alpha.jpg

0.96-inch OLED display with I2C function comes with two different models, SSD1306 and SH1106, to change the code as per requirements. We have to uncomment which version of LCD we are using in this project.

Circuit Diagram:

rt.png
er.png

Both given circuits are same, You can use any of them as reference.

Mode Selection

MENU.gif

After making all the connections, this oscilloscope can be powered by a 5v @100mA power supply or 3.7 volt Battery. Significantly fewer external components are used in this project; also, it supports several actions. Here MODE button is to select the volt/div, time/div, AC/DC, and 180* wave settings.


Volt/division Selection:

VOLT DIV.gif

After selecting the Mode, we can either increase the value or decrease per wave format. For Volts/divisions: This oscilloscope supports a division from 0.2volts to 50volts.

Time/division Selection:

TIME DIV.gif

For Time/Div: Code is modified to display small divisions in microseconds, 1.56 microseconds to 200milli-seconds.

Measurements:

50HZ.gif
mini_20220121_143037.jpg
SINE.gif

I tried to hook up this oscilloscope directly with Step down transformer AC signal and here are the results:

With 50Hz Sine wave, 310 Hz sine wave

Rectangular, Triangular and Sawtooth:

RECT.gif
SAWTOOTH.gif
TRI.gif

Libraries Used:

ice_screenshot_20220122-232703.png

OLED display SSD1306, SH1106 , Fix_fft and EEPROM libraries are available in Arduino Mange library section. From here you can download as per your needs.

Code:

Code is quite bit long, so we added comments on all lines so that you can understand this. Code version 1.1

Download all the material regarding this project from here.

Preview:

// Follow us on Hackster, Hackaday and the Instructables.
//Please First uncomment/comment the oled driver lines, which you are using
//Circuitkicker.com -- Sagar saini --sainisagar7294


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//#include <Adafruit_SH1106.h>            // https://github.com/wonho-maker/Adafruit_SH1106
#include <EEPROM.h>


#define SCREEN_WIDTH   128              // OLED display width
#define SCREEN_HEIGHT   64              // OLED display height
#define REC_LENG       200              // size of wave data buffer
#define DISP_LENG      100              // size of display data
#define MIN_TRIG_SWING   5              // minimum trigger swing.(Display "Unsync" if swing smaller than this value
#define DOTS_DIV        25


// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1              // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);   // device name is oled
//Adafruit_SH1106 oled(OLED_RESET);        // use this when SH1106


#define R_12k   4        //  12k ohm
#define R_820k  16       //  820k ohm  for AC low range
#define R_82k   17       //  82k omm for AC Hi range

PCB:

Arduino oscilloscope.png

Download all the material regarding this project from here.

Gerber files

Circuit diagram

Arduino Code

Conclusion:

raspberry oscilloscope.png

This oscilloscope is suitable for analyzing waveforms between 10Hz to 20Khz. That is precisely human hearing frequency. So, we can use this to measure audio signals, amplifier signals, and different Bluetooth signals. This oscilloscope should be a good try for them. Also, I think precision matters a lot in signals. If you want to go professional but cheaper, I would recommend DSO138. But this is about 4x the cost of this Arduino oscilloscope, but this one has an analog frequency range of 200khz.

In comparison with This DSO, I have An Article about Raspberry Pi- Pico Oscilloscope, which offers android application compatibility, 2-channel, and 200khz frequency range. See this PI-PICO Oscilloscope from here.

About JLCPCB:

mini_I.png

JLCPCB is the one of the most popular PCB makers. Price is just $2 for 2, 4 and 6 layer PCB. They just launched new purple solder mask, aluminum Pcb and 3d printing service in very low cost. Pcb quality is not compromised at any cost. Check them out right now from Here.

JLCPCB Is also providing new user coupons and sign-up rewards of up to $30. So, check them out from here. Register using this link to get Free PCB assembly service coupons. Get your 2 layer to 6-layer PCB’s just in $2, stencil and PCB assembly service in just $7.

For PC: https://jlcpcb.com/SSR

For mobile phone: http://m.jlcpcb.com/ssi

Updates:

ice_screenshot_20220120-203539.png
ice_screenshot_20220120-203546.png

We are trying to use a big touch TFT color screen with a high resolutions, So the project will be updated as soon as possible till then keep supporting us, we did not want any type of financial support, just follow us.

More Projects:

1) How to make Arduino Uno clone board.

2) How to program Arduino Using Smart Phone.

3) Arduino Nano clone board problems and solutions.

4) How to make Inductance Meter Using Arduino.

5) Raspberry Pi- PICO Oscilloscope.

Think you enjoy my work, stay tuned. Follow us on Instagram (sagar_saini_7294) and hackaday.

please support us- No donations, just follow and leave a comment.

Gallery:

mini_20220121_143202.jpg
ice_screenshot_20220120-204832.png
mini_20220120_153731.jpg
mini_20220121_142357.jpg
mini_20220121_143636.jpg
mini_20220121_142652.jpg
mini_20220121_142729.jpg