Go Down

Topic: Analog comparator interrupt in Arduino Due (Read 1 time) previous topic - next topic


Hello everyone!!

I'm trying to set up a trigger in an audio sampling code. I'm currently using arduino due.

I've done some research and I haven't found anything about "analog comparator" for the Arduino Due.

I know that Arduino Uno has this feature and I've seen a really nice tutorial on how to use it and I believe that it'd be a fine solution for me (just in case: https://www.youtube.com/watch?v=QdJrJXQaiy8).

Can anyone help me? How can I use analog comparator in Arduino Due (assuming that it does exists).

Thanks in advance.



Arduino DUE has
• Automatic Window Comparison of Converted Values
feature in ADC, instead of comparator.
What is your application?


Hey there Magician!!

For now, my application is to sample an audio signal (from a non-shield mic),
to store it and calculate the signal's RMS.

My code actually works but in a "newbie" way. It does the sampling inside the main loop....so every loop will generate a log file with the signal, even though it is just noise and no important signal at all.

That's why I'm trying to use a trigger....to avoid recording (only) noise.

I'll take a look in this " Automatic Window Comparison of Converted Values"....I hope it'll work.

Thanks =D


Magician, I noticed this line in M3-datasheet:

"The comparison circuitry allows automatic detection of values below a threshold, higher than a threshold, in a given range or outside the range, thresholds and ranges being fully configurable."

But I have absolutely no idea how to do it. Can you help me?


1. You don't need a comparator on raw value, false triggering makes it non-operational.
2. To calculate RMS, you have to sample input waveform on periodic base, using timer.
a: canibalize audio library written for DUE;
b: write your own sampling subroutine;
c: find ADC + Timer thread published somewhere on this board.
d: study example in split-radix (DUE version) library.

3. You can introduced "software comparator" as simple as "IF" after you get RMS and filtration.


1 - Ok;
2 - I'll check it;
3 - I thought about it but I figured it wouldn't be that improvement to my code right now.

Thanks =D



first of all i am a beginner in arduino due. my current application is in the automotive domain. in my project we are using the ignition voltage that get from the vehicle and we are also using a li-po battery for backup with sleep mode.and need to make max power management while the device in the Li-Po battery mode.so we need to know the voltage variation in the sleep mode. please give me a better solution..


Go Up