Sabtu, 22 Desember 2012

Mini Oscilloscope using LCD 128x64 & ATMEGA32


Features
Frequency measurement
Voltage input
Power supply
Liquid Display Crystal
Measurement display area
Information displaying area:
10Hz - 7.7 kHz
24V AC / 30V DC
12V DC
128x64 pixels
100x64 pixels
28x64 pixels


Description
The operating voltage of the circuit is 12V DC. By this voltage, the power supply is producing 2 voltages. +8.2V for IC1 and +5V for IC2 and IC3. This circuit can measure from +2.5V to -2.5V or from 0 to +5V dependent by S1 position (AC or DC input). By using probe with 1:10 division you can measure almost 10 times higher voltages. Moreover, with S2 you can make an extra division by 2 the input voltage.

How the software triggering works
As you can see the circuit doesn't have any hardware triggering. The triggering function is been made entire in software.
    The steps for triggering are:
      1. The AVR gets up to 15000  Analog to Digital Converter samples and calculates the middle value of the waveform. The number of captured samples is depended on when a full period is completed
      2. Starts again capturing new samples but every sample value must be compared with the previous sample.
      3. If the next sample is higher than the previous sample then our waveform is rising. So AVR goes to step 4. If the next sample value is lower than the previous sample then AVR goes to step 2.
      4. Read the next sample value and compare it with the middle value had been calculated in step 1.
      5. AVR checks if the value of the next captured sample is higher than the middle value.
      6. If it's higher, the beginning of the waveform has been found. The AVR starts capturing the next 100 samples in to the RAM. I choose 100 samples because I left 100 pixels on LCD for displaying the waveform.
      7. AVR Prints these 100 samples on LCD.
      8. AVR starts again from step 1.
You will say: Why AVR starts again from step 1 and not from step 2 ?  AVR starts again the capturing  from step 1 because you can change the peak-to-peak voltage of the waveform (0V - 5V). Changing the input waveform will change the middle value of the waveform.
How is the frequency is calculated
The frequency indication of course is not very accurate. The calculation is been made by counting the time from the beginning of waveform (step 4 in  "How the software triggering works") until the next start of waveform.

Programming The ATmega32
Burn the ATmega32 with AVR_oscilloscope.hex  and select external crystal at the fuses section.
After that, you Must disable the JTAG interface from your ATmega32 microController. If you don't do that, the mega32 will show you the initial screen and when it go to the oscilloscope screen it will restart immediately to the initial screen and it will stay there for ever.
The fuses that must be set in ATmega32 microcontroller.

Calibrations
The only 2 things you have to calibrate is the LCD contrast trimmer P2 and the P1, to move the beam at the center of the LCD. To do that, apply only the power supply to the circuit and adjust the P2 up to the point you will see clear the appeared pixels on the screen. Then, adjust the P1 up to the point the beam is moved at the middle of the LCD (at the horizontal line of the cross).

Usage
   You can move the beam up or down the screen by pressing the buttons S8 or S4 correspondingly to measure the voltage of the signal. 1 volt is taking up 1 square height.
   With S7 and S3 you can increase or decrease the measurement speed. The minimum speed of a waveform that can be displayed on LCD is 460Hz. If you want to view a lower frequency waveform, for example 30 Hz,  you can press the S7 to shrink the waveform or S3 to extend the waveform up to the maximum sampling rate.
   This oscilloscope has an automatic trigger. That means, if you have a continuous signal (ex a triagle waveform) the auto trigger will work perfect. If your signal is not stable (ex a serial transmittion) you can freeze the screen by pressing S6 switch. At his case you can get a snapshoot of your measurment signal. By the time you release the S6, the snapshoot will end.





Tidak ada komentar:

Posting Komentar

free counters