PWM Based modulation from a microcontroller


#1

I can't find anything online that is related to this, figured I would ask here first. In fact, as I'm typing this out I'm realizing that this is probably quite common in the eurorack format (something I'm unfamiliar with).

In an attempt to offload resources from the Axoloti, I had the idea to send LFOs and envelopes to the Axoloti's analog inputs from the microcontroller I've been using to control the Axoloti by MIDI. Since the ADC receives higher resolution than the 7 bit MIDI signals, is it possible to send information from the PWM out of a Teensy into the analog ins of the Axoloti?

If so, it means that I would have to make the Teensy the MIDI handler, so that the note messages are sent at the same time as the envelope. Alternately, I could use the Axo as a MIDI thru to send messages from the Axo MIDI inputs to the Teensy, then back out to the Axoloti, but I'm worried about latency, unless the latency would be negligible.

Does anybody have any experience doing something similar? These are all things that I can figure out by myself, but I figured I would ask here first in case it saves a few hours of trial and error! Thanks!


#2

Found it.

Seems like just about every time I have a question about a digital-to-analog solution or vice versa, there's a page on the Teensy site dedicated entirely, and exhaustively, to that one specific thing. Here it is if anybody is interested.

Turns out that it's entirely possible, but it requires a small additional low pass filter circuit in order to work.

https://www.pjrc.com/teensy/td_pulse.html


#3

Little update on this, in case anybody finds it useful.

Tonight was the first real effort to receive modulation from a microcontroller. The cool part is how easy it was because the microcontroller sending the modulation to the Axoloti, was the Axoloti itself!

I've been told that a microcontroller's analog outs can be wired back into their analog ins directly, so the schematic for this was literally PA4 -> PC0.

The PWM documentation from the Teensy page in my previous post above recommends using a hardware low-pass filter to smooth some of the 'stepping' from the digital signal, which I tried at first using a 1uf capacitor and 1k resistor. It ended up slowing (softening?) the signal quite significantly. Then I tried it without using the low-pass filter at all, and the results exceeded expectations.

A sine wave LFO was used to individually modulate the volume and pitch of the oscillator in the patch pictured here. You can see a slight inconsistency from the received signal on the right, but there were no audible artifacts. The modulation sounded the same as if the control came from the LFO itself. Perhaps if I used something other than an MI CSAW the minutiae would be more detectable :sweat_smile:

Hopefully the next update will be modulation sent from the Teensy to the Axoloti, and hopefully that will be sooner than a few months from now!


#4

The Axoloti GPIO pin outputs the LFO as a voltage, not as a PWM signal, so no lowpass filter is required. The signal received from the Teensys PWM output filtered by the simple rc circuit will probably give you much worse results, but it may also be interesting and good enough for modulation.


#5

Oh that's really good to know. Showing my lack of knowledge here, but does the Axoloti's DAC route to the analog out pins? If that's the case, I have the Teensy audio shield as well, but I'll have to look and see if using pins on the audio shield for modulation means sacrificing the audio outs.