Graphical LCD Oscilloscope using ATmega16Microcontroller

Introduction

The popularity of microcontrollers is on the rise, thanks to their compact size and impressive capabilities. Embedded systems are being constructed around microcontrollers and peripheral devices [3]. An oscilloscope is frequently employed to observe the waveform of an electrical analog signal, typically representing voltage, time, and frequency. Parameters such as peak-to-peak voltage, frequency of a periodic signal, and the time it takes for a signal to reach full amplitude are measured. While conventional cathode-ray oscilloscopes (CRO) are commonly used for such tasks, they are bulky and inconvenient to transport. The objective of this project is to design a portable oscilloscope.

Working Principle

The operation of a Graphical LCD is based on the fundamental concept of the sampling theorem. According to this theorem, the sampling frequency must be at least twice the highest frequency component present in the signal, as indicated by equation (1):

\[ f_s \geq 2f_c \]

Here, \( f_s \) represents the sampling frequency, and \( f_c \) is the highest frequency component in the signal. To facilitate the sampling process, an Analog-to-Digital Converter (ADC) is employed, with a conversion time of 30 microseconds [5]. It is crucial to utilize this time effectively for displaying data on the Graphical LCD. Failure to do so may lead to an increase in the time difference between three consecutive samples, subsequently reducing the system’s sampling rate [8]. Consequently, the overall frequency range of the system will decrease.

For optimal performance, it is advised to ensure that the maximum frequency of an external clock source is less than the clock frequency, and the clock frequency falls within the range of 50 KHz to 200 KHz. This range ensures maximum resolution, and the conversion time of the ADC is specified to be between 13µs and 260µs.

ATmega16 Microcontroller

The JHD12864E Graphical LCD serves the purpose of presenting waveforms or signals. It possesses attributes such as high performance, compatibility with low power AVR (8-bit) Microcontroller with RISC Architecture[4], 131 powerful instructions, and 32×8 general-purpose working registers. The display is constructed with 128 * 64 dots, and it utilizes an 8-bit parallel connection for the data lines.

Graphical LCD

We developed a graphical LCD driver specifically tailored for the crystal fonts 12864B 128×64 pixel graphical LCD. In Figure 1, the block diagram of the ATMEGA16 microcontroller, along with the entire system, is depicted[3]. The graphical LCD and 555 timer receive power supply. Additionally, five toggle switches are employed for various settings as specified.

Fig. 1Block Diagram

Description of new system

The voltage signal is measured by the oscilloscope probe. Figure 2 illustrates the flow chart outlining the system execution process.
Algorithm:

The process unfolds in the following sequence:

1. Commencing with the acquisition of an analog input signal from the device.
2. Subsequently, initializing the graphical LCD.
3. Converting the analog signal into a digital signal through the built-in ADC in the ATmega16 microcontroller.
4. Implementing alterations based on user specifications.
5. Ultimately, presenting the result on the graphical LCD.

Fig. 2 Flow Chart

Description of Circuit diagram

The Atmega16 is characterized by its low power, high performance, and advanced RISC architecture, featuring 8 kilobytes of in-system self-programmable flash and erasable EEPROM memory[1]. It comprises 8kbytes of flash program memory, 5kbytes of EEPROM, and 1 kbyte of internal SRAM. The microcontroller, graphical LCD, and 555 timer receive a 5V power supply[7]. The conversion is accomplished using the built-in 10-bit ACD. Users can adjust the toggle switch based on their requirements. Graphic LCDs, with a resolution of 128 X 64, are favored over character LCDs due to their 64 dots in each column. The ADC boasts a 10-bit resolution, yet only 8 bits are required for data plotting in applications necessitating both character and graphical representation. Interface with the microcontroller involves two registers, namely the Input and Output registers, selectable through a combination of RS and RW signals. The block diagram of the new system is illustrated in Figure 3. The GLCD resolution is defined by these dots. The ADC generates a 10-bit result presented in the ADC data register, ADCH and ADCL, as the GLCD resolution is 128 X 64, providing only 64 dots in each column.
Fig. 3 Circuit Diagram

To display data on these points, only 6 bits are necessary. However, as mentioned earlier, the ADC possesses a 10-bit resolution[5]. Representing 10-bit data requires 1024 points, but our display column accommodates only 64 points. To address this limitation, it is necessary to convert the 10-bit digital ADC value into 6 bits. This conversion can be achieved in two ways: i) Discarding the first four bits from the MSB of the 6-bit data, which reduces the range while preserving the resolution. ii) Discarding the first four bits from the LSB of the 6-bit data, which also reduces the range while maintaining resolution.

Programming Details

The coding language utilized for the G. L. O. program is C.

Result and Discussion

Fig. 4. Result
The functional generator is used to apply the input signal. The outcome depicted in Figure 4 displays a square wave shape on the GLCD for an input frequency of 200 Hz. To prevent aliasing effects in practical applications, employing an anti-aliasing filter is recommended.

Conclusion

This embedded system enables the analysis of low-frequency signals and voltage amplitudes. It aids students in creating a new, compact-sized system with significantly lower costs compared to existing portable oscilloscopes.


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top