Frequency measurement for generator monitoring

Hi all, I’m new to openenergymonitor forum and I’m after some advice.
I am using the emonlib with an arduino nano to measure Volts, Amps, Power, and Power factor which will hope to be part of a generator controller. To measure rpm i would like to be able to measure and display the frequency. Its a small 2 pole 3000rpm unit so will/should produce 50Hz.
Searching on the forum i found this from the Archives;
Unfortunately i dont fully understand the instructions to make this work. I have the .cpp and .h files in my arduino sketch folder so i can modify them locally. does anyone have the complete files or guide me with examples?

Unfortunately, that was a contribution from a user, and I’m not aware of any follow-up. I obviously looked at the post at the time, and maybe tried it out, but I can’t remember anything about it now.

I’d have serious reservations about using emonLib for that - to start with, it can’t differentiate between leading and lagging power factors (because it doesn’t measure against the quadrature voltage that would give you vars) and secondly because it’s sampling.

emonLibCM will report frequency (but it still can’t differentiate leading and lagging power factor), and if you’re not using JeeLib with it, I believe it’s quite stable. But I don’t have an Arduino Nano and so it’s never been tested on that hardware, only on the emonTx - but it’s the same processor, so there should not be a problem.
emonLibCM is available on GitHub, complete with documentation and example sketches for the emonTx.

Thanks Robert for the quick reply, I will look into this

As a first pass I’d be looking to use rpm (with appropriate calculations) for engine speed, rather than frequency. The reason for this is if your voltage disappears so does your frequency, an issue that doesn’t happen if you measure engine speed directly.
Having said that, engine speed will likely require different hardware to what would be available in an EmonTX, although there are several industry standard instrumentation options to use to detect it.
There is also the question of how fast you need your reference speed updated in order to do whatever your controller needs (is it a backup generator, does it need to work in with other power sources etc), which may guide your method for measuring and displaying frequency.

The original question was:

There’s no way I’d contemplate using an Arduino Nano to control motor speed - as I understood it, the requirement is for display and indication only.

I read the ‘part of a Generator Controller’ aspect. I agree though, I wouldn’t be using a Nano for this application either.

This would only be used to monitor speed and frequency, the gen-set (diesel) is mechanically governed to 3000 rpm. I agree any psuedo/realtime montoring using a nano would be too slow. The ‘control’ part will include mains failure notification via a relay, start the generator then to energise an output contactor after a period run up time. I will also incorporate an engine stop circuit. (all fairly basic code)
This is a backup generator but havent included and changeover circuitry as yet (with both mechanically and electrical interlocking)
The original plan was to use an arduino Mega but I’m interested to know what others might use?