top of page

tinyLFO

An ATTiny-based LFO with Tap Tempo and More

tinyLFO.png

Overview

I hate to break it to you, but your LFO could use some updating. You know, one with the Schmitt trigger and integrator made from a dual opamp? I can hear you say "what's wrong with it, it's ben around forever!" True, it has, and technology continues to march forward. In a package the same size as your dual opamp (and with a ton fewer passives), you could have an LFO that gives you the following:

​

  • Dual LFO outputs

  • Tap Tempo

  • Speed control

  • Wave shape selection (up to 8 selectable)

  • Divisions of 1/2, 1, and 2 (or change the code to suit your fancy)

​

"What sorcery is this?!" you say. Microcontrollers, my dear DIY'er, microcontrollers. Using an ATTiny85, we can pack all those features into an 8 pin package. Interested? Read on!

How It Works

The heart of this chip is the LFO generation, which is accomplished through the use of lookup tables and PWM outputs of the ATTiny85. Fortunately for you, I have gone through and created lookup tables, each with 255 entries equally spaced in time, for sine, square, triangle, rising sawtooth, and falling sawtooth waveforms. Each cycle through the main loop of the code, the time is checked to see if we move on to the next step of the waveform. If enough time has passed, we move on to the next entry in the lookup table. We do that over and over.

​

In addition to keeping track of the time and updating the PWM out based on it, there are checks every 200 ms for user interaction, such as changing the waveform shape, changing the speed control, or changing the tempo division switch. These are checked only 5 times a second because, for humans, 200 ms is nearly imperceptible while it is a veritable eternity for the microcontroller.

​

Tap tempo uses pin change interrupts, meaning that nothing is done with tap tempo until the button is pressed. Once it is, it interrupts the process to make note of the time at which it was pressed and then resumes regular processing. The next time the button is pressed, the time difference is calculated and, once the button has been pressed three times, the average tap time is calculated and the LFO is changed to that rate.

​

There is very little circuitry required for the tinyLFO, as it just needs the programmed ATTiny85, speed potentiometer, and the +5V power supply. Additional components such as the tap tempo switch or division switch are optional. For the code, visit here.

​

*Disclaimer: I know that there exists the excellent stompLFO from ElectricDruid. Tom's stuff is excellent. I developed this to meet my needs and to use the ATTiny core instead of a PIC core. It's just a matter of personal preference, but it's kind of like Mac vs. PC. Some people just use what they use because they are comfortable with it. I haven't gotten into PIC's yet.

bottom of page