Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Looking for an adc

  1. #1
    Junior Member
    Join Date
    Jul 2020
    Posts
    10

    Looking for an adc

    Hi,

    My name is jeremy and I'm currently on a midi controller project. I use a T4.0 for the microcontroller and some FSRs as sensors. The problem is data acquisition speed. I have 74 fsr and would like to sample all of them (so make 74 measures/ analog read) in 150 micro sec max. I bought a MCP3008 but I am able to reach only 350 micro sec for all measures. And for the internal adc of the T4.0 I have 17 micro sec per read which is too much. Do you guys have any recommendation of an external adc with around 10 bit of precision and a sample speed of 1Mksps. And also do you know if I can sample faster with my T4.0 and if yes how.

    Thank you very much for your time

    Jeremy

  2. #2
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    Well the external adc speed could be between 400ksps to 1msps (it doesnt have to be exactly 1msps)

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    398
    ADCS7477 maybe? Used it before in a motor controller.

  4. #4
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    Looks pretty great but it has only one input channel, I'm looking for something with 4-8 channel. But maybe on channel is enough and I just use a multiplexer connected to the teensy to select the channel to put in the adc. But I don't know, is it adding latency to use a multiplexer before the external adc to select the channel?

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    398
    Didn't see any high speed ADCs with built in multiplexing. External multiplexing is no different from internal multiplexing
    for latency.

    I'm a bit confused by the need for this kind of speed for a MIDI controller in the first place, in 150Ás a drum stick might travel
    about a millimetre when wielded in anger, for instance. Human-relevant timescales are ~ 20ms and above.

  6. #6
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    We need this speed to detect peak of force when we hit the fsr with a vibe mallet. We have seen experimentaly thay we need a refresh rate of 150 micro sec in order to detect efficiently the peak. But as we sample FSRs sequentially we need 150/nb of fsr(=74) sample time per entry which is around 2 micro sec.

  7. #7
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    Also do you kwow if I have to create my own library to use the adcs7477 or is there any generic library for external adc uses?

  8. #8
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    648
    > for the internal adc of the T4.0 I have 17 micro sec

    It will go fast enough for you - you just need the right settings.

  9. #9
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    Quote Originally Posted by jonr View Post
    > for the internal adc of the T4.0 I have 17 micro sec

    It will go fast enough for you - you just need the right settings.
    I succeeded to increase the speed of the internal ADC to 1 microsec for an analog read but I sacrified precision I think (I used the updated adc library : https://forum.pjrc.com/threads/25532...for-Teensy-3-1). For me, I think it's more reliable to use an ADC whose original sampling speed is 1Msps than to boost the internal one, but maybe I'm wrong.

    Here's the code for the "boosting" mode:

    #include <ADC.h>
    #include <ADC_util.h>

    int x,y, val = 0;
    ADC *adc = new ADC();

    void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200); // adc object
    adc->adc1->setAveraging(1);
    adc->adc1->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_HIGH_SP EED);
    adc->adc1->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPE ED);
    adc->adc0->setAveraging(1);
    adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_HIGH_SP EED);
    adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPE ED);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    x = micros();
    val = adc->analogRead(A0);
    y = micros();
    Serial.println(y-x);
    delay(1000);
    }

  10. #10
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    648
    Only needing 400 ksps, you have plenty of room to adjust settings for better precision. Do use low source impedance (say 1K) and both ADCs in parallel (for a 2X speedup).

  11. #11
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    How can you run both adc in parallel?

  12. #12
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    648
    Something like this:

    Code:
    ADC::Sync_result sr;
    
    adc->adc0->setAveraging(1);                                    // set number of averages
    adc->adc0->setResolution(12);                                   // set bits of resolution
    adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED); // change the conversion speed
    adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED);     // change the sampling speed
    
    
    adc->adc1->setAveraging(1);                                    // set number of averages
    adc->adc1->setResolution(12);                                   // set bits of resolution
    adc->adc1->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED); // change the conversion speed
    adc->adc1->setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED);     // change the sampling speed
    
    
    sr = adc->analogSyncRead(adc_pins[i], adc_pins[i+1]); // read two at once
    val[i] = sr.result_adc0;
    val[i + 1] = sr.result_adc1;
    This should be standard practice for anyone concerned about ADC speed. I get .8 usec per read, so you could set Averaging to 2.

  13. #13
    Junior Member
    Join Date
    Jul 2020
    Posts
    10
    Excellent! Will try it in a few hours with the sensors to check the precision but it is very promising. Thanks a lot!

  14. #14
    Senior Member
    Join Date
    Jul 2020
    Posts
    398
    Quote Originally Posted by JerBaf View Post
    We need this speed to detect peak of force when we hit the fsr with a vibe mallet. We have seen experimentaly thay we need a refresh rate of 150 micro sec in order to detect efficiently the peak. But as we sample FSRs sequentially we need 150/nb of fsr(=74) sample time per entry which is around 2 micro sec.
    Ah, so its a very short impact time on a hard surface? A common approach for this kind of measurement is to integrate the signal,
    then difference in successive measurements records the energy, and you can sample less often.

    However this takes extra hardware which is clearly an issue with lots of sensors, and your baseline response probably
    isn't zero to start with requiring a high-pass filter as well.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •