Hi All
I need to continuously monitor/sample 32 analog inputs with minimal latency (all at 10bit).
As far as I can tell there are three ways for me to achieve this ...
- Acquire and incorporate (through SPI?) a few External ADC chips with appropriate specs.
- Increase number of inputs with Multiplexing.
- Use multiple Arduinos to get desired number of inputs and feed into a master Arduino of some kind.
Which is likely to be the best architecture for achieving minimum latency at the end?
My problem is that trialling all three options is quite daunting/expensive/time-consuming and I expect I'll find multiple complications with each anyway.
So I would really appreciate someone with a lot more experience than me saving me the trouble and pointing me in the right direction from the start (or other options I haven't thought of?)
I have read previous relevant posts re 'multiple analog inputs' on this forum plus google in general, so apologies if the answer to this is already on here but I couldn't find it!
Some background information if it helps …
- Why need 32? They will correspond to sensors in a unique musical instrument. Reducing this number kind of ruins the whole thing! (It was a struggle to be satisfied with just 32.)
- Minimal Latency? Ideally <20ms for the complete system, but this will include plenty of latency incurred at later stages (eg wireless transmission, signal processing, midi communication). I really need to minimise it ruthlessly at every stage.
- The readings will usually be converted to midi (though current plan is to do that outside the arduino, in a PC), but still need 10bit resolution out of the Arduino, despite eventual midi being 7bit.
- Sample Rate needed? not sure yet. Probably less important than latency. Will need to be suitable for Midi messages at the end of it all, but I imagine the wireless transmission stage will be limiting factor for this (planning on using NRF24L01).
- There will be a variety of sensor types - including FSRs, Infrared distance sensor, ultrasound distance sensor, flex sensors, basic pots, custom pots, softpots, resistive XY touch pad etc. I am aware these will lead to a variety of input impedances and signal ranges (and latencies in the actual code needed to read some of the more complicated sensors)- I was planning to give each an op amp circuit to try to present similar signal ranges and impedences to ADC(s). Not sure yet how to deal with the different latencies that the actual unique code needed for some of those will incur, but I think that's a coding challenge, not a hardware one, so not worrying about that yet!
- There will rarely be more than a handful of sensors giving active signals at any one time, but they all still need to be scanned swiftly just in case, even if the majority are then deemed dormant.
- Power may be a challenge - it will need to be battery powered. I am expecting to need to incorporate a heavy weight of battery power!
- Size is also potentially an issue - eg I may struggle to make room for 5 x Arduino Megas, if that's what's recommended.
- I have been working from Mike Cooks book 'Arduino Music and Audio Projects', which has provided excellent advice and inspiration on many obstacles, just not the answer to this specific question!
- I am planning on using 'Mega 2560 R3'(s), but not the end of the world if I need to go with something else. Smaller would certainly be welcome.
I hope that all makes sense.
Many thanks for reading.