I
I
Igor Mikhailov2019-12-09 11:49:07
Arduino
Igor Mikhailov, 2019-12-09 11:49:07

How to count the number of pulses per unit of time?

Good day.
The question arose about counting the number of pulses from the Geiger-Muller counter using an arduino.
A transistor output is connected to the input of the digital pin, which supplies + 3.3V (logical unit) when the tube breaks down.
How to count the number of pulses - it's as easy as shelling pears. And how to make a calculation for a certain period (1sec, 10sec, 100 ...)? in order to make different modes of counting and accuracy.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
d-stream, 2019-12-09
@SymbiSoft

We increment a variable for each pulse, and read and reset this variable using the timer with the required interval.
That is, "on the forehead" we read-reset every minute => the number of pulses per minute
It is clear that it will be a thankless task to read-reset this counter every second if the pulses come once a minute (that is, more often than the pulses arrive).

K
Konstantin Zaitsev, 2019-12-09
@KonstantineZ

It seems to me that the easiest way is to count per second and add it to an array, the length of which is chosen according to the maximum counting time. Do you need 10 seconds? You add the last 10 elements. In addition, you can draw a graph over time on an array, and this is very clear.

G
Grigory Boev, 2019-12-10
@ProgrammerForever

As an option, measure not the frequency , but the repetition period of the pulses. And count on the moving average for N clicks. The background will be considered slowly, because there are few clicks, but if there is a lot of data, then the readings will change faster. But in any case, the accuracy will be predictable and about the same at any click speed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question