Arduino LFO Waveform Generator V1

(C) 2009, G. Forrest Cook

Arduino LFO V1

Introduction

This project uses an Arduino microprocessor and a DAC0808 8 bit parallel DAC to produce arbitrary low frequency oscillator (LFO) waveforms. These waveforms are useful for driving a tremolo/vibrato circuit in a guitar amplifier such as the Lil Tiger or a phaser effect such as the Liquidator. The second version of this project improves on this design by using a serial DAC chip and an analog speed control.

The initial version of this project was build using the Arduino Diecimila development board and an Arduino prototype shield for the DAC and associated parts. The original assembly can be seen in the photographs of the Lil Tiger project. The second generation version (as shown in the schematic) was built using just the Arduino's Atmega 126 processor chip on a stand-alone circuit board. The microprocessor should be programmed on the Arduino board then moved to the standalone LFO board.

Tis circuit is a descendent of my older waveform generator project.

Hardware

The 7.5VDC power to the board comes from a full-wave Schottky diode bridge rectifier and filter capacitor that is connected to the 6.3VAC filament winding of a vacuum tube power supply. The 7.5V is regulated down to 5V using a 78L05 regulator. The 5V supply is inverted to -5V with an ICL7660 IC. The various voltages power the processor, DAC and op-amps.

The DAC is an MC1408P8 that is connected to Port D (out0-out7) on the Arduino. The DAC output drives half of a 1458 dual op-amp wired as a low-pass current to voltage amplifier. The 1458 drives the positive side of a front panel display LED and an LED/LVR opto-coupler. The other half of the 1458 creates a negative 1.4V bias for driving the negative side of the LEDs. The bias is set so that the LED is just turning on when the DAC is set to output zero volts.

An RGB LED is connected to the Arduino's port E (out8, out9, out10), the software displays a unique color for each of the three waveforms that the board can produce. An R-C delay is connected to analog input 1 on Port C, this allows the software to determine if the board was powerd on for the first time or reset manually. A 10K Speed control pot is connected to analog input 2 on Port C, the position is read and used to set the waveform clock rate.

Software

The current Arduino "sketch" for this project is DACmulti2a.pde, it generates three different waveforms. The waves are all exponentially weighted sine waves that produce more natural sounds than a true sine wave when driving LED/LVR devices. The three waveforms are limited to 256 steps each, waveforms that are much larger will run the Arduino out of memory.

There is an RC time delay on Analog input 0, when the board powers on the first time, it reads a low value but when the reset button is pushed manually, it reads a high value. That combined with an EEPROM setting allows the board to boot into one of three possible states. One might wonder why I designed the waveform selection software this way instead of putting a mode test inside of the LFO while loop, it was done for speed. An in-loop test limites the maximum LFO speed below the maximum desired rate.

The waveforms were generated by this Python language program: sinegen3.py. The program was run and the output wave tables were stored in a file and transferred into the Arduino source code with a text editor.

Software Considerations

The Arduino software (Version 16) is a bit dodgy when dealing with large arrays. It will happily compile a huge array without any warning messages, but downloading the code will either produce garbage waveforms or in extreme cases, overwrite the Arduino's bootloader. Fixing the bootloader involves buying a special ICSP "pod" board (Sparkfun sells these) and using the pod to reload the Arduino software.

This software: DAC3.pde has a 3840 byte wavetable array, it compiles with the Arduino software but when you load the code, it overwrites the bootloader software and crashes the board. Another version of this, DAC2.pde, with a 768 byte array did not crash the Arduino, but the waveforms had partially bad data values on the DAC output. The same data was plotted via a Python program using matplotlib and the waveform looked fine.

Back to FC's Music Circuits page.