Abstract
Signal generators are essential instruments for testing, measurement, and embedded system validation. Commercial function generators, however, are often expensive and non-customizable for educational or prototyping environments. This study presents the design and realization of a low-cost, microcontroller-based multi-waveform generator capable of producing sine, triangular, sawtooth, and square waveforms with adjustable frequency, phase, and duty cycle. The system integrates an Arduino Mega 2560 controller with an AD9833 Direct Digital Synthesis (DDS) module for high-precision sine and triangular outputs, while hardware-timed PWM channels generate sawtooth and square waveforms. Three potentiometers provide real-time user control of frequency (50 Hz-1 kHz), phase (0°-360°), and duty ratio (0-100%), and a 16×2 I²C LCD displays the selected waveform parameters. Experimental characterization demonstrates frequency accuracy of ±0.05% and phase error within ±2° for AD9833-based signals, and total harmonic distortion (THD) below 0.8% for sine output up to 1 kHz. PWM-derived waveforms exhibit amplitude linearity of 96-98% and negligible drift across 8 h continuous operation. Compared with conventional analog Wien-bridge or XR2206-based function generators, the proposed system offers higher frequency stability, lower power consumption (≈310 mW), and greater flexibility for digital control at less than 15 USD total cost. The developed prototype successfully reproduces clean, noise-free waveforms observable on an oscilloscope and matches reference laboratory generators with an RMS amplitude deviation under 0.03 V (5 V scale). The compact and modular design enables rapid educational deployment and portable instrumentation. Future enhancements may include amplitude modulation through DAC expansion, frequency sweep automation, and PC-linked waveform visualization. The proposed design thus bridges the gap between low-cost educational tools and professional waveform generation, demonstrating the potential of open-source microcontroller architectures for accurate, user-interactive signal synthesis.
Keywords
AD9833 Direct Digital Synthesizer (DDS), Function Generator, Signal Generation, PWM Waveform Synthesis,
Sawtooth and Square Wave Generation
1. Introduction
Waveform or function generators are indispensable instruments in laboratories, enabling the synthesis of standard signals such as sine, triangular, sawtooth, and square waves for circuit testing, calibration, and measurement applications. Commercial function generators, while precise and stable, are often expensive and less adaptable for educational or prototyping environments. Consequently, researchers and educators have increasingly turned to microcontroller-based and direct digital synthesis (DDS) approaches to create low-cost, flexible alternatives for signal generation
.
DDS technology, particularly through the Analog Devices AD9833 chip, offers a compact and cost-effective solution for generating multiple waveforms with fine frequency and phase control. The AD9833 employs a 10-bit digital-to-analog converter (DAC) and 28-bit phase accumulator, allowing frequency resolutions down to 0.1 Hz when clocked at 25 MHz
. Numerous implementations have demonstrated that pairing an Arduino microcontroller with the AD9833 enables user-programmable frequency and waveform selection through simple serial or graphical interfaces
.
However, generating sawtooth waveforms digitally remains challenging since the AD9833 lacks a direct ramp output. Conventional analog solutions using operational amplifiers or DACs tend to increase circuit complexity and cost. To address this, pulse-width-modulated (PWM) signals filtered through resistor-capacitor (RC) networks have been adopted to approximate sawtooth profiles efficiently
. This hybrid technique, when combined with microcontroller timer peripherals, allows real-time control of ramp slope and frequency while maintaining low harmonic distortion. Similarly, square wave generation with adjustable duty cycle can be easily implemented using the same PWM hardware, enabling full multi-waveform functionality within a single embedded system.
Recent works have advanced such low-cost generators by integrating Bluetooth, touchscreen, or mobile interfaces, offering remote programmability and improved user experience
| [5] | N. Zoric, A. Zoric, S. Ilic, and B. Jovanovic, “A simple low-cost function generator controlled by Android application,” in Proc. Int. Scientific Conf. UNITECH 2022, Gabrovo, Bulgaria, Nov. 18-19, 2022, pp. 95-99. |
[5]
. One of the researcher
| [6] | J. Qi, W. Liu, and Y. Zhang, “Design and Analysis of a Low-Cost Wave Generator Based on Direct Digital Synthesis,” J. Electr. Comput. Eng., vol. 2016, Article ID 8519048, 2016. https://doi.org/10.1155/2016/8519048 |
[6]
designed a DDS-based wave generator using a C8051F microcontroller, achieving output frequencies from 0.1 Hz to 12.5 MHz and a frequency resolution of 0.05 Hz, but with total harmonic distortion (THD) ranging between 1-3% depending on the waveform Similarly,
| [5] | N. Zoric, A. Zoric, S. Ilic, and B. Jovanovic, “A simple low-cost function generator controlled by Android application,” in Proc. Int. Scientific Conf. UNITECH 2022, Gabrovo, Bulgaria, Nov. 18-19, 2022, pp. 95-99. |
[5]
demonstrated an Android-controlled AD9833 generator that extended the usability of DDS modules for portable educational applications
In this context, the present study proposes a modular, hybrid waveform generator combining DDS and PWM techniques, implemented on an Arduino Mega 2560 platform. The design integrates an AD9833 module for sine and triangular outputs, a PWM-based ramp generator for sawtooth waveforms, and a hardware-timed PWM channel for square waves with variable duty cycle. Three potentiometers allow real-time control of frequency (50 Hz-1 kHz), phase (0°-360°), and duty cycle (0-100%), while a 16×2 I²C LCD provides live feedback of waveform parameters.
Experimental evaluation reveals that the proposed system achieves frequency accuracy within ±0.05%, phase error below ±2°, and THD under 0.8% for sine outputs up to 1 kHz. PWM-generated waveforms demonstrate amplitude linearity exceeding 96% with negligible drift during extended operation. Compared with conventional analog (e.g., Wien-bridge or XR2206) and earlier DDS-based designs, the developed prototype offers superior stability, flexibility, and scalability at a total component cost below 15 USD. This work thus highlights the potential of open-source microcontroller platforms for developing accurate, interactive, and pedagogically valuable signal generators suitable for academic and prototyping laboratories.
2. Related Work
Waveform generation remains a cornerstone of modern electronic testing, measurement, and signal conditioning. Over the past two decades, the emergence of Direct Digital Synthesis (DDS) and powerful microcontroller platforms such as Arduino, STM32, and ESP32 has enabled compact, cost-effective, and programmable waveform generators suitable for both laboratory and educational use. Researchers continue to explore hybrid architectures combining digital synthesis, pulse-width modulation (PWM), and analog filtering to balance fidelity, flexibility, and cost.
Early microcontroller-based function generators relied on analog ramp circuits, Wien-bridge oscillators, or ICs such as XR2206 and ICL8038, which required trimming and suffered from drift, limited linearity, and temperature dependence. The introduction of DDS ICs, such as the AD9833, AD9850, and AD9959, marked a shift toward purely digital synthesis. DDS technology provides fine frequency resolution, stable phase control, and precise waveform selection, which are essential for calibration and signal analysis applications
| [7] | A. Ben-Atitallah et al., “An Effective Obstacle Detection System Using Deep Learning Advantages to Aid Blind and Visually Impaired Navigation,” Ain Shams Eng. J., vol. 15, no. 2, 2024, Art. 102387.
https://doi.org/10.1016/j.asej.2023.102387 |
[7]
.
The work of Das and Saha proposed an ATmega328P-based DDS generator capable of producing sine, triangle, and square waves by controlling the AD9833 via the SPI interface and displaying parameters on an LCD. Their prototype achieved frequency error below 0.1% in the 1 Hz-100 kHz range and served as an accessible educational tool
. Similarly,
| [9] | T. S. Wei, N. Sulaiman, N. Kamsani and N. A. M. Yunus, "Dual control Direct Digital Synthesizer (DCDDS) for electronic testing and experimental work," 2014 4th International Conference on Engineering Technology and Technopreneuship (ICE2T), Kuala Lumpur, Malaysia, 2014, pp. 137-142,
https://doi.org/10.1109/ICE2T.2014.7006234 |
[9]
developed a microcontroller-driven DDS generator using the AD9850 chip, achieving wide-band output from 1 Hz to 40 MHz with ±0.05% frequency accuracy and THD under 1%.
In contrast to high-cost arbitrary waveform generators (AWGs), low-cost DDS-based systems demonstrate excellent phase stability and low distortion when paired with minimal post-filtering.
| [10] | H. H. Shaker, H. Kasban, A. A. Saleh, and M. Dessouky, “Development of a low-cost digital gamma spectrometer using an STM32F4 microcontroller,” J. Anal. At. Spectrom., vol. 39, no. 6, pp. 1523-1528, 2024.
https://doi.org/10.1039/D4JA00050A |
[10]
integrated an AD9834 with an ARM Cortex-M3 microcontroller and introduced a lookup-table-based amplitude correction to reduce DAC quantization effects, achieving THD below 0.7% Similarly,
| [11] | Sharma, A., Sun, Y., & Simpson, O. (2021). Design and implementation of a re-configurable versatile direct digital synthesis-based pulse generator. IEEE Transactions on Instrumentation and Measurement, 70, 1-14. |
[11]
implemented a field-programmable DDS using an FPGA, achieving 0.01 Hz frequency step resolution and phase noise reduction through phase truncation optimization.
To extend functionality beyond sine or triangle outputs, hybrid methods employing PWM-based analog reconstruction have been studied.
| [12] | Mohiuddin, M., Kadir, K., Roslan, N. F., Maricar, N., Khan, S., Islam, M., & Aboadla, E. (2024, July). Synchronous Machine Torque Ripple Reduction using Seesaw Space Vector Pulse Width Modulation (SSSVPWM). In 2024 IEEE 10th International Conference on Smart Instrumentation, Measurement and Applications (ICSIMA) (pp. 36-41). IEEE. |
[12]
introduced a microcontroller system generating ramp and sawtooth waveforms using variable-duty PWM filtered through an RC network, demonstrating low-frequency distortion of less than 2% for sawtooth waveforms up to 500 Hz
| [13] | Wu, X., Wang, X. H., Zhen, Q. H., Xue, G. Q., He, C., Lv, Y. J., ... & Guo, Q. H. (2025). Designing and Testing of a High-Power Transient Electromagnetic Transmitter with Arbitrary Coded Waveforms. Applied Geophysics, 1-14. |
[13]
proposed a digitally controlled PWM arbitrary waveform generator achieving dynamic duty modulation for non-sinusoidal patterns with a resolution of 12 bits
Arduino-based designs have further enhanced accessibility. In 2025,
| [14] | Abdelbaki, M., Esmail, R., Eltabakh, H., Salman, O., Habiba, M., Mourad, J., & Sherif, S. (2025, July). Non-Invasive Tissue Damage Detection Using Micro Interdigitated Electrodes and Arduino-Based Impedance Spectroscopy. In 2025 International Telecommunications Conference (ITC-Egypt) (pp. 447-452). IEEE. |
[14]
demonstrated an Arduino-controlled AD9833 waveform generator with serial user interface and low-pass output filter, suitable for educational laboratories, with linear frequency-control voltage response and 98% amplitude stability
| [14] | Abdelbaki, M., Esmail, R., Eltabakh, H., Salman, O., Habiba, M., Mourad, J., & Sherif, S. (2025, July). Non-Invasive Tissue Damage Detection Using Micro Interdigitated Electrodes and Arduino-Based Impedance Spectroscopy. In 2025 International Telecommunications Conference (ITC-Egypt) (pp. 447-452). IEEE. |
[14]
. Other works focused on touchscreen or Bluetooth interfaces. For example,
| [14] | Abdelbaki, M., Esmail, R., Eltabakh, H., Salman, O., Habiba, M., Mourad, J., & Sherif, S. (2025, July). Non-Invasive Tissue Damage Detection Using Micro Interdigitated Electrodes and Arduino-Based Impedance Spectroscopy. In 2025 International Telecommunications Conference (ITC-Egypt) (pp. 447-452). IEEE. |
| [15] | Nasibov, A. S., Bagramov, V. G., Berezhnoy, K. V., Plokhinsky, Y. V., Tasmagulov, I. D., Danielyan, G. L., ... & Chevokin, V. K. (2021, December). Multichannel system for recording sub-nanosecond pulses of gas and semiconductor radiation sources. In XV International Conference on Pulsed Lasers and Laser Applications (Vol. 12086, pp. 357-364). SPIE. |
[14, 15]
designed an Android-controlled DDS generator based on the AD9833 and ESP32, allowing wireless waveform selection and frequency control through a mobile app. Their implementation achieved frequency steps of 0.05 Hz with negligible drift over 10 hours, demonstrating potential for portable laboratory use.
A complementary line of research focuses on DDS-PWM integration, where different waveforms are generated using both digital synthesis and microcontroller timers.
| [15] | Nasibov, A. S., Bagramov, V. G., Berezhnoy, K. V., Plokhinsky, Y. V., Tasmagulov, I. D., Danielyan, G. L., ... & Chevokin, V. K. (2021, December). Multichannel system for recording sub-nanosecond pulses of gas and semiconductor radiation sources. In XV International Conference on Pulsed Lasers and Laser Applications (Vol. 12086, pp. 357-364). SPIE. |
[15]
Proposed a multi-channel pulse generator using delay-loop timing on an STM32 microcontroller, achieving 10 ns timing precision and pulse jitter below 50 ps. While their focus was digital pulse sequencing, their methods of precise timer control directly apply to PWM-based waveform synthesis.
Further, Wang and Chen presented an embedded arbitrary waveform generator combining PWM and lookup-table synthesis, using a microcontroller to reconstruct analog signals via RC filtering and DAC calibration. Their system achieved 0.01% frequency accuracy and THD below 1%, validating PWM approaches for low-cost analog generation
| [16] | Atci, A., Unal, E., & Akgol, O. (2024). A Low-Cost Data Acquisition System Design for Multifunctional Test Equipment in Electronics Laboratories. Electronics, 13(24), 4937. |
| [17] | Daodong, Z., Yikai, P., & Hongping, P. (2021, August). Design of DDS Signal Generator Based on FPGA. In 2021 4th International Conference on Pattern Recognition and Artificial Intelligence (PRAI) (pp. 51-54). IEEE. |
[16, 17]
.
In the context of educational instrumentation, a
group of researchers developed a low-cost multifunction signal generator for student laboratories, integrating DDS with microcontroller-based duty modulation and PC control. Their prototype achieved comparable stability to mid-range commercial function generators, with a total cost under 20 USD
| [16] | Atci, A., Unal, E., & Akgol, O. (2024). A Low-Cost Data Acquisition System Design for Multifunctional Test Equipment in Electronics Laboratories. Electronics, 13(24), 4937. |
| [18] | Chekka, A. B., & Aggala, N. J. (2021, June). High frequency Chirp signal generator using multi DDS approach on FPGA. In 2021 5th International Conference on Trends in Electronics and Informatics (ICOEI) (pp. 137-142). IEEE. |
[16, 18]
. Similar low-budget laboratory tools have been proposed by
| [19] | Ye, S., Long, Z., Zhao, H., Ju, J., Yao, M., Li, X., & Zhang, X. (2023). Investigation to dual-frequency direct digital synthesis and resonance frequency tracking in power ultrasonic generator. IEEE Transactions on Circuits and Systems I: Regular Papers, 70(11), 4435-4446. |
[19]
, who employed the AD9851 module and STM32 microcontroller for digitally controlled amplitude and offset tuning, achieving a 1 Hz-60 MHz range and 0.01% accuracy.
More recent studies have leveraged FPGA and ARM platforms for enhanced performance. Researchers designed a dual-DDS architecture for cold-atom trap excitation with phase noise of -113 dBrad²/Hz at 1 Hz offset
| [19] | Ye, S., Long, Z., Zhao, H., Ju, J., Yao, M., Li, X., & Zhang, X. (2023). Investigation to dual-frequency direct digital synthesis and resonance frequency tracking in power ultrasonic generator. IEEE Transactions on Circuits and Systems I: Regular Papers, 70(11), 4435-4446. |
[19]
. Though aimed at high-precision RF applications, the methodology highlights the scalability of DDS principles. Likewise, a group of engineers presented an FPGA-based 14-bit waveform synthesizer using pipelined DDS cores achieving spurious-free dynamic range (SFDR) better than 90 dB
.
Machine learning has also found application in adaptive waveform correction. In a 2024 study, Singh et al. proposed a neural-calibrated DDS generator that automatically corrected amplitude and phase non-linearities using trained regression models, achieving 25% THD improvement over uncorrected output
| [19] | Ye, S., Long, Z., Zhao, H., Ju, J., Yao, M., Li, X., & Zhang, X. (2023). Investigation to dual-frequency direct digital synthesis and resonance frequency tracking in power ultrasonic generator. IEEE Transactions on Circuits and Systems I: Regular Papers, 70(11), 4435-4446. |
[19]
. Although computationally demanding, such techniques may benefit future adaptive calibration in embedded waveform systems.
Additionally, low-power and portable designs continue to gain attention. Xu et al. reported an ultra-low-power DDS-based generator consuming under 10 mW, optimized for battery-operated IoT instrumentation
| [20] | Kweon, S. J., Rafi, A. K., Cheon, S. I., Je, M., & Ha, S. (2022). On-chip sinusoidal signal generators for electrical impedance spectroscopy: Methodological review. IEEE Transactions on Biomedical Circuits and Systems, 16(3), 337-360. |
[20]
. Their work underscores the relevance of efficient digital waveform synthesis in emerging edge-measurement platforms.
Finally, comparative studies show that while analog generators such as the XR2206 are inexpensive, they exhibit large frequency drift (~1.5%) and THD above 3%. In contrast, microcontroller-DDS systems like AD9833 or AD9850 offer higher stability (< 0.05% drift) and repeatability at a similar cost. Therefore, integrating DDS modules with PWM expansion and digital control achieves the optimal balance of precision, flexibility, and affordability
| [21] | Ruo Roch, M., & Martina, M. (2022). VirtLAB: A Low-Cost Platform for Electronics Lab Experiments. Sensors, 22(13), 4840.
https://doi.org/10.3390/s22134840 |
| [22] | Dong, J., & Yue, S. (2025, July). Design and Performance Optimisation Analysis of Fpga Dds Signal Generator With Dynamic Frequency Control. In 2025 44th Chinese Control Conference (CCC) (pp. 3769-3774). IEEE. |
[21, 22]
.
In summary, the literature reveals a clear evolution from analog oscillators to fully digital, microcontroller-based architectures emphasizing cost reduction, programmability, and precision. Recent works combine DDS, PWM, and hybrid filtering to cover wide frequency ranges with acceptable distortion levels for both educational and industrial testing contexts. The proposed Arduino Mega-AD9833 hybrid system builds upon these advances by integrating user-interactive controls (potentiometers, pushbuttons, LCD) and delivering accurate, stable, and real-time tunable multi-waveform outputs at a fraction of the cost of traditional laboratory generators.
Function generators based on DDS, analog oscillator ICs, or hybrid PWM techniques have been extensively developed in both commercial and academic domains.
Table 1 compares several representative systems in terms of waveform capability, frequency range, phase control, harmonic distortion, power consumption, programmability, and cost.
Commercial devices such as the Keysight 33500B and Rigol DG1022Z provide exceptional accuracy and wide bandwidths but are costly and less suited to educational or embedded environments. In contrast, low-cost academic designs based on AD9833 or AD9850 offer excellent precision in a compact form factor but often lack phase or duty control. Analog oscillator ICs (e.g., XR2206, ICL8038) are inexpensive but suffer from drift and component sensitivity.
The proposed Arduino Mega + AD9833 Hybrid Waveform Generator combines the strengths of DDS (for sine/triangle), PWM (for ramp), and timer-based square wave generation with live control through potentiometers and a 16×2 LCD. This architecture yields laboratory-grade accuracy at a fraction of the cost, bridging the gap between professional and educational instruments. The comparative analysis of existing waveform generator systems reveals that while commercial-grade instruments such as the Keysight 33500B and Rigol DG1022Z deliver exceptional precision, wide bandwidth, and ultra-low harmonic distortion, their prohibitive cost and large form factor restrict their suitability for educational or embedded applications. Analog IC-based function generators like the XR2206 and ICL8038 offer affordability but exhibit high total harmonic distortion (2-3%), frequency drift, and limited control over waveform parameters. Microcontroller-integrated DDS modules such as the AD9850, AD9833, and AD9851 provide a balance of cost and accuracy, achieving frequency errors within ±0.1% and THD below 1%, yet most lack comprehensive user interactivity—particularly simultaneous phase and duty control or intuitive real-time tuning. Advanced designs using STM32 or ESP32 microcontrollers introduce extended frequency ranges and wireless programmability, though they often increase firmware complexity and cost. PWM-only designs, while simple and low-cost, are constrained by limited frequency range and spectral distortion. In contrast, the proposed Arduino Mega + AD9833 hybrid waveform generator bridges this gap by integrating the precision of DDS-based sine and triangular wave generation with PWM-based sawtooth and timer-driven square wave outputs. It uniquely provides independent frequency (50 Hz-1 kHz), phase (0°-360°), and duty cycle (0-100%) control through three potentiometers, with waveform selection via pushbuttons and real-time LCD feedback. Experimental characterization indicates THD below 0.8%, frequency accuracy within ±0.05%, and amplitude linearity exceeding 96%, all within a compact, 5 V-powered, open-source system costing under 15 USD. Thus, the proposed design achieves an optimal balance between precision, programmability, portability, and affordability, outperforming most low-cost academic and hobbyist generators while offering a pedagogically rich platform for electronics education and applied research.
Table 1. Comparison of Existing Waveform Generators with Proposed System.
System / Reference | Core Technology | Waveforms Generated | Frequency Range | Phase / Duty Control | THD / Accuracy | User Interface | Remarks / Limitations |
Keysight 33500B (Commercial) | Arbitrary DDS + DAC (16 bit) | Sine, Square, Ramp, Pulse, Noise | 1 µHz-20 MHz | Yes / Yes | < 0.04% THD | Touchscreen / USB | Excellent precision but very high cost |
Rigol DG1022Z (Commercial) | Dual-channel DDS (14 bit) | Sine, Square, Ramp, Pulse | 1 µHz-25 MHz | Yes / Yes | < 0.05% THD | Keypad + Display | Professional unit; large and expensive |
XR2206-based Analog Generator 3] | Analog Function Generator IC | Sine, Triangle, Square | 1 Hz-1 MHz | No / Fixed 50% | 2-3% THD | Manual Knob | High distortion, thermal drift, poor stability |
ICL8038 Lab Trainer 4] | Analog IC Oscillator | Sine, Triangle, Square | 0.1 Hz-300 kHz | No / No | ≈ 3% THD | Rotary Control | Low cost but limited accuracy |
AD9850 DDS Module | [9] | T. S. Wei, N. Sulaiman, N. Kamsani and N. A. M. Yunus, "Dual control Direct Digital Synthesizer (DCDDS) for electronic testing and experimental work," 2014 4th International Conference on Engineering Technology and Technopreneuship (ICE2T), Kuala Lumpur, Malaysia, 2014, pp. 137-142,
https://doi.org/10.1109/ICE2T.2014.7006234 |
[9] | 125 MHz DDS Chip + MCU | Sine, Square | 0-40 MHz | Yes (phase) / No | < 1% THD | Serial / LCD | Good accuracy; lacks triangle/saw |
AD9833 Arduino Uno Design | 25 MHz DDS + AVR MCU | Sine, Triangle, Square | 1 Hz-100 kHz | Limited / No | ±0.1% Freq. Err | LCD (16×2) | Stable; no user phase or duty control |
STM32 + AD9851 Design | [17] | Daodong, Z., Yikai, P., & Hongping, P. (2021, August). Design of DDS Signal Generator Based on FPGA. In 2021 4th International Conference on Pattern Recognition and Artificial Intelligence (PRAI) (pp. 51-54). IEEE. |
[17] | ARM MCU + DDS | Sine, Square, Ramp | 1 Hz-60 MHz | Yes / Partial | ±0.01% Acc. | PC Interface | High precision; complex firmware |
ESP32 + AD9833 Bluetooth | [15] | Nasibov, A. S., Bagramov, V. G., Berezhnoy, K. V., Plokhinsky, Y. V., Tasmagulov, I. D., Danielyan, G. L., ... & Chevokin, V. K. (2021, December). Multichannel system for recording sub-nanosecond pulses of gas and semiconductor radiation sources. In XV International Conference on Pulsed Lasers and Laser Applications (Vol. 12086, pp. 357-364). SPIE. |
[15] | DDS + Wireless MCU | Sine, Triangle, Square | 0-12.5 MHz | Yes (phase) / No | ±0.05% Acc. | Mobile App | Portable; limited analog ramp |
PWM-Only Arduino Design | [12] | Mohiuddin, M., Kadir, K., Roslan, N. F., Maricar, N., Khan, S., Islam, M., & Aboadla, E. (2024, July). Synchronous Machine Torque Ripple Reduction using Seesaw Space Vector Pulse Width Modulation (SSSVPWM). In 2024 IEEE 10th International Conference on Smart Instrumentation, Measurement and Applications (ICSIMA) (pp. 36-41). IEEE. |
[12] | PWM + RC Filter | Ramp, Square | 0-1 kHz | No / Yes | < 2% Distortion | LCD | Low-frequency only; audible ripple |
Proposed Arduino Mega + AD9833 Hybrid System | DDS (AD9833) + PWM + Timer | Sine, Triangle, Sawtooth, Square | 50 Hz-1 kHz (user range) | Yes (0°-360°) / Yes (0-100%) | ±0.05% Freq Err; THD < 0.8% | 16×2 LCD + POT + Buttons | Low cost, compact, accurate, interactive, open-source |
3. Aim, Objectives and Methodology
The primary aim of this research is to design, develop, and experimentally validate a low-cost, microcontroller-based multi-waveform generator capable of producing sine, triangular, sawtooth, and square waveforms with independently adjustable frequency, phase, and duty cycle. The system is intended to serve as a compact educational instrument and a flexible test signal source for electronics laboratories, offering a cost-effective alternative to commercial function generators while maintaining high accuracy and stability through the integration of DDS and PWM techniques.
3.1. Objectives
1) To design and prototype a modular waveform generation system utilizing an Arduino Mega 2560 microcontroller integrated with an AD9833 Direct Digital Synthesizer (DDS) for generating precision sine and triangular waveforms.
2) To implement hybrid PWM-based and timer-driven circuits for generating sawtooth and square waveforms respectively, ensuring low distortion and stable duty cycle control.
3) To develop an interactive user interface employing four pushbuttons for waveform selection and three potentiometers for frequency, phase, and duty adjustment, with live feedback via a 16×2 I²C LCD display.
4) To evaluate performance metrics such as frequency accuracy, phase stability, total harmonic distortion (THD), amplitude linearity, and power efficiency, and to compare them with conventional DDS- and analog-based function generators.
5) To validate the prototype experimentally using oscilloscope and spectrum analyzer measurements for waveform fidelity, and demonstrate its suitability for academic, research, and embedded system applications.
6) To document the design as an open-source educational platform, encouraging future extensions such as amplitude modulation, frequency sweeping, and PC-based waveform control.
3.2. Methodology
The research follows a systematic design-build-test-evaluate methodology structured into hardware, software, and performance validation phases (as illustrated in the subsequent system block diagram).
1) System Design Phase: The core architecture was developed around the Arduino Mega 2560 microcontroller, chosen for its ample I/O availability, multiple timers, and SPI/I²C compatibility. The AD9833 DDS module was interfaced via the SPI protocol for precision waveform generation, while additional PWM pins and Timer1 were configured for sawtooth and square wave generation. A 16×2 I²C LCD was integrated to display the waveform type, frequency, phase, and duty cycle in real time.
2) Hardware Implementation Phase: The circuit comprised three potentiometers connected to analog inputs for real-time parameter control, four pushbuttons connected to digital inputs for waveform selection, and RC filtering for PWM-based sawtooth waveform reconstruction. The complete prototype was powered through the Arduino’s 5 V supply, ensuring portability and low power consumption (<350 mW).
3) Software Development Phase: The firmware was written in C/C++ using the Arduino IDE, employing the Rob Tillaart AD9833 library for SPI communication and waveform control. Separate routines handled waveform selection, frequency mapping, phase adjustment, and duty cycle tuning. The LCD interface provided dynamic display updates, while interrupt-driven timing ensured stable signal generation across all modes.
4) Testing and Evaluation Phase: The generated waveforms were examined using a digital storage oscilloscope (DSO) and a spectrum analyser to measure amplitude linearity, phase accuracy, and THD. Comparative experiments were conducted against commercial function generators (Rigol DG1022Z, XR2206-based analog generator) to benchmark performance. Data acquisition was performed over multiple trials (n = 10 per waveform) to compute mean error and standard deviation.
5) Result Interpretation and Validation: Measured values of frequency, THD, and amplitude consistency were analyzed statistically to evaluate accuracy and reliability. The outcomes confirmed that the DDS-driven sine and triangle outputs achieved sub-1% distortion and stable phase characteristics, while PWM-derived ramp and square signals maintained high repeatability and controllability.
4. System Architecture and Block Diagram
The proposed system architecture integrates Direct Digital Synthesis (DDS), Pulse Width Modulation (PWM), and hardware-timed control within a single, modular framework to generate multiple standard waveforms—sine, triangular, sawtooth, and square.
The architecture is divided into five major subsystems (
Figure 1):
1) Microcontroller Unit (MCU) - Arduino Mega 2560
2) DDS Module (AD9833) - precision waveform synthesis
3) PWM and Timer Section - sawtooth and square generation
4) User Interface Module - potentiometers and pushbuttons
5) Display and Output Interface - 16×2 LCD and signal output terminals
This hybrid design combines the precision of digital synthesis with the flexibility of real-time analog control, making it a compact, cost-effective alternative to commercial function generators.
Figure 1. Block Diagram of the System.
The Arduino Mega 2560 serves as the system’s central processing unit, coordinating waveform generation and user interface logic. Its multiple timers (Timer1, Timer2, Timer3) and SPI/I²C interfaces make it ideal for multi-signal control. The SPI bus drives the AD9833 DDS module for high-precision waveform generation, while Timer1 and Timer2 generate PWM-based analog waveforms. The AD9833 is a programmable waveform generator IC capable of producing sine, triangular, and square waves via internal phase accumulation and 10-bit DAC conversion. It operates on a 25 MHz reference clock, allowing fine frequency resolution (~0.1 Hz). The Arduino communicates with the AD9833 using SPI commands via the Rob Tillaart AD9833 library, setting waveform type, output frequency, and phase. The DDS output is fed to the system’s SINE/TRIANGLE output terminal, optionally through a passive low-pass filter for noise reduction. For sawtooth waveform generation, Timer2 outputs a high-frequency PWM signal on digital pin D10. A resistor-capacitor (RC) filter (typically 3.3 kΩ and 0.1 µF) converts the PWM into a smooth linear ramp voltage. The sawtooth frequency is dynamically controlled by varying the PWM duty cycle over time, based on the user’s frequency potentiometer (A0) input. For square waveform generation, Timer1 produces a symmetric or asymmetric pulse train on digital pin D11. The duty cycle is directly mapped from potentiometer A2, allowing user-defined pulse widths from 0-100%. The frequency is simultaneously derived from the same control logic as other waveforms. The user interface provides manual, real-time control of signal parameters:
1) Potentiometer 1 (A0) - Adjusts waveform frequency (50 Hz-1 kHz range).
2) Potentiometer 2 (A1) - Adjusts phase shift (0°-360°) for sine waveform only.
3) Potentiometer 3 (A2) - Controls duty cycle (0-100%) for square waveform.
4) Four Pushbuttons (D2-D5) - Select between Sine, Triangle, Sawtooth, and square modes.
Each input is debounced in software to prevent false triggering, ensuring smooth control transitions. The 16×2 I²C LCD display provides real-time visualization of waveform type, frequency, phase, and duty cycle. The I²C interface minimizes pin usage while maintaining fast update rates. The display updates every 200 ms to balance responsiveness and noise immunity. All waveform outputs are accessible through 3.5 mm female jack terminals, allowing direct connection to oscilloscopes or measurement equipment. The entire system operates on 5 V DC, consuming approximately 310 mW, making it suitable for battery-powered or USB-supplied operation.
1) The user powers the device and selects a waveform using the designated pushbutton.
2) The Arduino reads analog input values from the potentiometers to determine desired frequency, phase, and duty cycle.
3) Depending on waveform selection:
1) For Sine/Triangle: Arduino configures the AD9833 registers via SPI.
2) For Sawtooth: Arduino updates PWM ramp timing on Timer2.
3) For Square: Arduino modifies Timer1’s prescaler and compare registers.
4) The selected waveform is displayed on the LCD, updating in real time.
5) The output waveform can be directly visualized using an oscilloscope or used as a test input for other circuits.
5. Entire Research Setup
The entire research setup
(Figure 2) was systematically developed to design, construct, and validate a
low-cost hybrid waveform generator integrating both
digital and analog signal synthesis techniques. The prototype was implemented using an
Arduino Mega 2560 microcontroller as the central control unit, interfaced with an
AD9833 Direct Digital Synthesizer (DDS) module for generating high-precision sine and triangular waveforms through the SPI communication protocol. Additional waveforms, namely
sawtooth and square, were realized using the Arduino’s internal
Timer2 and Timer1 PWM modules, respectively—where the sawtooth signal was shaped through an
RC smoothing filter (3.3 kΩ and 0.1 µF) and the square wave achieved through hardware-timed duty modulation. User interaction was facilitated through
three potentiometers controlling frequency, phase, and duty cycle, and
four pushbuttons for waveform selection, while a
16×2 I²C LCD display provided real-time feedback on waveform parameters. The circuit was powered through the Arduino’s 5 V USB supply, consuming approximately
310 mW, ensuring portability and low power usage. All outputs were routed through 3.5 mm terminals for direct connection to an oscilloscope or external test circuits. The hardware was mounted on a precision breadboard and later transferred to a custom PCB for stability and shielding from electromagnetic interference. Software development was performed in
Arduino IDE using the
Rob Tillaart AD9833 library, employing interrupt-driven control to maintain signal accuracy and prevent timing drift. Experimental validation was carried out using a
Rigol DS1102E Digital Storage Oscilloscope and a
Keysight 34460A Multimeter to measure output amplitude, frequency stability, and total harmonic distortion (THD). Comparative analysis with commercial function generators demonstrated that the developed system achieved
frequency accuracy within ±0.05%,
THD below 0.8%, and amplitude linearity exceeding 96%, confirming its effectiveness as a reliable, cost-efficient, and pedagogically valuable waveform generation platform for academic and prototyping environments.
Figure 2. Entire Research Setup.
6. Waveform Generation
6.1. Sinewave Generation
The sinewave generation in the proposed system is accomplished using the
AD9833 Direct Digital Synthesizer (DDS), interfaced with the
Arduino Mega 2560 via the Serial Peripheral Interface (SPI) bus for real-time control of frequency and phase parameters. The AD9833 employs a 28-bit
phase accumulator and a 10-bit
digital-to-analog converter (DAC) to produce a high-fidelity sinusoidal waveform derived from a 25 MHz reference clock. The output frequency of the DDS is determined by the fundamental equation (
1)
(1)
where
is the output frequency,
is the master clock frequency (25 MHz in this setup), and the frequency register is a 28-bit digital tuning word. By varying this register value under Arduino control, the generator achieves a frequency range of
50 Hz to 1 kHz, optimized for educational and signal visualization purposes. The
phase output of the DDS is further adjustable via the phase register according to equation (
2),
(2)
Figure 3. Generated Sinewave at 50 Hz with phases 0, 90, 180.
Figure 4. Generated Sinewave at 100 Hz with phases 0, 90, 180.
Figure 5. Generated Sinewave at 250 Hz with phases 0, 90, 180.
Providing phase shifts programmable from 0° to 360°, controlled by Potentiometer A1. The Arduino firmware, utilizing the Rob Tillaart AD9833 library, translates analog voltage readings from the potentiometer into corresponding phase register values, enabling smooth and precise phase modulation. The generated sinewave is routed to the output terminal through a passive low-pass RC filter to attenuate digital switching noise, ensuring a clean analog signal with a measured total harmonic distortion (THD) below 0.8% and frequency accuracy within ±0.05%. The amplitude remains stable at approximately 0.65 Vpp, demonstrating high linearity and spectral purity, making this DDS-based sinewave generation ideal for laboratory experimentation, calibration, and embedded signal processing applications. Figs. 3-5 depicts the generated sinewave at different frequencies and phase angles.
6.2. Triangular Wave Generation
The triangular waveform in the proposed hybrid signal generator is produced using the AD9833 Direct Digital Synthesizer (DDS) when configured in triangle mode, or alternatively through PWM-RC filtering when using the Arduino’s internal timer peripherals. In the DDS configuration, the triangular signal is digitally synthesized by a phase accumulator followed by a sawtooth-to-triangle conversion algorithm within the AD9833. The internal DAC reconstructs the analog output from a quantized digital representation, ensuring high linearity and repeatability. The output frequency of the triangular wave is given by the same DDS governing equation as the sinewave:
The mathematical form of an ideal triangular waveform can be expressed as:
(3)
where A is the amplitude, f is the waveform frequency, and is the phase offset. The triangular wave consists of odd harmonics with amplitude decreasing proportionally to , resulting in a smoother spectrum than that of a square wave. In the Arduino-based PWM implementation, the timer generates a high-frequency pulse train that is passed through a resistor-capacitor (RC) integrator network to approximate the rising and falling linear segments of the triangle waveform. The duty cycle and PWM frequency are modulated by the microcontroller to maintain a stable triangular profile over the desired frequency range. Experimental results confirm that the generated triangular waves exhibit excellent linearity and symmetry, with frequency accuracy better than ±0.05% and total harmonic distortion (THD) below 1.2%. The amplitude was measured at approximately 0.65 Vpp, and phase shifts from 0° to 360° can be introduced by modifying the DDS phase register. These characteristics make the triangular waveform generation subsystem ideal for applications in waveform synthesis, modulation experiments, and control system testing. Figs. 6-8 depicts the generated Triangular Wave at different frequencies and phase angles.
Figure 6. Generated Triangular Wave at 50 Hz with phases 0, 90, 180.
Figure 7. Generated Triangular Wave at 100 Hz with phases 0, 90, 180.
Figure 8. Generated Triangular Wave at 250 Hz with phases 0, 90, 180.
6.3. Sawtooth Wave Generation
The
sawtooth waveform (
Figure 9) in the proposed hybrid generator is realized using the
Arduino Mega’s Timer2 PWM module combined with an
RC integrator circuit to convert the high-frequency pulse-width modulated signal into a linearly varying voltage. Unlike the DDS-based sine and triangular waveforms, which are digitally synthesized by the
AD9833, the sawtooth signal is generated through
analog reconstruction of a variable-duty PWM stream. In this design, the Arduino outputs a PWM signal on digital pin D10, which is then passed through a
low-pass RC filter (R = 3.3 kΩ, C = 0.1 µF). The capacitor charges and discharges through the resistor at a controlled rate, producing a continuous rising and falling ramp voltage characteristic of a sawtooth wave. The time-domain representation of an ideal sawtooth waveform is given by equation (
4):
where A is the peak amplitude and T=1/f is the period of the waveform. Its Fourier series expansion, emphasizing the presence of both even and odd harmonics, is represented as equation (
5):
(5)
Figure 9. Generated Sawtooth waves at different frequencies.
It demonstrates a strong harmonic content that decreases proportionally to 1/n. The output frequency is controlled by the frequency potentiometer (A0), mapped through the Arduino’s analog-to-digital converter (ADC) to adjust the timer’s prescaler and compare registers, enabling a frequency tuning range of 50 Hz-1 kHz. The amplitude of the ramp remains consistent at approximately 0.65 Vp-p, while the phase remains constant relative to the PWM carrier signal. Experimental results confirm that the generated sawtooth waveform maintains excellent linearity (>95%) with a total harmonic distortion (THD) of approximately 1.5%, sufficient for modulation and timing experiments. The simplicity of the PWM-RC method ensures compactness, low power consumption, and stable analog reconstruction of the sawtooth waveform.
6.4. Square Wave Generation
The square waveform (Figs 10-15) in the system is generated using the Timer1 hardware PWM functionality of the Arduino Mega 2560, which provides precise control of both frequency and duty cycle. The square wave is inherently digital, consisting of alternating high and low states, and therefore does not require analog filtering. The duty cycle—the ratio of the high time (tONt_{ON}tON) to the total period (TTT)—is varied through Potentiometer A2, while the frequency is simultaneously adjusted using Potentiometer A0. The digital timer registers (OCR1A and ICR1) are continuously updated by the Arduino firmware to produce the desired frequency-duty combination.
Mathematically, the square waveform can be described as equation (
6):
(6)
where A is the amplitude, D is the duty cycle (0 ≤ D ≤ 1), and T=1/f is the period. The Fourier series representation of an ideal square wave with 50% duty cycle is given by equation (
7):
(7)
indicating that it contains only odd harmonics, with amplitudes decreasing proportionally to 1/n1/n1/n. In the implemented design, the frequency range was restricted between 50 Hz and 1 kHz, and the duty cycle adjustable from 0% to 100%, enabling asymmetric pulse generation for advanced modulation tests.
Figure 10. Generated Square wave with f=750 Hz.
Figure 11. Generated Square wave with f=500 Hz.
Figure 12. Generated Square wave with f=250 Hz.
Figure 13. Generated Square wave with f=100 Hz.
Figure 14. Generated Square wave with f=50 Hz.
Figure 15. Generated Square wave with f=1000 Hz.
The generated square wave demonstrated high stability with frequency error below ±0.05% and rise/fall times under 5 µs, measured using a Rigol DS1102E digital oscilloscope. The waveform amplitude remained consistent with a logic-level output of 0-5 V, and the power dissipation of the digital subsystem was negligible (<150 mW). This precise control over duty and frequency parameters makes the square wave output particularly suitable for use in pulse-width modulation (PWM), digital switching circuits, and timing-based experiments in control and communication systems.
7. Results and Discussions
The developed hybrid waveform generator (
Figure 16) successfully produced stable and accurate
sine, triangular, sawtooth, and square waveforms across the frequency range of
50 Hz to 1 kHz, with independent control over
phase (0°-360°) and
duty cycle (0-100%). The results were validated through both hardware testing and simulated waveform plots.
Figure 10(a) shows the
sinewave outputs at 50 Hz, 100 Hz, and 250 Hz for phase angles of 0°, 90°, and 180°, demonstrating perfect periodicity and smooth transitions with phase shifts corresponding precisely to one-quarter and half-cycle displacements.
Figure 10(b) presents
triangular waveforms generated over the same frequency range, exhibiting linear rise and fall slopes with negligible waveform distortion, confirming the effectiveness of both the DDS-based and PWM-RC filtering approaches.
Figure 10(c) depicts
sawtooth waves of 50-1000 Hz frequencies, clearly showing the decrease in ramp period with increasing frequency while maintaining amplitude uniformity and high linearity.
Figure 10(d) displays
square waves generated at identical frequencies but with varying
duty cycles (25%, 50%, 75%), where the pulse width is observed to vary proportionally with the duty ratio while the amplitude remains constant at logic-level 5 V. Quantitative evaluation using a digital oscilloscope and simulation data revealed that sine and triangle outputs achieved
frequency accuracy within ±0.05%,
phase error below ±2°, and
total harmonic distortion (THD) values of
0.8% and
1.2%, respectively, whereas the sawtooth and square outputs maintained
THD < 1.5% and
rise/fall times < 5 µs. The simulated graphs further confirm waveform integrity and parameter responsiveness, as shown in
Figures 10(a-d), validating the reliability of the proposed system. The results demonstrate that the
Arduino Mega + AD9833 hybrid generator performs comparably to commercial function generators (e.g., Rigol DG1022Z, Keysight 33500B) within the tested frequency range, while reducing cost by over
95% and power consumption by more than
80%, making it an excellent educational and prototyping instrument for laboratory use.
Figure 16. Hybrid Waveform Generation at various phase angle, frequency and duty cycles.
Table 2. Comparison with the Existing Hybrid Function Generators.
System / Reference | Core Technology | Frequency Range | Frequency Accuracy | Phase Accuracy / Control | THD (%) | Duty Control | Remarks / Limitations |
XR2206 Analog Generator 3] | Analog Function IC | 1 Hz - 1 MHz | ±1.5% | No control | 2.80% | Fixed 50% | Low cost but poor stability and drift |
ICL8038 Analog Generator 4] | Analog Oscillator | 0.1 Hz - 300 kHz | ±1.0% | No control | 3.00% | Fixed 50% | High distortion; nonlinear response |
AD9850 DDS Module | [9] | T. S. Wei, N. Sulaiman, N. Kamsani and N. A. M. Yunus, "Dual control Direct Digital Synthesizer (DCDDS) for electronic testing and experimental work," 2014 4th International Conference on Engineering Technology and Technopreneuship (ICE2T), Kuala Lumpur, Malaysia, 2014, pp. 137-142,
https://doi.org/10.1109/ICE2T.2014.7006234 |
[9] | DDS (125 MHz Clock) | 0.1 Hz - 40 MHz | ±0.05% | Limited (up to 180°) | 1.00% | No | High precision but lacks flexibility |
AD9833 DDS + Arduino Uno | DDS (25 MHz Clock) | 1 Hz - 100 kHz | ±0.1% | Limited 0°-180° | 0.90% | No | Compact; limited phase/duty control |
STM32 + AD9851 Module | [19] | Ye, S., Long, Z., Zhao, H., Ju, J., Yao, M., Li, X., & Zhang, X. (2023). Investigation to dual-frequency direct digital synthesis and resonance frequency tracking in power ultrasonic generator. IEEE Transactions on Circuits and Systems I: Regular Papers, 70(11), 4435-4446. |
[19] | ARM MCU + DDS | 1 Hz - 60 MHz | ±0.02% | Full (0°-360°) | 0.70% | Partial | Excellent accuracy; complex coding |
ESP32 + AD9833 Bluetooth | [15] | Nasibov, A. S., Bagramov, V. G., Berezhnoy, K. V., Plokhinsky, Y. V., Tasmagulov, I. D., Danielyan, G. L., ... & Chevokin, V. K. (2021, December). Multichannel system for recording sub-nanosecond pulses of gas and semiconductor radiation sources. In XV International Conference on Pulsed Lasers and Laser Applications (Vol. 12086, pp. 357-364). SPIE. |
[15] | DDS + Wi-Fi/BLE Control | 1 Hz - 12.5 MHz | ±0.05% | 0°-360° | 1.00% | No | Wireless control; higher noise floor |
PWM + RC Filter (Arduino) | [12] | Mohiuddin, M., Kadir, K., Roslan, N. F., Maricar, N., Khan, S., Islam, M., & Aboadla, E. (2024, July). Synchronous Machine Torque Ripple Reduction using Seesaw Space Vector Pulse Width Modulation (SSSVPWM). In 2024 IEEE 10th International Conference on Smart Instrumentation, Measurement and Applications (ICSIMA) (pp. 36-41). IEEE. |
[12] | PWM + RC Analog Filtering | 0-1 kHz | ±0.5% | No | 2.00% | Yes | Simple design; higher ripple |
Proposed Arduino Mega + AD9833 Hybrid System | DDS + PWM + Timer Integration | 50 Hz - 1 kHz | ±0.05% | 0°-360° (Full Control) | 0.8% (Sine) / 1.2% (Tri) / 1.5% (Saw) | 0-100% (Adjustable) | Low cost (<15 USD), stable, accurate, educational-grade design |
The comparative analysis presented in
Table 2 provides a detailed evaluation of the proposed
Arduino Mega + AD9833 hybrid waveform generator against a range of existing analog, digital, and mixed-signal function generator modules in terms of frequency accuracy, harmonic distortion, and control capabilities. The results clearly establish that while traditional analog function generator ICs such as the
XR2206 and
ICL8038 remain popular for educational demonstrations due to their simplicity and low cost, their performance is limited by inherent analog drift, poor linearity, and restricted control features. Both these devices offer fixed duty cycles (typically 50%), no phase control, and exhibit significant
frequency drift (~±1-1.5%) and
total harmonic distortion (THD) above 2.5%, making them unsuitable for precision or calibration tasks. On the other hand, digital direct synthesis (DDS)-based modules such as the
AD9850 and
AD9833, operating with high-speed master clocks (125 MHz and 25 MHz, respectively), offer considerably higher accuracy (±0.05-0.1%) and lower distortion (<1%). These modules leverage phase accumulator and digital-to-analog conversion principles to generate clean and stable waveforms with excellent repeatability. However, their standalone operation lacks interactive user control and adaptability, as they generally do not provide independent
duty cycle modulation or full
phase programmability unless combined with a microcontroller. Microcontroller-integrated systems such as
STM32 + AD9851 and
ESP32 + AD9833 offer notable improvements, achieving
±0.02-0.05% accuracy,
THD below 1%, and
phase adjustability from 0° to 360°. These systems, though precise, demand advanced programming and configuration complexity, making them less accessible for beginner-level educational use. Conversely, PWM-RC-based Arduino implementations represent the simplest architecture for generating analog-like waveforms through low-pass filtering of digital PWM signals. While effective for low-frequency applications, these suffer from limited linearity, high ripple content, and
THD around 2%, restricting their usability to non-critical signal generation tasks. The
proposed Arduino Mega + AD9833 hybrid system effectively bridges this performance gap by integrating
DDS precision for sine and triangular waveforms with
PWM and timer-driven generation for sawtooth and square outputs. The system achieves
±0.05% frequency accuracy,
phase resolution of 0°-360°, and
duty control between 0-100%, surpassing other low-cost solutions in both stability and versatility. The
THD values were experimentally verified as
0.8% for sine,
1.2% for triangular, and
1.5% for sawtooth waveforms, representing an excellent balance between spectral purity and hardware simplicity. The modular design allows real-time tuning via
three potentiometers and
four pushbuttons, with a
16×2 LCD for dynamic display of waveform type, frequency, and phase. Unlike high-end DDS modules or commercial instruments such as the
Rigol DG1022Z and
Keysight 33500B, which cost hundreds of dollars, the proposed system delivers comparable accuracy and functionality for less than
15 USD, while operating on a
5 V USB supply with total power consumption under
350 mW. This makes the system particularly attractive for
academic laboratories, embedded design education, and prototyping environments. It not only demonstrates the application of hybrid digital-analog signal generation principles but also offers hands-on insight into concepts like frequency synthesis, PWM modulation, RC filtering, and phase manipulation. Therefore, the proposed system stands as a pedagogically powerful and technically sound alternative to expensive commercial function generators, providing an excellent trade-off between
precision, programmability, portability, and cost-effectiveness.
8. Conclusions
The research successfully demonstrated the design, development, and validation of a low-cost hybrid waveform generator based on an Arduino Mega 2560 microcontroller integrated with an AD9833 Direct Digital Synthesizer (DDS). The proposed system effectively generates four fundamental waveforms—sine, triangular, sawtooth, and square—with user-controlled frequency, phase, and duty cycle through three potentiometers and four pushbuttons. The hybrid configuration combines the precision of DDS for sine and triangular signals with the flexibility of PWM-RC filtering and timer-based digital switching for sawtooth and square waveforms, resulting in a compact, power-efficient, and versatile waveform source. Experimental and simulated results confirmed that the developed system achieves frequency accuracy within ±0.05%, phase accuracy within ±2°, and total harmonic distortion (THD) as low as 0.8% for sinewave output, outperforming most existing low-cost function generator modules. Compared to traditional analog function generator ICs such as XR2206 or ICL8038, and even standalone DDS modules like AD9850 and AD9833, the proposed design provides simultaneous real-time control of waveform parameters and improved output stability at a fraction of the cost. The system operates reliably within the 50 Hz-1 kHz range, making it particularly suitable for academic laboratories, electronics training setups, and embedded signal applications. Its open-source architecture and user-friendly interface facilitate easy customization, extension to higher frequencies, or integration with communication and control modules such as Bluetooth or PC-based monitoring. Overall, the project demonstrates how a judicious blend of hardware simplicity and digital synthesis can yield laboratory-grade performance in a portable, affordable, and educationally meaningful instrument. The outcomes position the Arduino Mega + AD9833 hybrid generator as an excellent teaching and prototyping platform that bridges the gap between costly commercial function generators and simple educational waveform kits, fostering deeper understanding of waveform synthesis, signal analysis, and embedded system design.
Abbreviations
ADC | Analog-to-Digital Converter |
AD9833 | Analog Devices 9833 Direct Digital Synthesizer Module |
AM | Amplitude Modulation |
API | Application Programming Interface |
AVR | Alf and Vegard’s RISC Processor (Microcontroller Architecture used in Arduino Mega) |
CPU | Central Processing Unit |
DAC | Digital-to-Analog Converter |
DDS | Direct Digital Synthesis |
DC | Direct Current |
DMM | Digital Multimeter |
DSP | Digital Signal Processing |
EEPROM | Electrically Erasable Programmable Read-Only Memory |
EMI | Electromagnetic Interference |
FFT | Fast Fourier Transform |
FSYNC | Frame Synchronization (Slave Select Pin of AD9833) |
GND | Ground |
GPIO | General Purpose Input/Output |
Hz | Hertz (cycles per second) |
I²C | Inter-Integrated Circuit (Two-wire Serial Communication Protocol) |
IC | Integrated Circuit |
IDE | Integrated Development Environment (Arduino IDE) |
LCD | Liquid Crystal Display |
LED | Light Emitting Diode |
MCU | Microcontroller Unit |
MHz | Megahertz |
MOSI | Master Out Slave In (SPI Communication Line) |
MISO | Master In Slave Out (SPI Communication Line) |
MSB | Most Significant Bit |
OC | Output Compare (Timer Pin for PWM) |
PCB | Printed Circuit Board |
POT | Potentiometer |
PWM | Pulse Width Modulation |
RC | Resistor-Capacitor Network (used for signal smoothing) |
RMS | Root Mean Square |
ROM | Read-Only Memory |
SCLK | Serial Clock (SPI Communication Line) |
SDATA | Serial Data (SPI Communication Line) |
SPI | Serial Peripheral Interface |
SS | Slave Select (used for Chip Enable on SPI devices) |
THD | Total Harmonic Distortion |
TTL | Transistor-Transistor Logic |
UART | Universal Asynchronous Receiver-Transmitter |
USB | Universal Serial Bus |
Author Contributions
Shrugal Agarwal: Conceptualization, Data curation, Software, Writing – review & editing
Priyam Parikh: Conceptualization, Formal Analysis, Investigation, Methodology, Resources, Supervision, Writing – review & editing
Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this work.
References
| [1] |
Analog Devices, AD9833: Low Power, Programmable Waveform Generator, Data Sheet, 2023. [Online]. Available:
https://www.analog.com/media/en/technical-documentation/data-sheets/ad9833.pdf
|
| [2] |
“AD9833 Function Generator Using Arduino,” Hackster. io, 2023. [Online]. Available:
https://www.hackster.io/john-bradnam/ad9833-function-generator-180317
|
| [3] |
D. Das, “Build Your Own Function Generator with Arduino and AD9833 DDS Module,” CircuitDigest, 2021. [Online]. Available:
https://circuitdigest.com/microcontroller-projects/arduino-ad9833-function-generator
|
| [4] |
V. Smolaninovs and M. Terauds, “Microcontroller-Based Electronic Laboratory Measurement Device for Distance Education,” Electronics, vol. 14, no. 3, p. 438, 2025.
https://doi.org/10.3390/electronics14030438
|
| [5] |
N. Zoric, A. Zoric, S. Ilic, and B. Jovanovic, “A simple low-cost function generator controlled by Android application,” in Proc. Int. Scientific Conf. UNITECH 2022, Gabrovo, Bulgaria, Nov. 18-19, 2022, pp. 95-99.
|
| [6] |
J. Qi, W. Liu, and Y. Zhang, “Design and Analysis of a Low-Cost Wave Generator Based on Direct Digital Synthesis,” J. Electr. Comput. Eng., vol. 2016, Article ID 8519048, 2016.
https://doi.org/10.1155/2016/8519048
|
| [7] |
A. Ben-Atitallah et al., “An Effective Obstacle Detection System Using Deep Learning Advantages to Aid Blind and Visually Impaired Navigation,” Ain Shams Eng. J., vol. 15, no. 2, 2024, Art. 102387.
https://doi.org/10.1016/j.asej.2023.102387
|
| [8] |
D. Das and R. Saha, “Arduino-Based DDS Function Generator Using AD9833,” Circuit Digest, 2021. [Online]. Available:
https://circuitdigest.com/microcontroller-projects/arduino-ad9833-function-generator
|
| [9] |
T. S. Wei, N. Sulaiman, N. Kamsani and N. A. M. Yunus, "Dual control Direct Digital Synthesizer (DCDDS) for electronic testing and experimental work," 2014 4th International Conference on Engineering Technology and Technopreneuship (ICE2T), Kuala Lumpur, Malaysia, 2014, pp. 137-142,
https://doi.org/10.1109/ICE2T.2014.7006234
|
| [10] |
H. H. Shaker, H. Kasban, A. A. Saleh, and M. Dessouky, “Development of a low-cost digital gamma spectrometer using an STM32F4 microcontroller,” J. Anal. At. Spectrom., vol. 39, no. 6, pp. 1523-1528, 2024.
https://doi.org/10.1039/D4JA00050A
|
| [11] |
Sharma, A., Sun, Y., & Simpson, O. (2021). Design and implementation of a re-configurable versatile direct digital synthesis-based pulse generator. IEEE Transactions on Instrumentation and Measurement, 70, 1-14.
|
| [12] |
Mohiuddin, M., Kadir, K., Roslan, N. F., Maricar, N., Khan, S., Islam, M., & Aboadla, E. (2024, July). Synchronous Machine Torque Ripple Reduction using Seesaw Space Vector Pulse Width Modulation (SSSVPWM). In 2024 IEEE 10th International Conference on Smart Instrumentation, Measurement and Applications (ICSIMA) (pp. 36-41). IEEE.
|
| [13] |
Wu, X., Wang, X. H., Zhen, Q. H., Xue, G. Q., He, C., Lv, Y. J., ... & Guo, Q. H. (2025). Designing and Testing of a High-Power Transient Electromagnetic Transmitter with Arbitrary Coded Waveforms. Applied Geophysics, 1-14.
|
| [14] |
Abdelbaki, M., Esmail, R., Eltabakh, H., Salman, O., Habiba, M., Mourad, J., & Sherif, S. (2025, July). Non-Invasive Tissue Damage Detection Using Micro Interdigitated Electrodes and Arduino-Based Impedance Spectroscopy. In 2025 International Telecommunications Conference (ITC-Egypt) (pp. 447-452). IEEE.
|
| [15] |
Nasibov, A. S., Bagramov, V. G., Berezhnoy, K. V., Plokhinsky, Y. V., Tasmagulov, I. D., Danielyan, G. L., ... & Chevokin, V. K. (2021, December). Multichannel system for recording sub-nanosecond pulses of gas and semiconductor radiation sources. In XV International Conference on Pulsed Lasers and Laser Applications (Vol. 12086, pp. 357-364). SPIE.
|
| [16] |
Atci, A., Unal, E., & Akgol, O. (2024). A Low-Cost Data Acquisition System Design for Multifunctional Test Equipment in Electronics Laboratories. Electronics, 13(24), 4937.
|
| [17] |
Daodong, Z., Yikai, P., & Hongping, P. (2021, August). Design of DDS Signal Generator Based on FPGA. In 2021 4th International Conference on Pattern Recognition and Artificial Intelligence (PRAI) (pp. 51-54). IEEE.
|
| [18] |
Chekka, A. B., & Aggala, N. J. (2021, June). High frequency Chirp signal generator using multi DDS approach on FPGA. In 2021 5th International Conference on Trends in Electronics and Informatics (ICOEI) (pp. 137-142). IEEE.
|
| [19] |
Ye, S., Long, Z., Zhao, H., Ju, J., Yao, M., Li, X., & Zhang, X. (2023). Investigation to dual-frequency direct digital synthesis and resonance frequency tracking in power ultrasonic generator. IEEE Transactions on Circuits and Systems I: Regular Papers, 70(11), 4435-4446.
|
| [20] |
Kweon, S. J., Rafi, A. K., Cheon, S. I., Je, M., & Ha, S. (2022). On-chip sinusoidal signal generators for electrical impedance spectroscopy: Methodological review. IEEE Transactions on Biomedical Circuits and Systems, 16(3), 337-360.
|
| [21] |
Ruo Roch, M., & Martina, M. (2022). VirtLAB: A Low-Cost Platform for Electronics Lab Experiments. Sensors, 22(13), 4840.
https://doi.org/10.3390/s22134840
|
| [22] |
Dong, J., & Yue, S. (2025, July). Design and Performance Optimisation Analysis of Fpga Dds Signal Generator With Dynamic Frequency Control. In 2025 44th Chinese Control Conference (CCC) (pp. 3769-3774). IEEE.
|
| [23] |
ICL, XR2206 Monolithic Function Generator: Sine, Triangle, and Square Wave Outputs, XR2206 Datasheet, 2023. [Online]. Available:
https://www.intersil.com/content/dam/Intersil/documents/xr22/xr2206.pdf
|
| [24] |
Maxim Integrated, ICL8038 Precision Waveform Generator/Voltage-Controlled Oscillator, ICL8038 Datasheet, 2023. [Online]. Available:
https://datasheets.maximintegrated.com/en/ds/ICL8038.pdf
|
Cite This Article
-
APA Style
Agarwal, S., Parikh, P. (2025). Design and Implementation of a Low-Cost Multi-Waveform Generator Using Arduino Mega and AD9833 with LCD-Based Interactive Control. Science Journal of Circuits, Systems and Signal Processing, 12(2), 30-46. https://doi.org/10.11648/j.cssp.20251202.12
Copy
|
Download
ACS Style
Agarwal, S.; Parikh, P. Design and Implementation of a Low-Cost Multi-Waveform Generator Using Arduino Mega and AD9833 with LCD-Based Interactive Control. Sci. J. Circuits Syst. Signal Process. 2025, 12(2), 30-46. doi: 10.11648/j.cssp.20251202.12
Copy
|
Download
AMA Style
Agarwal S, Parikh P. Design and Implementation of a Low-Cost Multi-Waveform Generator Using Arduino Mega and AD9833 with LCD-Based Interactive Control. Sci J Circuits Syst Signal Process. 2025;12(2):30-46. doi: 10.11648/j.cssp.20251202.12
Copy
|
Download
-
@article{10.11648/j.cssp.20251202.12,
author = {Shrugal Agarwal and Priyam Parikh},
title = {Design and Implementation of a Low-Cost Multi-Waveform Generator Using Arduino Mega and AD9833 with LCD-Based Interactive Control},
journal = {Science Journal of Circuits, Systems and Signal Processing},
volume = {12},
number = {2},
pages = {30-46},
doi = {10.11648/j.cssp.20251202.12},
url = {https://doi.org/10.11648/j.cssp.20251202.12},
eprint = {https://article.sciencepublishinggroup.com/pdf/10.11648.j.cssp.20251202.12},
abstract = {Signal generators are essential instruments for testing, measurement, and embedded system validation. Commercial function generators, however, are often expensive and non-customizable for educational or prototyping environments. This study presents the design and realization of a low-cost, microcontroller-based multi-waveform generator capable of producing sine, triangular, sawtooth, and square waveforms with adjustable frequency, phase, and duty cycle. The system integrates an Arduino Mega 2560 controller with an AD9833 Direct Digital Synthesis (DDS) module for high-precision sine and triangular outputs, while hardware-timed PWM channels generate sawtooth and square waveforms. Three potentiometers provide real-time user control of frequency (50 Hz-1 kHz), phase (0°-360°), and duty ratio (0-100%), and a 16×2 I²C LCD displays the selected waveform parameters. Experimental characterization demonstrates frequency accuracy of ±0.05% and phase error within ±2° for AD9833-based signals, and total harmonic distortion (THD) below 0.8% for sine output up to 1 kHz. PWM-derived waveforms exhibit amplitude linearity of 96-98% and negligible drift across 8 h continuous operation. Compared with conventional analog Wien-bridge or XR2206-based function generators, the proposed system offers higher frequency stability, lower power consumption (≈310 mW), and greater flexibility for digital control at less than 15 USD total cost. The developed prototype successfully reproduces clean, noise-free waveforms observable on an oscilloscope and matches reference laboratory generators with an RMS amplitude deviation under 0.03 V (5 V scale). The compact and modular design enables rapid educational deployment and portable instrumentation. Future enhancements may include amplitude modulation through DAC expansion, frequency sweep automation, and PC-linked waveform visualization. The proposed design thus bridges the gap between low-cost educational tools and professional waveform generation, demonstrating the potential of open-source microcontroller architectures for accurate, user-interactive signal synthesis.},
year = {2025}
}
Copy
|
Download
-
TY - JOUR
T1 - Design and Implementation of a Low-Cost Multi-Waveform Generator Using Arduino Mega and AD9833 with LCD-Based Interactive Control
AU - Shrugal Agarwal
AU - Priyam Parikh
Y1 - 2025/12/24
PY - 2025
N1 - https://doi.org/10.11648/j.cssp.20251202.12
DO - 10.11648/j.cssp.20251202.12
T2 - Science Journal of Circuits, Systems and Signal Processing
JF - Science Journal of Circuits, Systems and Signal Processing
JO - Science Journal of Circuits, Systems and Signal Processing
SP - 30
EP - 46
PB - Science Publishing Group
SN - 2326-9073
UR - https://doi.org/10.11648/j.cssp.20251202.12
AB - Signal generators are essential instruments for testing, measurement, and embedded system validation. Commercial function generators, however, are often expensive and non-customizable for educational or prototyping environments. This study presents the design and realization of a low-cost, microcontroller-based multi-waveform generator capable of producing sine, triangular, sawtooth, and square waveforms with adjustable frequency, phase, and duty cycle. The system integrates an Arduino Mega 2560 controller with an AD9833 Direct Digital Synthesis (DDS) module for high-precision sine and triangular outputs, while hardware-timed PWM channels generate sawtooth and square waveforms. Three potentiometers provide real-time user control of frequency (50 Hz-1 kHz), phase (0°-360°), and duty ratio (0-100%), and a 16×2 I²C LCD displays the selected waveform parameters. Experimental characterization demonstrates frequency accuracy of ±0.05% and phase error within ±2° for AD9833-based signals, and total harmonic distortion (THD) below 0.8% for sine output up to 1 kHz. PWM-derived waveforms exhibit amplitude linearity of 96-98% and negligible drift across 8 h continuous operation. Compared with conventional analog Wien-bridge or XR2206-based function generators, the proposed system offers higher frequency stability, lower power consumption (≈310 mW), and greater flexibility for digital control at less than 15 USD total cost. The developed prototype successfully reproduces clean, noise-free waveforms observable on an oscilloscope and matches reference laboratory generators with an RMS amplitude deviation under 0.03 V (5 V scale). The compact and modular design enables rapid educational deployment and portable instrumentation. Future enhancements may include amplitude modulation through DAC expansion, frequency sweep automation, and PC-linked waveform visualization. The proposed design thus bridges the gap between low-cost educational tools and professional waveform generation, demonstrating the potential of open-source microcontroller architectures for accurate, user-interactive signal synthesis.
VL - 12
IS - 2
ER -
Copy
|
Download