Opinions on ADC Roadmap?

Thundercat

Well-known member
Hey all, I'm in process of developing a larger MIDI controller (I've made a bunch in past with Teensys, successfully).

This new one is going to have 8 faders, and 8 "endless potentiometers" (they are actually carbon-track pots that Alpha makes that function as endless encoders, but they feel exactly like pots because, they are).

Obvs I'm going to need analog inputs for all of them, and the endless pot/encoders require 2 analog inputs each. So we're looking at 24 analog inputs.

I'm aware Teensy 4.1 maxes out at 18 analog inputs, and indeed all can't even be used because some pins are for I2C etc, so I can't just use the onboard ADCs.

So then I was going to just multiplex the analog inputs to the available Teensy 4.1 pins and be done with it, but I want this unit to be MIDI 2.0 ready. In other words, be able to reliably handle at least 12-bit ADC or preferably 14-bit.

I'm aware you can oversample on the ADC inputs, but because I'd need to mux them I'm concerned about speed, and indeed would oversampling even work depending on noise profile? Wouldn't muxing them introduce latency and all sorts of problems?

So this has led me to a very long week of intense reading/researching into external ADCs, and trust me I get the headaches and complexity these can add to a a design.

So my simple question is, in your experience is it possible to oversample the Teensy 4.1 ADC inputs while using a multiplexed input, without losing speed, and would that even work to give me reliably at least 12-bit resolution? I'm totally aware that I can use the onboard ADCs as-is and get 10-bit, and with averaging, probably stable outputs. I'm also aware this is on the cusp of what would be zipper-free results, so that's why I'm hoping to get at least 12-14 bits. It's for a product that other musicians would buy, so I don't want to cheap out on the design and do "good enough" for now, which I already can do without MIDI 2.0 ready components.

If going external ADC seems a better solution, and I think it might be, I've identified a couple that I think would work.

For the endless pots: ADS1158 (16-bit, 16-Channel, Delta Sigma, SPI)
For the faders: ADS8688 (16-bit, 8-channel, SAR, SPI)

The reason two different ones - there are libraries for each, but the libraries do not support multiple units. I'm not at a point where I feel able to write and debug libraries, or edit them too much, to support multiple of the same devices. Otherwise I'd stick with the ADS8688 because it allows daisy-chaining and I'd love to use the same ADC for all the inputs.

Anyways, you guys have a great way of shooting down "perfectly imperfect" plans that would not be a good idea, so I totally welcome your input. I'm at overwhelm. If I see another data sheet I may hurl.

Thanks for any insights.

Mike
 
ADCs on microcontrollers are always a compromise as they are in a noisy environment and made with a less than ideal process. Go with a external 12 bit ADC I reckon, that's plenty of resolution for a rotary knob (5 minutes of arc!). There's a 16 channel 12 bit, ADS7953. Watch out for funny timing requirements in some nominally SPI ADCs though... The humble MCP3208 is only 8 channel but available in DIP for ease of prototyping.
 
Thank you Mark. Yes I agree 5 minutes of arc is absolutely plenty! I was thinking about a higher resolution ADC though because I figured any ADC I got would actually give me lower resolution in practice due to noise and imperfect PCB, so I was thinking to get a 16-bit and then use the overhead to oversample and average to a stable 12-14 bit result. Does that sound smart, or could I actually get 12-bit resolution out of a 12-bit converter? 12-bit would actually be amazing if I could manage it.

Another consideration for me is making sure I find a library for the converters; needing 24 analog inputs means I'd need at least two or even three ADC chips and most libraries are not setup for multiple devices. Maybe I could make a copy of the library and change the CS assignments and names of devices...never done that before. Even though I've used Teensys for years, and written huge programs for them, I'm still very much a neophyte/noobie at all this.

Thank you again. I so appreciate your thoughts.
 
I figured any ADC I got would actually give me lower resolution in practice due to noise and imperfect PCB
Many discrete 12 bits ADC are fully monotonic and highly linear, but yes no ADC can remove noise or such, but careful PCB design (separate analog and digital ground planes) around the ADC will always be much better than any microcontroller with ADC inputs as those are wideband noise sources.
 
I just searched for Arduino libraries for both those ADCs, found some, and they seem to allow selection of the /CS pin in the constructor, so I’m not sure why you think “the libraries do not support multiple units”?
 
I just searched for Arduino libraries for both those ADCs, found some, and they seem to allow selection of the /CS pin in the constructor, so I’m not sure why you think “the libraries do not support multiple units”?
Well for example, in this library:
https://github.com/TUDA-MUST/ADS1X58

Author states multiple devices are not supported yet even though you can define CS pin.

In this one:
https://github.com/siteswapjuggler/ADS8688a

CS pin is baked into the library.

I’m no genius with this stuff so I’m happy to be wrong and learn differently. How could I create multiple instances of the devices, other than cloning the library and changing parameters?

Is there a library you found where you can create multiple instances? I only found those two (a third library was only partially complete).

Many thanks for taking the time to share. Sorry if this is super obvious and easy. Thank you.
 
Well for example, in this library:
https://github.com/TUDA-MUST/ADS1X58
Author states multiple devices are not supported yet even though you can define CS pin.
I can’t find that statement - can you point us to it?

In this one:
https://github.com/siteswapjuggler/ADS8688a
CS pin is baked into the library.
If you use the alternative constructor you can choose the /CS pin. The author doesn’t seem to have implemented daisy chain support, though. He does still seem to be responsive, despite the age (maturity?) of the library, so a pull request might be accepted if that mode is vital for you; but he said in an issue comment last year he hasn’t used the ADS8668 for 7 years...
 
Thank you for the thoughtful reply Jonathan.

Regarding the multi device support, buried in the documentation for the ADS1X58 is this:

IMG_3445.png


If the other library could work with multiple devices that might work. I’ll try to reach out to them per your suggestion, thanks.

I received your PM and replied.

Thank you so much.

Mike
 
Nope, still struggling here. Looking at the source code it specifically says it does use the CMD_MUL_EN bit if you want a multi-register read; in any case, that’s unrelated to using multiple devices.

I‘m a bit suspicious about the presence of “copilot” in the above image. Are we looking at actual library documentation, or something hallucinated by AI?

Either way, it doesn’t really matter. There is no obvious reason why either of those libraries shouldn’t work out of the box, but if they do have lingering bugs they should be fixable. You’ll never be sure until you’ve tried - maybe pick your favourite (ADS8688), do a quick single-chip breakout module design, get a few made, stick them on a breadboard and see what you can get working. There’s even an example layout at Figure 101😊
 
Hi Jonathan, thank you. The "copilot" part actually is on GitHub, so I'm not sure what to make of that.

Thanks for the expertise regarding the code - invaluable!

I like the "get 'er done" vibe. I'm still evaluating some other ADCs but that ADS8688 has a lot going for it.

Another contender is the AD7606. https://www.analog.com/en/products/ad7606c-16.html

It has a lot going for it, including oversampling onboard and simultaneous 8-channel data acquisition, plus a simplified analog front end (AFE) requirement. There's even a library for it by one of our own forum members here: https://forum.pjrc.com/index.php?threads/ad7606p16_t4-library-v0-0-1.77064/

Thanks and I'll post more when I get more down the line with this or have more questions. Any suggestions from anyone are always welcome.
 
Back
Top