[sdiy] Quantizer with Arduino, ADS1115 and MCP4725
Mike Bryant
mbryant at futurehorizons.com
Thu Jun 20 11:01:23 CEST 2024
Agreed.
Only if you're not using an MCU with PWM built in, I'd suggest using PDM (just reverse the bits from the counter to the comparator). Moves any noise as you change the output voltage higher in frequency.
________________________________
From: Synth-diy <synth-diy-bounces at synth-diy.org> on behalf of Sean Ellis via Synth-diy <synth-diy at synth-diy.org>
Sent: 20 June 2024 09:56
To: Scott Bernardi <scottbernardi55 at gmail.com>; mskala at northcoastsynthesis.com <mskala at northcoastsynthesis.com>
Cc: SDIY List <synth-diy at synth-diy.org>
Subject: Re: [sdiy] Quantizer with Arduino, ADS1115 and MCP4725
I've been working on a quantizer that is using only PWM, it's light years ahead of the MCP DACs when it comes to accuracy. I've had both side by side and you can hear the difference without measuring, I would avoid those cheap DACs.
________________________________
From: Synth-diy <synth-diy-bounces at synth-diy.org> on behalf of Matthew Skala via Synth-diy <synth-diy at synth-diy.org>
Sent: Thursday, 20 June 2024 4:20 AM
To: Scott Bernardi <scottbernardi55 at gmail.com>
Cc: SDIY List <synth-diy at synth-diy.org>
Subject: Re: [sdiy] Quantizer with Arduino, ADS1115 and MCP4725
On Wed, 19 Jun 2024, Scott Bernardi via Synth-diy wrote:
> number of semitones. For example, a major scale would be
> 0 2 4 5 7 9 11 semitones.
> Minor would be
> 0 2 3 5 7 9 10
> The necessary binary counts would then be 512 times these.
> Using the number of semitones for the scales is convenient, because then for
> the 12 bit MCP4725 output, I would multiply by the bits per semitone value
> of 32. Or another way to think of it is to throw away the 3 least
> significant bits and the sign bit to go from 15 bits plus sign bit to 12
> bits for the output.
The MCP4725's output may be up to 14.5 counts off of a theoretical linear
input-to-output function. If full scale is 5.333V, that translates to
0.02V or about 23 cents of pitch. And that is how closely it approaches
*some* linear function, not necessarily *the* linear function you want it
to be. Gain error 2% and offset 0.75% are possible according to the data
sheet. If I'm correctly understanding how those are applied, it seems
like in the worst case gain and offset could add error of up to 0.14V, 165
cents (!), on a reference voltage of about 5V.
If you want your pitch accuracy to be better than that, a simple "multiply
semitones by X" calculation is not going to be good enough. You have a
bigger problem than just trying to make X be equal to 32.
I think to get good results you're going to need to do some calibration:
send different codes to the specific individual DAC chip you're using,
measure the output, find the code you need to send for each desired
output voltage, and then store those in a table and look them up when you
want to get different voltages. This needs to be done individually for
every chip because the point is to compensate for the manufacturing
variation among the chips.
Similar issues may apply to the ADC, so you risk a garbage-in, garbage-out
situation.
And then if you're doing the work to calibrate individual steps, there's
not much to be gained by pushing the power supply voltage, and I wouldn't.
The 5.5V maximum spec really means "it's 5.0V with a safety margin," not
"5.3V is perfectly okay and normal" and if you cut into that safety margin
you may end up regretting doing so.
--
Matthew Skala
North Coast Synthesis Ltd.
________________________________________________________
This is the Synth-diy mailing list
Submit email to: Synth-diy at synth-diy.org
View archive at: https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsynth-diy.org%2Fpipermail%2Fsynth-diy%2F&data=05%7C02%7C%7C7b43573a2bc144535fa608dc90d032d0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638544471107082537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=f26SnPwzIS8M%2F09apEFaydzf58vVzjOPF5RHas1u%2Bh0%3D&reserved=0<https://synth-diy.org/pipermail/synth-diy/>
Check your settings at: https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsynth-diy.org%2Fmailman%2Flistinfo%2Fsynth-diy&data=05%7C02%7C%7C7b43573a2bc144535fa608dc90d032d0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638544471107094044%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Wt0xljiMj5pvzK21%2FishEddgUWrjpETlpEYmJqUJjUE%3D&reserved=0<https://synth-diy.org/mailman/listinfo/synth-diy>
Selling or trading? Use marketplace at synth-diy.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20240620/f9ea4dbc/attachment.htm>
More information about the Synth-diy
mailing list