Close

PWM - Controlling the Analog modules

A project log for 8 channel surround sound synth with analog filters

Standalone synth and surround sound mixer. An 8ch input/output soundcard combined with two analog filters, controlled with a raspberrypi.

slavko-glamocaninSlavko Glamocanin 10/06/2018 at 22:140 Comments

The brains of the project is the immensely powerful RaspberryPi, but for interfacing I like to use the Arduino Pro mini, a very flexible MicroController with many I/O lines which i connect to the Raspberry via the serial interface. For this you have to disable the default configuration of using the raspberry pi serial port as a login option.

I will control the analog modules (a filter module from the great Shruti synth by Mutable instruments) with the arduino's Pulse Width Modulation lines.

But the first time i tried it, the auditory results were horrible! The PWM frequency was obviously too low and fell into the auditory frequency spectrum (since the shruti also uses an ATMEL chip i hoped the smoothing was done on the filter board... nope:). 

So to convert the jagged square wave the PWM generates I used a simple RC filter to only leave a nice DC voltage.

The RC filter is a combination of a resistor and a capacitor, which cuts of higher frequencies. You can use an online calculator to find the R and C values you need.

To use the smallest capacitors possible I also increased the PWM frequency to its highest value. The arduino pro mini has 6 PWM outputs, two per timer. Although changing the frequency of the first timer disrupts delay() and millis() functions i used it nonetheless because i have no need for timing in this program.

Here is a nice cheat sheet describing the modes of the PWM outputs and how to set the timer divisors to get the highest frequencies.

Discussions