# Make a Digital Oscilloscope Via Arduino

17,470

162

6

## Introduction: Make a Digital Oscilloscope Via Arduino

Often seen people making online digital oscilloscope, DSO must have digital-analog conversion unit, according to d/a conversion circuit can be divided into two modes: 1. Special ADC chip + single-chip, 2. using single-chip ADC count inside the converter. For the first model I tried two (see my blog: http://blog.Sina.com.CN/ntwhq), this circuit is a little more complex, component is more difficult to complete, it is difficult for beginners. The second structure is relatively simple, easyto make, but has a significant drawback, that is, within a narrow bandwidth, one of the more typical works are the overseas friends of http://www.serasidis.gr/circuits/AVR_oscilloscope/avr_oscilloscope.htm, the bandwidth of the oscilloscope only 7.7KHz. Domestic users and STC single-chip AVR production, but the actual bandwidth is less than 10KHz.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Code

Recently saw a net friend with Arduino oscilloscope, itmay be easier than the second method above, but their results are not ideal, the bandwidth is narrow. So I wanted to try and see and there is no good way to solve this problem. Produced by experiment, and constantly modify the code, and improved d/a conversion sample rate, very good results have been achieved.

The main parameters of the final product: Frequency response: 10Hz-50KHz Power supply: 5V LCD LCD screen: 128x64 (ST7920) Measurement display area: 96x64 Information display: 32x64, displays the frequency of the test signal, Vpp, and more Sync: rising edge triggers Scan speed: 0.02ms/div~10ms/div, carrying nine 1-2-5 Hold function: freeze the displayed waveform and parameters Second, basic test Using the Arduino project's biggest advantage is its rich resources, and do not need much knowledge of SCM. I made using a repository u8glib LCD, making it easier to program, or LCD drive will cost you a lot of time. U8glib download: u8glib_arduino_v1.13.zip (989.55 KB, downloads: 2577) Here is my first test circuit for Arduino UNO building, of 12864 LCD LCD using ST7920 control. As long as the input method in the following code, compiled after download you can achieve the basic functions of digital oscilloscope, wouldn't it be simpler?

```# Include //statementU8GLIB_ST7920_128X64_4X u8g(13, 12, 11); Statement LCD SPI Com:SCK =13, MOSI = 12, CS = 11
int x,y; Painted point coordinates
int Buffer[128]; Cache storage array
void setup( ) { }
Sample
void sample( )
{
for(x = 0;x < 128;x++)
for(x = 0;x < 128;x++)
Buffer[x] = 63-(Buffer[x]>>4); Calculate y values
}
Display
void draw( )
{
for(x = 0;x < 127;x++)
u8g.drawLine(x,Buffer[x],x,Buffer[x+1]); Draw two lines
u8g.drawLine(64,0,64,63); Draw the axes
u8g.drawLine(0,32,128,32);
For (x=0;x<128;x+=8)//draw the axis scale
u8g.drawLine(x,31,x,33);
for(x=0;x<64;x+=8)
u8g.drawLine(63,x,65,x);
u8g.drawFrame(0,0,128,64); Draw border
}
void loop( )
{
sample(); Sample
u8g.firstPage(); Clear screen
do draw( ); Display
while( u8g.nextPage( ));}```

## Step 2: Circuit

Using the test circuit, my Arduino is measured directlyusing the analogRead () function to complete a d/a conversion for about 111 μs conversion speed is slow, so much of its bandwidth is 1KHz, the next priority is to improve the speed of digital-analog conversion, while adding other features.

Third, the latest programs Here is the latest source code using, please keep my boot LOGO, HA HA. Arduino_oscilloscope.zip (2.72 KB, downloads: 2710)

Program chip 1.1V ADC use voltage reference mentioned above, if you want to use external 5V reference voltage should be program ADMUX=0xe0; To: ADMUX=0x60; Vpp= (V_max-V_min) *1.1/255; read: Vpp= (V_max-V_min) *5/255;

Four, machine made Experiments using the Arduino UNO above, the actualcard when using the Arduino PRO mini, so as to have a smaller volume.

## Step 3: Major Component List:

Arduino PRO mini 1

LCD12864 LCD (ST7920) 1

electrolytic capacitors (100 μ 25V) 1

potentiometer (50k) 1

hole plate 3

power switch 1

battery cartridge 2

button switch (with rechargeable battery, 7th) 1

Case 1

## Step 4: Wiring and Assembly

welding circuit board components

## Step 5: Assembly

Load the circuit board into the case, with thick white Panel, attached to the inside of the front panel.

## Step 6: Upload and Test

Oscilloscope debugging is very simple, just have to adjust the potentiometer 50k Center the horizontal scanlines. I use a signal generator signal source.

## Step 7: Some Explanations

1, this is one of the most simple digital Oscilloscopes, you can further improve on the basis of this;

2, you may have noticed that I am not using I/O port 0-7, which happens to be an 8-bit AVR single-chip microcomputer and mouth, this is what I prepared for subsequent upgrades, using special ADC chip, it can be used as data entry, if you are interested in the oscilloscope, then I will consider upgrading;

3, work was rushed and have any defects and deficiencies of, please advise, you have any questions you canalso over here.

Participated in the
Circuits Contest 2016

## Recommendations

136
95 20K
32 9.3K
Laser Cutting Class

15,781 Enrolled

## 6 Discussions

What kind of code is it? never saw arduino code like this before!

Dear sir

In this circuit can i change, Volts / div and Time base of frequency and bandwidth please give me a solution.