Analog read rate, TinyZero slower than TinyDuino ...??

jlastofka

  • Full Member
  • ***
    • Posts: 18
    • View Profile
I'm doing some testing with a simple loop that reads an input and stores to an integer array. I use micros() before and after the loop of say 10 readings, then after the timing loop I print out the time and the readings for inspection.
I'm getting MUCH faster reading time on the TinyDuino than on the TinyZero, which seems odd because it seems the TinyZero would be faster if anything, or the same if it's just the Analog input speed limit.

I get about 120 microseconds per reading on the TinyDuino
I get about 420 microseconds per reading on the TinyZero
I suppose it could be something different in the analog hardware, but the clock speed should be 8x on the Zero. I'm using default clock speeds and haven't changed any other settings if there are any.

I've tried different loop counts with about the same result. It shouldn't be anything about the serial port because I don't print anything until after the reading loop.
Anyone else know anything about different Analog Input rates for these processors?
What kind of reading speed do you see?


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Hello,

The results you're getting are definitely aligned with the accurate speed settings. If you're looking to get faster readings from the SAMD21 (TinyZero) or the ATmega328P (TinyDuino) then you can try using the libraries mentioned in this blog: https://www.avdweb.nl/arduino/adc-dac/fast-10-bit-adc

I hope that helps with whatever you're building!

Best,

RĂ©na


jlastofka

  • Full Member
  • ***
    • Posts: 18
    • View Profile
I discovered the difference (probably). The TinyZero ADC is 12 bit A/D and the other is 10 bit so there's probably a basic hardware speed difference.

I wasn't really trying to make it faster. I just didn't know why it was different. I haven't done regular Arduino, only the Tiny products, and I didn't realize before that one needed to go look up the different Arduino models to know the differences between the Tiny products. Makes sense now that I see it.


 

SMF spam blocked by CleanTalk