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.
Use Fusion PCB service to make the PCB if you like.
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 <U8glib.h>//statement
U8GLIB_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++)
Buffer[x] = analogRead(A0); Signal sampling
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( ));
}
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.
Circuit diagram:
Major component list:
Number name
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
1,welding Arduino PRO mini PIN.
2, welding circuit board components
3, making LCD hole plate
4, assembling circuit boards
I used a charging restructuring of treasure box with plastic casing, in the appropriate place on the hole.
6, Assembly
Load the circuit board into the case, with thick white Panel, attached to the inside of the front panel.
upload and test
Due to the Arduino PRO mini does not turn USB serial port circuit, so to transfer via a USB serial port downloading before downloading the program.
Oscilloscope debugging is very simple, just have to adjust the potentiometer 50k Center the horizontal scanlines.
I use a signal generator signal source.
Boot LOGO
Testing:
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.