Differentiate between mains and a generator

arduinogeneratormains

This question is related to:

Can I differentiate between a UPS, Generator and Main sine wave using a micro-controller?

I'm only interested in the difference between mains and the generator. Essentially for my PoC I'd like to plug a device into the wall and have a green light if it detects mains, and red if it detects it's on the local generator.

If there's no obvious difference I guess we'd have to train each device at each location – present it mains vs generator and it will have to notice some discerning factor. Possibly a difference in voltage, fluctuation, or frequency?

Any thoughts would be greatly appreciated.

Best Answer

Frequency stability will probably tell you.

UPS you'd have to characterise but it's likely to be crystal controlled, so highly stable with a small but relatively constant error (within a few ppm of 50/60Hz).

Mains is subject to short term drift within strict limits : usually within 0.1 or 0.2Hz but occasionally up to 0.5Hz off, but over the longer term (an entire day or more) the error will average out to 0, higher accuracy than the crystal.

The generator is probably much less accurate or stable than either of these.