Fast pulse counting and real time count evaluation speed and angle

I’m looking for a clever code which does following task (with Arduino Hardware!).

  1. Reading of 2 independent pulses (hall sensor, proximity senser, MPU etc. (each between approx. 0 and 4000 pulses per minute (or 0-67Hz). Let’s call the frequency values C1 and C2.

  2. Calculation of the frequency difference between C1 and C2. Assumption: C1 is always greater than C2.

  3. Reading of pulses coming from an oscillator with a fixed frequency (1Mhz) – it is preferred to use the internal system clock. Instead of reading pulses, also an accuracy stopwatch function might be also applicable…

  4. If C2 has reached a defined frequency (eg. 58Hz) and if the difference between C1 and C2 is lower than a defined value (eg. 2Hz), then:

The next input pulse of C1 will start a new counter. This counter will be stopped by an input pulse of C2. The counter itself shall count the number of pluses from the 1Mhz oscillator (or measure the accurate time delay between C1 and C2 pulse).
If the time difference between C1 start pulse and C2 stop pulse is high, then the counter value is high (and vice versa). The counter value (and some values calculated out of the counter) shall be output continuously (C1 pulse always starts the counter, C2 pulse always stops it).

Reason: The function shall determine the differential speed and the differential phase angle between two fast rotating motors.

I don’t know if this is possible with simple Arduino hardware, because I guess several interrupt routines and maybe multithreading is required for this task.

Any idea? Or better ideas?

Provide at least a demo program where you call dummy functions for the not yet implemented parts. Your description is lengthy but not really helpful.

Output what, where, how?

What's the phase angle between motors of different speed?

1 Like

it´s a bit complicated if you will measure C1 and C2, plus requiring some pulses on C2 to trigger some action on a measurement of 1 pulse of C1 ???
you were measuring frequency delta from C1 and C2 which needs a certain average of the samples... I dont think is a good idea "next pulse will trigger certain action IF another pulse on C1 ,etc etc " forgive me but I think you need to divide your problem in digestable sizes and make draft of each one of them..

Welcome! We need some help so we can help you. Can you post an annotated Schematic, not a frizzy (Fritzing) picture. Also include links to each of the hardware devices, links to marketplaces such as Amazon do not have the needed information and are useless. Post your code, follow the forum directions. We will help you but if you need it written for you there is another section that will do just that for a fee.

Reads like a school assignment.

Hi, sorry for my late response - I was on holiday and very busy with other things. I'll post an example and a sketch soon.

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