I had the idea to use the distance sensors so I could control the pitch of my synths oscillator like a theremin. This should have been fairly simple as the 1V/oct standard for euro-rack synths calibrates the oscillator so 0 to 5 volts corresponds to 4 keyboard octaves. However. The output of the Arduino uses PWM to output 0-5v so is unstable at best. This means the oscillator will not track accurately and will jump between a handful of random pitches. This could be solved using a DAC chip to output smooth and accurate voltages. However I opted not pursue this at this time, partly due to complexity, but also as I realized there were much more useful and flexible things I could do with the distance sensors (more on that later).
Following on from the decision to use the LEDs for mirroring the synth’s LFO patterns I built a circuit to make this happen. Its very simply mapping the analogue in (0 – 1023) to the brightness values of the LEDs (0-255). More on this in the code section. This is a very simple concept but gives a really strong real-time visualization of the LFO for both performer and audience. (CODE FOR THIS AT BOTTOM OF PAGE)
In the process of experimenting with the LFO reactive LEDs I experimented with using a schmitt trigger IC to measure the frequency of the LFOs. This turned out to not be very helpful for the LFOs as the Arduino struggles to read such low frequencies. However it was perfect for the Oscillator as it could accurately read its pitch.
The chip squares off any input wave for easy digital reading of the frequency. This isn’t necessary for the squarewave oscillator but is reacquired for the triangle (the synth has both). It is also common to plug in external oscillators to modular synths for FM or using their filter so the ability to measure other waves such as sine is very useful. The chip itself is pretty simple…

This data was then used to control more LEDs in a more dynamic way than the LFOs do. Im only using pins 1 and 2 so there is room to do more with this chip in future.
Or so I thought……..
#include <FastLED.h>
// How many leds in strip?
#define NUM_LEDS 8
#define DATA_PIN 10
// Define the array of leds
CRGB leds[NUM_LEDS];
int LFO;
void setup() {
// Uncomment/edit one of the following lines for your leds arrangement.
// ## Clockless types ##
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is aissumed
}
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue;
// print out the value you read:
Serial.println(voltage);
LFO = map(voltage, 0, 800, 0, 255);
for(int i = 0; i < NUM_LEDS; (i++)) {
// set our current dot to red
leds[i] = CRGB::Blue;
FastLED.setBrightness(LFO);
FastLED.show();
}
}