If your signal truly is max 100Hz or thereabouts, AND your Arduino isn't doing much else, this couldbe managed by using analogRead(). But, how much do you know about the cleanliness of the signal? Is it a square pulse, or is it a noisy mess? If it's relatively clean, you can threshold the signal and capture millis() or micros() timestamps for positive and negative transitions, then calculating the rep rate. I'd certainly try that, anyway, because it has a good chance of working.
Thanks for telling us what Arduino is being used. I take it you have a lot going on on your ESP32, because my comments were with regard to doing this on a Nano. You have so much more CPU resource on an ESP32, I'm surprised you think it would be taxed.
Your requirement should be more than doable without external circuitry.
If you do it externally, what you need is a comparator with an adjustable threshold, not an amplifier.
So, the lower amplitude you need to catch is about 46mV, right? You could try with AnalogRead, it could work if the signal is more or less clean.
Do you have an oscilloscope to check the signal? How does it looks and if it has noise or glitches. Is it from 0V to 46mV? or -46mV / +46mV?
If AnalogRead doesn't work, you could use a comparator setting the reference below 46mV. This would produce a square wave from V+ to zero, that you could attach to a digital input pin to trigger an interrupt function.
I bought a LM393 comparator from Jaycar (AU$2.65), cobbled up a voltage divider to give me a reference voltage of 80 mV on one input and fed the voltage from the wind sensor into the other input.
This has produced a nice on/off square wave form on the output pin, now Iām working out how to get the ESP32 to measure that frequency using the FreqMeasure library. (First thing is to check if that library is compatible with the ESP32.)
You can just attach an interrupt function to the FALLING/RISIN event of the input pin. Then you just store the micro-seconds elapsed since the last time, by keeping the previous timestamp in a static variable.
Or you store the time differences in an array of 8 or 16, each time one. Then outside when you need the frequency you just average them and invert.
I had stumbled on a solution using the interrupt approach last night.
It looked interesting and given your support for the idea Iāll give it a go.
I must admit Iām still getting my head around how much more powerful these chips are than the old Picaxe chips Iām used to. I have to learn to relax and accept that they can handle a lot more āworkload.ā I need to put some time aside to read up on their performance capabilities.
I started out using PicAxe ~10 years ago, and when I migrated to Arduino the difference was, well, "startling" doesn't begin to cover it. (I don't know how PicAxe has improved since then.)
The MCU chips themselves probably have similar speed and capability. The difference, I think, is down to the interpreted BASIC on PicAxe versus compiled C++ on Arduino.