software-based fine tuning the CV DAC

Discussion, support, and resources for our noise making modules and kits.

Moderators: Kent, scottwilson

Post Reply
User avatar
Wiggling with Experience
Posts: 435
Joined: Mon Sep 16, 2013 12:54 pm

software-based fine tuning the CV DAC

Post by scottwilson » Mon Jan 19, 2015 8:16 pm

This may be one of the more mundane updates that I'm working on for 1.1, but it's important nonetheless (for a few reasons).

With 16 channels of output, only a single offset pot, and sooo many gain adjustment pots, it's really impossible to get a 'b in perfect tune. And if you're a perfectionist like me, you'll spend way too much time tweaking those pots.

Now, once you get them close enough (within 50mV), there is a way to fine tune it in software! In my example, for a +/- 10V model (which are particularly hard to tune due to the gain staging) I can get each of the 16 channels to have a perfect zero point and to have an average 40mV improvement at the far end of the scale - down to within 0.1% !!

I haven't tested the +/- 5V version, but I expect it will be a even better since the tuning for that one is a bit easier and generally ends up closer to the mark to begin with.

When the software is done, I'll provide a spreadsheet like this that will let you run through the tuning sequence and provide some values that you can plug in.


Right now, the code looks like this, but I'll add it to the JSON config (Oh, i haven't mentioned that before have I?) that lives on the SD card.

Code: Select all

bool b::softTune = true;
int16_t b::offset[16] = {-5, -2, -1, -3, -5, -6, -4, -6, -5, -5, -3, -4, -7, -5, -5, -8};
int32_t b::scale[16] = {1002, 1004, 1003, 1003, 1004, 998, 989, 998, 1000, 994, 991, 999, 1003, 1001, 1004, 1009};

This will do a few things...

1. It will allow you to adjust the tuning more regularly without having to remove the 'b from your rack. Once it's basically in tune, you can continue to adjust in a config file.

2. It will allow me to simplify future iterations of the 'b by using a fixed resistor bias and gain network... I'm trying to get the 'b to be a lot cheaper to make as I get more software for it, it will have applications for non-Arduino hackers more and more.

3. If I ever, say, wanted to build a successor to the 'b that, for instance, used an SMT, 16-channel, 16 bit, buffered output, bipolar +/- 10V DAC, then this would use the same code to tune since they don't have any external tuning circuitry at all.

I will do the same for the ADC input which already uses a fixed gain network, but with an adjustable bias.

User avatar
Learning to Wiggle
Posts: 37
Joined: Sun Mar 09, 2014 4:32 am

Post by 2mb1o » Wed Jan 21, 2015 4:57 pm

It's funny, I was thinking of something like this.
A code for recording b's output on b's input and generate offset arrays to correct the ouput.

User avatar
Wiggling with Experience
Posts: 435
Joined: Mon Sep 16, 2013 12:54 pm

Post by scottwilson » Wed Jan 21, 2015 9:58 pm

Yeah, I think we spoke about that possibility.

I think the biggest problem with that would be the noise on the input side. There's clearly a significant amount of noise - far more than the mV or so of non-linearities of the DAC.

This makes sense since the DACs are relatively high-quality dedicated ICs whereas the ADC (there's really only one) on the Due is a crude device embedded with a boatload of noisy digital components. The next iteration will certainly use a dedicated ADC to help reduce that noise.

Anyway, it's working and the code is in the 1.1 branch and you can get it really close if you first do the spreadsheet and the make any further enhancements by hand.

I've also added into this configuration file a way for you to define some other system configurations. You can specify if your device is a high-gain or low-gain model so that we can remove that information from the code and *.b files. You can also specify a brightness level of the CV LEDs.

Will get the spreadsheet and docs up soon.


Post Reply

Return to “nw2s”