Counting low voltage pulse frequency

Hello all,

I need to measure some pretty low voltage pulses from a sensor.

The sensor alternates between about 46 mV and 700 mV. The expected frequency of pulses is from maybe 1 Hz up to (at a guess) 100 Hz.

The 700 mV pulse seems to be too low for the various Arduino frequcny functions to detect. Can anyone recommend an approach to the problem?

Matt

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.

First thought is to use a lower reference voltage for an ADC and use analogRead().

Else a small amplifier using transistors or an opamp.

I think analogue read will be too resource intensive. The results have to be piped out to Bluetooth or maybe a can bus.

Also I’m using the ESP32 and I understand they are not great at love voltages?

The amplifier idea sounds like it might be the go. Just not sure how to go about determining the correct circuit or components.

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.

Good luck.

I don’t have a feel yet for how hard these things can be driven,

By the sound of it, there’s more power than I expected.

I’ll try the analogue read and see how it goes but I’ve also spent some time reading up on the amplifier idea and it sounds good too.

Thanks for the hints.

Matt

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.

Nothing as sophisticated as an oscilloscope available I’m afraid.

I expect the wave form will be reasonably clean, but no way of knowing until I can do some testing.

I’m not sure what a comparator is, heading off to read up on those now.

1 Like

A follow up and thanks for the help so far.

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.

Thank you Gromit1.

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.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.