Chord VCO with Arduino (Hagiwo)

Proper! 202020202020

2 Likes

Hi, i don’t actually have any BAT43 diode. Does a 1n4148 could do the trick ?

2 Likes

No. The purpose of the diodes is to protect the Nano and the MCP6232 against voltages outside their valid range. The BAT43 (or other Schottky diode, such as 1N5817) will limit voltages to a range of about -0.2 to +5.2 V. A 1N4148 would allow -0.7 to +5.7 V, which isn’t good enough.

All of which is moot if you are careful not to plug in anything connected to a voltage outside the 0 to 5 V range. In addition the Nano’s microcontroller has internal protection diodes and the external ones arguably are unnecessary, though that’s not true of the ones on the op amp.

So you could omit them for now if you take great care not to send the wrong voltages in. I’d install them later when I had them, though, or at least the op amp ones, because sooner or later you always connect things that weren’t meant to be connected.

4 Likes

Thanks @analogoutput ! The circuit is working, now I will wait for the diodes

2 Likes

I want to do a KOSMO pcb for this module and I was wondering about the output:

  1. the clamping diodes are not required because a tl072 output should be pretty roboust, right?
  2. what are the resistor and cap doing there? Does the cap work as a high pass without a resistor to ground?

If you use a TL072 with ±12 V power you shouldn’t need the diodes. (With the rail to rail op amp shown with 0/+5 V power it needs protection against voltages outside that range.)

The resistor presumably is for current limiting. I would use 1k. 220R, if it is 1/4 W or even 1/2 W, will be under spec to handle the power dissipation if the output is shorted to ±12 V. (P = V^2/R = 12^2/220 = 655 mW.)

The cap is for AC coupling, which indeed is high pass filtering, and no, it does not work without a resistor to ground, but the module you plug into probably has ~100k to ground. That works but I’m not nuts about using the downstream module to complete the filter. With a dual supply op amp you could move the cap upstream of the op amp and add a resistor to ground. 100k and 4.7 µF strikes me as kind of large, it’s a cutoff frequency of 0.3 Hz and time constant of half a second (so it’ll take that long to drive DC toward zero). The cutoff doesn’t need to be any less than around 10–20 Hz. I’d probably try a 1 µF film cap and a 10k resistor… wait, maybe 100 nF and 100k to present a higher impedance to the PWM filter. Or since the DC offset is presumably a fixed 2.5 V you could subtract 2.5 V at the op amp.

4 Likes

Nice, I will do that! Any idea why there is a second low pass filter in this design? The “official” mozzi documentation does not have this:


(Also the value for C1 is 4.7nF instead of 10nF in Hagiwo’s design)

Second order filter? But it’s the same impedance as the first, I’d think it should be higher.

Ignoring the second filter stage, the RC cutoff frequency for @HAGIWO’s design (3.9k and 10 nF) is 4081 Hz. It looks like with the second pole, using the components shown (instead of the larger resistor and smaller capacitor I’d expect) it’s down around ~3 kHz. For the Mozzi design (3.9k and 4.7 nF) it’s 8683 Hz.

Down below the above diagram in the Mozzi documentation is this:

Mozzi’s sound output can be filtered to reduce aliasing at high frequencies. Here’s some info about low pass RC filters and a calculator to help choose components. For Mozzi, an RC filter with a roll-off frequency of just under 6kHz works well, using a 270 Ω resistor and a 100n capacitor, as shown below. In HIFI mode, this would be on the combined audio output signal rather than straight from pin 9.

So the cutoff for the filter in their own image (the one above) seems too high by that recommendation, Hagiwo’s without the second pole seems too low, and Hagiwo’s with the second pole seems much too low. All of these are in the audio range. I’d think a 2-pole design with a higher cutoff frequency would be preferred but it’s not what the Mozzi docs recommend,* and in any case just doubling up with the same components doesn’t strike me as the way to do it.

Added: Hm, in the FM VCO the filter caps are 4.7 nF and 10 nF, and in the Additive VCO they’re 22 nF and 10 nF. 3.9k resistors always. Writeup says

The low-pass filter of the audio output circuit (D9, D10) has a lower cutoff frequency than the recommended value. Since the sound consists of sine waves, unwanted harmonics stand out. had to cut it.

but I still don’t understand why the caps are equal in one circuit, first larger than second in another, and second larger than first in the third.

* Added: I’ve just remembered the Kassutronics Quantizer, which uses PWM for its high linearity. It’s putting out quantized control voltages, so sampling artifacts aren’t a concern, and it’s using 125 kHz for the PWM frequency versus the ~32 kHz of Mozzi. It uses a four pole low pass filter: an RC stage with 15k and 1 nF (10.6 kHz cutoff), another RC stage with 68k and 220 pF (also 10.6 kHz, 4.5x higher impedance), a buffer, and then two more stages and another buffer like the first.

1 Like

Maybe it was just trial and error? Like “the chords just sound better when removing a bit more of the high frequencies”…? probably only @HAGIWO can explain :slight_smile:
Maybe I should make the 2nd resistor a trimmer to make the whole thing adjustable? I also want to add some gain to the opamp to bring the level up to eurorack standard.

Another thing I noticed is the v/oct in:


Why the 100ohm here? The input section of the other CV inputs will drop the voltage slightly (1%), maybe that’s the reason?

1 Like

Maybe, but what puzzles me is the relationship between the two caps — equal, or low/high, or high/low.

Notice on the other inputs the 100k to ground is after the 1k resistor, forming a voltage divider. On the V/oct the 100k comes first. There’s no voltage drop across the 100R resistor. So there’s no reason it could not also be 1k. I think originally Hagiwo had the 100k to the right of the 100R and that was why a 1k wasn’t used.

But the cap is 68 nF in both cases, so the low pass cutoff frequency is 10x higher for V/oct than for inversion and chord. Meanwhile on the pot inputs it varies from 7x higher (1k and 10 nF) to 15x lower (101k and 10 nF). Seems strange to me. The pots are just connected to the regulated 5 V, do they really need these filters? And shouldn’t the CV inputs all have the same cutoff frequency? But which one?

1 Like

Arduinos analog inputs seem to be extremely prone to noise and there can be all kinds of high frequency shenanigans there. Try making a simple program that just reads analog inputs with those kind of voltage divider pots and make it print something or flash a led every time the read value changes, don’t touch anything and be amazed. I like to put some kind of averaging function to those in software to try to minimize that wobble.

6 Likes

Yeah, interesting… I guess I will need to do some breadboarding soon :slight_smile:
(always the same, you just want to simply copy a design, be done with it quickly and then you try to understand it and all kind of weird stuff happens and in the end you spend the next 10 evenings breadboarding and never finish the design xD )

2 Likes

Averaging makes more sense to me than hardware filters whose cutoff varies by a factor of 100. (Well, OK, those are DC inputs so as long as the cutoff is below the noise frequency it doesn’t matter how low it is.)

Actually maybe the caps are not for filtering but to provide a voltage that can fill the ADC caps faster. But if so, why would the CV inputs need 7x larger caps?

Speaking of which, would 10k pots be a better choice?

1 Like

I was also thinking about those 1k resistors in series, they just make things worse. But if you have Arduino that has random configuration of pin-states, some of the inputs could be configured as outputs and be high, so with potentiometer shorted to ground it could fry something from that pin. Of course, you could program the Arduino before putting it there, but if you want to change anything from the code while it’s in the circuit, you technically have a possibility of frying it by messing something up in the software.

1 Like

Another alternative that doesn’t require multiple sampling and averages would be to set a deadzone.

If the problem really is just that little bit of analog wiggle, this should solve the problem. You see this with game controllers which also use simple analog pots and microcontrollers.

Have a threshold by which it much change for it to be considered changed by persisting last reading, find a diff, then check if that diff is greater than tolerance.

It takes less samples to make a determination and could reduce latency. Although normally I personally just use other folks conditioning heuristics.

1 Like

I’ve done that too, it takes a bit of testing to find just the right range for the zone, if it’s too large you can’t make small changes without wiggling it a bit more at first.

2 Likes

I found this on the website:

The V/oct circuit configuration has been changed from the 2OSC VCO and FM VCO. I took your advice and moved the pull-down resistor between the limiting resistor and the jack to avoid voltage drops due to voltage divider.
I am still inexperienced, so the advice is very helpful.

So you were right :slight_smile:

Also found this:

The low pass filter of the audio output circuit (D9, D10) is slightly modified. This is a matter of taste. You can use any constant you like.

So yeah, no specific reason, it comes down to taste.

Still thinking what the “ideal” v/oct input would look like. I would like to have higher input impedance, but then I guess I would need to use an opamp (maybe the second tl072 one, or use a rail2rail and have input protection from that as well) or try the kassutronics quantizer cv inputs again… (I don’t understand them yet)…

1 Like

The (DC) input impedance is the resistance to ground, 100k here. You could make it 1M if you needed to. I don’t see that it’d need other changes.

image

There’s a 100k to ground here too, then a 2 pole passive low pass filter, a buffer, and a mixer with +5 V so a ±5 V input is mapped to 0 to +5 V. There’s no protection against voltage outside that range, so it’s relying on the MCU’s internal diodes. The buffer’s needed because the filter needs to be isolated from the mixer. Again the 100k could be 1M if needed.

2 Likes

You are right, 100k input impedance is fine, I somehow thought it would be 1k :slight_smile:
Thanks for explaining the kassutronics input! I understood the lowpass, but no the mixer. Okai, so that is to be able to handle negative input CV, I see now! not sure why I would need that though…

If your synth is set up so the lowest keyboard CV is 0 V then you likely wouldn’t — unless that CV is externally mixed with some other CV such as a zero-centered LFO.

But there’s no standard for that, some keyboards or MIDI/CVs are set up with 0 V for middle C, for instance. Then ±5 V gives a 10 octave range, versus 5 octaves for 0 to +5 V.

1 Like