I know this isnt an arduino forum but when i proposed this question on their forum they pointed me to this website as the problem is processor specific. So im hoping someone will still be able to help me.
I am starting a project that uses the Arduino nano 33 ble sense which contains the nRF52840 microcontroller I have hooked up 3 microphones to 3 of the analog pins (A0, A1, A2) and need to sample analog inputs from them as fast as possible. The best I've been able to do is 20us per microphone or 79us for all 3 mics. my code to do this is
int mic = 0; int time1 = 0; int time2 = 0; void setup() { Serial.begin(115200); nrf_saadc_acqtime_t acqTime = NRF_SAADC_ACQTIME_3US; adcCurrentConfig.acq_time = acqTime; analogUpdate(); } void loop() { time1 = micros(); for (int i = 0; i < 100000; i++) { mic = analogRead(A0); } time2 = micros(); Serial.println((time2 - time1) / 100000); }
The problem is that 20us is still not fast enough for my application ideally it would be around 2-3us (but the faster the better) I don't see why I wouldn't be able to do this as the microprocessor runs at 64mhz and I'm only able to sample at 50khz. Is there a way to sample analog signals faster using the Arduino IDE.